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

fix sudo installation, testing proper sudo installation, and changed data directory to ~/.autojump/

This commit is contained in:
William Ting 2011-05-13 19:27:16 -10:00
parent c993e44b1a
commit 69fb7bb792
2 changed files with 23 additions and 8 deletions

View File

@ -28,6 +28,9 @@ complete -F _autojump j
export AUTOJUMP_HOME=${HOME}
export AUTOJUMP_DATA_DIR=${HOME}/.autojump
if [ ! -d ${AUTOJUMP_DATA_DIR} ]; then
mkdir -p ${AUTOJUMP_DATA_DIR}
fi
AUTOJUMP='{ [[ "$AUTOJUMP_HOME" == "$HOME" ]] && (autojump -a "$(pwd -P)"&)>/dev/null 2>>${AUTOJUMP_DATA_DIR}/autojump_errors;} 2>/dev/null'
if [[ ! $PROMPT_COMMAND =~ autojump ]]; then

View File

@ -73,20 +73,25 @@ fi
echo "Installing to ${prefix} ..."
# INSTALL AUTOJUMP
sudo mkdir -p ${prefix}/share/autojump/
sudo mkdir -p ${prefix}/bin/
sudo mkdir -p ${prefix}/share/man/man1/
sudo cp icon.png ${prefix}/share/autojump/
sudo cp jumpapplet ${prefix}/bin/
sudo cp autojump ${prefix}/bin/
sudo cp autojump.1 ${prefix}/share/man/man1/
if [ `uname` != "Darwin" ]; then
if [ ${all_users} == 1 ]; then
sudo mkdir -p ${prefix}/share/autojump/
sudo mkdir -p ${prefix}/bin/
sudo mkdir -p ${prefix}/share/man/man1/
sudo cp icon.png ${prefix}/share/autojump/
sudo cp jumpapplet ${prefix}/bin/
sudo cp autojump ${prefix}/bin/
sudo cp autojump.1 ${prefix}/share/man/man1/
sudo mkdir -p /etc/profile.d/
sudo cp autojump.bash /etc/profile.d/
sudo cp autojump.sh /etc/profile.d/
# Fail sudo install
if [ ! -f ${prefix}/bin/autojump ] || [ ! -f ${prefix}/share/man/man1/autojump.1 ] || [ ! -f /etc/profile.d/autojump.bash ] || [ ! -f /etc/profile.d/autojump.sh ]; then
echo "Autojump was not installed, please try again using single user installation or with the correct sudo password."
exit 1
fi
# Make sure that the code we just copied has been sourced.
# check if .bashrc has sourced /etc/profile or /etc/profile.d/autojump.bash
if [ `grep -c "^[[:space:]]*\(source\|\.\) /etc/profile\(\.d/autojump\.bash\)[[:space:]]*$" ~/.bashrc` -eq 0 ]; then
@ -97,6 +102,13 @@ if [ `uname` != "Darwin" ]; then
echo "source /etc/profile.d/autojump.bash" >> ~/.bashrc
fi
else
mkdir -p ${prefix}/share/autojump/
mkdir -p ${prefix}/bin/
mkdir -p ${prefix}/share/man/man1/
cp icon.png ${prefix}/share/autojump/
cp jumpapplet ${prefix}/bin/
cp autojump ${prefix}/bin/
cp autojump.1 ${prefix}/share/man/man1/
mkdir -p ${prefix}/etc/profile.d/
cp autojump.bash ${prefix}/etc/profile.d/
cp autojump.sh ${prefix}/etc/profile.d/