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

fixed and tested single user / all user installation on OS X.

This commit is contained in:
William Ting 2011-05-13 20:24:11 -10:00
parent 6ac2bd897c
commit 71f3d876c9

View File

@ -73,8 +73,7 @@ fi
echo "Installing to ${prefix} ..."
# INSTALL AUTOJUMP
if [ `uname` != "Darwin" ]; then
if [ ${all_users} == 1 ]; then
if [ ${all_users} == 1 ]; then
sudo mkdir -p ${prefix}/share/autojump/
sudo mkdir -p ${prefix}/bin/
sudo mkdir -p ${prefix}/share/man/man1/
@ -101,7 +100,7 @@ if [ `uname` != "Darwin" ]; then
echo "# Added by autojump install.sh" >> ~/.bashrc
echo "source /etc/profile.d/autojump.bash" >> ~/.bashrc
fi
else
else
mkdir -p ${prefix}/share/autojump/
mkdir -p ${prefix}/bin/
mkdir -p ${prefix}/share/man/man1/
@ -129,39 +128,18 @@ if [ `uname` != "Darwin" ]; then
echo 'export PATH=${PATH}:~/.autojump/bin' >> ~/.bashrc
fi
fi
fi
echo "Done!"
echo
echo "You need to source your ~/.bashrc (source ~/.bashrc) before you can start using autojump."
echo "Done!"
echo
echo "You need to source your ~/.bashrc (source ~/.bashrc) before you can start using autojump."
else
echo "Your distribution does not have a /etc/profile.d directory, the default that we install one of the scripts to. Would you like us to copy it into your ~/.bashrc file to make it work? (If you have done this once before, delete the old version before doing it again.) [y/n]"
read ans
if [ ${#ans} -gt 0 ]; then
if [ $ans = "y" -o $ans = "Y" -o $ans = "yes" -o $ans = "Yes" ]; then
# Answered yes. Go ahead and add the autojump code
echo "" >> ~/.bashrc
echo "#autojump" >> ~/.bashrc
cat autojump.bash | grep -v "^#" >> ~/.bashrc
# Since OSX uses .bash_profile, we need to make sure that .bashrc is properly sourced.
# Makes the assumption that if they have a line: source ~/.bashrc or . ~/.bashrc, that
# .bashrc has been properly sourced and you don't need to add it.
OS=`uname`
if [ $OS == 'Darwin' -a `grep -c "^[[:space:]]*\(source\|\.\) /etc/profile\(\.d/autojump\.bash\)[[:space:]]*$" ~/.bash_profile` -eq 0 ]; then
echo "You are using OSX and your .bash_profile doesn't seem to be sourcing .bashrc"
# Since OSX uses .bash_profile, we need to make sure that .bashrc is properly sourced.
# Makes the assumption that if they have a line: source ~/.bashrc or . ~/.bashrc, that
# .bashrc has been properly sourced and you don't need to add it.
if [ `uname` == "Darwin" ] && [ `grep -c "^[[:space:]]*\(source\|\.\).*\.bashrc[[:space:]]*$" ~/.bash_profile` -eq 0 ]; then
echo "Your .bash_profile doesn't seem to be sourcing .bashrc"
echo "Adding source ~/.bashrc to your bashrc"
echo -e "\n# Get the aliases and functions" >> ~/.bash_profile
echo -e "if [ -f ~/.bashrc ]; then\n . ~/.bashrc\nfi" >> ~/.bash_profile
fi
echo "You need to source your ~/.bashrc (source ~/.bashrc) before you can start using autojump."
else
echo "Then you need to put autojump.sh, or the code from it, somewhere where it will get read. Good luck!"
fi
else
echo "Then you need to put autojump.sh, or the code from it, somewhere where it will get read. Good luck!"
fi
fi