1
0
mirror of https://github.com/wting/autojump synced 2024-10-27 20:34:07 +00:00

change test constructs for bash installation

This commit is contained in:
William Ting 2012-02-07 15:52:15 -10:00
parent 4da9d3ef75
commit aad0521755

View File

@ -21,7 +21,7 @@ function show_help {
# Default install directory. # Default install directory.
prefix=/usr prefix=/usr
local=false local=0
user=${SUDO_USER:-${USER}} user=${SUDO_USER:-${USER}}
OS=`uname` OS=`uname`
@ -41,7 +41,7 @@ while true; do
exit 0 exit 0
;; ;;
-l|--local) -l|--local)
local=true local=1
prefix=~/.autojump prefix=~/.autojump
shift shift
;; ;;
@ -68,7 +68,7 @@ while true; do
esac esac
done done
if [[ ${UID} != 0 ]] && ! ${local}; then if [[ ${UID} != 0 ]] && [ ! ${local} ]; then
echo "Please rerun as root or use the --local option." echo "Please rerun as root or use the --local option."
exit 1 exit 1
fi fi
@ -82,12 +82,12 @@ echo "Installing main files to ${prefix} ..."
mkdir -p ${prefix}/share/autojump/ mkdir -p ${prefix}/share/autojump/
mkdir -p ${prefix}/bin/ mkdir -p ${prefix}/bin/
mkdir -p ${prefix}/share/man/man1/ mkdir -p ${prefix}/share/man/man1/
cp icon.png ${prefix}/share/autojump/ cp -v icon.png ${prefix}/share/autojump/
cp jumpapplet ${prefix}/bin/ cp -v jumpapplet ${prefix}/bin/
cp autojump ${prefix}/bin/ cp -v autojump ${prefix}/bin/
cp autojump.1 ${prefix}/share/man/man1/ cp -v autojump.1 ${prefix}/share/man/man1/
if ( ! ${local} ); then if [ ! ${local} ]; then
if [ -d "/etc/profile.d" ]; then if [ -d "/etc/profile.d" ]; then
cp -v autojump.bash /etc/profile.d/ cp -v autojump.bash /etc/profile.d/
cp -v autojump.sh /etc/profile.d/ cp -v autojump.sh /etc/profile.d/
@ -133,8 +133,8 @@ if ( ! ${local} ); then
fi fi
else else
mkdir -p ${prefix}/etc/profile.d/ mkdir -p ${prefix}/etc/profile.d/
cp autojump.bash ${prefix}/etc/profile.d/ cp -v autojump.bash ${prefix}/etc/profile.d/
cp autojump.sh ${prefix}/etc/profile.d/ cp -v autojump.sh ${prefix}/etc/profile.d/
echo echo
echo "Add the following lines to your ~/.bashrc:" echo "Add the following lines to your ~/.bashrc:"
@ -143,6 +143,6 @@ else
echo echo
echo "You need to source your ~/.bashrc (source ~/.bashrc) before you can start using autojump." echo "You need to source your ~/.bashrc (source ~/.bashrc) before you can start using autojump."
echo echo
echo "To remove autojump, delete the ${prefix} directory and relevant lines from ~/.zshrc." echo "To remove autojump, delete the ${prefix} directory and relevant lines from ~/.bashrc."
fi fi