From 8b139491732fbe0b60e39b0a626e65ff2fa0713b Mon Sep 17 00:00:00 2001 From: William Ting Date: Thu, 22 Nov 2012 16:33:05 -0600 Subject: [PATCH] Consolidate source calls to use autojump.sh. Modify autojump.sh to support custom installations. --- bin/autojump.sh | 4 ++++ install.sh | 11 +++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/bin/autojump.sh b/bin/autojump.sh index 73ddf90..16b0f96 100644 --- a/bin/autojump.sh +++ b/bin/autojump.sh @@ -10,4 +10,8 @@ if [ -s ~/.autojump/etc/profile.d/autojump.${shell} ]; then elif [ -s /etc/profile.d/autojump.${shell} ]; then source /etc/profile.d/autojump.${shell} +# check custom install locations (modified by Homebrew or using --destdir option) +elif [ -s custom_install/autojump.${shell} ]; then + source custom_install/autojump.${shell} + fi diff --git a/install.sh b/install.sh index b4013ee..7552004 100755 --- a/install.sh +++ b/install.sh @@ -29,6 +29,7 @@ function help_msg { dry_run= local= +global= force= shell=`echo ${SHELL} | awk -F/ '{ print $NF }'` destdir= @@ -65,6 +66,7 @@ while true; do fi ;; -g|--global) + global=true destdir= prefix=usr shift @@ -213,15 +215,20 @@ cp -v ./bin/autojump.zsh ${destdir}etc/profile.d/ || exit 1 mkdir -p ${destdir}${zshsharedir} || exit 1 install -v -m 0755 ./bin/_j ${destdir}${zshsharedir} || exit 1 +# MODIFY AUTOJUMP.SH FOR CUSTOM INSTALLS +if [[ -z ${local} ]] && [[ -z ${global} ]]; then + sed -i "s:custom_install:${destdir}etc/profile.d:g" ${destdir}etc/profile.d/autojump.sh +fi + # DISPLAY ADD MESSAGE rc_file="~/.${shell}rc" if [[ `uname` == "Darwin" ]] && [[ ${shell} == "bash" ]]; then rc_file="~/.bash_profile" fi -aj_shell_file="${destdir}etc/profile.d/autojump.${shell}" +aj_shell_file="${destdir}etc/profile.d/autojump.sh" if [[ ${local} ]]; then - aj_shell_file="~/.autojump/etc/profile.d/autojump.${shell}" + aj_shell_file="~/.autojump/etc/profile.d/autojump.sh" fi echo