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

Merge branch 'master' of github.com:wting/autojump

This commit is contained in:
William Ting 2011-05-13 22:26:49 -05:00
commit 30840c1220
3 changed files with 39 additions and 19 deletions

View File

@ -104,9 +104,9 @@ before the first step.
Manual installation of autojump is very simple: copy Manual installation of autojump is very simple: copy
- autojump to /usr/bin, - autojump to /usr/local/bin,
- autojump.sh to /etc/profile.d, - autojump.sh to /etc/profile.d,
- autojump.1 to /usr/share/man/man1. - autojump.1 to /usr/local/share/man/man1.
Make sure to source ``/etc/profile`` in your ``.bashrc`` or ``.zshrc`` :: Make sure to source ``/etc/profile`` in your ``.bashrc`` or ``.zshrc`` ::
@ -136,15 +136,15 @@ To completely remove autojump you should remove these files:
``/etc/profile.d/autojump.zsh`` ``/etc/profile.d/autojump.zsh``
``/usr/bin/autojump`` ``/usr/local/bin/autojump``
``/usr/bin/jumpapplet`` ``/usr/local/bin/jumpapplet``
``/usr/share/autojump/icon.png`` ``/usr/local/share/autojump/icon.png``
``/usr/share/autojump/`` ``/usr/local/share/autojump/``
``/usr/share/man/man1/autojump.1`` ``/usr/local/share/man/man1/autojump.1``
Remove any mention of autojump in your ``.bashrc`` or ``.zshrc``, then in currently running shells do:``source /etc/profile``. Remove any mention of autojump in your ``.bashrc`` or ``.zshrc``, then in currently running shells do:``source /etc/profile``.

View File

@ -20,7 +20,7 @@ function show_help {
} }
# Default install directory. # Default install directory.
prefix=/usr prefix=/usr/local
# Command line parsing # Command line parsing
while true; do while true; do
@ -38,6 +38,26 @@ while true; do
esac esac
done done
uninstall=0;
if [ -f "/usr/bin/autojump" ]; then
while true; do
read -p "Old installation detected, remove? [Yn] " yn
case $yn in
[Yy]* ) uninstall=1; break;;
[Nn]* ) "Already installed, exiting." exit 1;;
* ) uninstall=1; break;;
esac
done
fi
if [ ${uninstall} == 1 ]; then
echo "Deleting old installation files ..."
sudo rm -r /usr/share/autojump/
sudo rm /usr/bin/autojump
sudo rm /usr/bin/jumpapplet
sudo rm /usr/share/man/man1/autojump.1
fi
echo "Installing to ${prefix} ..." echo "Installing to ${prefix} ..."
# INSTALL AUTOJUMP # INSTALL AUTOJUMP
@ -55,7 +75,7 @@ if [ -d "/etc/profile.d" ]; then
# Make sure that the code we just copied has been sourced. # Make sure that the code we just copied has been sourced.
# check if .bashrc has sourced /etc/profile or /etc/profile.d/autojump.bash # 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 if [ `grep -c "^[[:space:]]*\(source\|\.\) /etc/profile\(\.d/autojump\.bash\)[[:space:]]*$" ~/.bashrc` -eq 0 ]; then
echo "Your .bashrc doesn't seem to source /etc/profile or /etc/profile.d/autojump.bash" echo "Your .bashrc doesn't seem to source /etc/profile or /etc/profile.d/autojump.bash"
echo "Adding the /etc/profile.d/autojump.bash to your .bashrc" echo "Adding the /etc/profile.d/autojump.bash to your .bashrc"
echo "" >> ~/.bashrc echo "" >> ~/.bashrc
@ -69,27 +89,27 @@ 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]" 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 read ans
if [ ${#ans} -gt 0 ]; then if [ ${#ans} -gt 0 ]; then
if [ $ans = "y" -o $ans = "Y" -o $ans = "yes" -o $ans = "Yes" ]; then if [ $ans = "y" -o $ans = "Y" -o $ans = "yes" -o $ans = "Yes" ]; then
# Answered yes. Go ahead and add the autojump code # Answered yes. Go ahead and add the autojump code
echo "" >> ~/.bashrc echo "" >> ~/.bashrc
echo "#autojump" >> ~/.bashrc echo "#autojump" >> ~/.bashrc
cat autojump.bash | grep -v "^#" >> ~/.bashrc cat autojump.bash | grep -v "^#" >> ~/.bashrc
# Since OSX uses .bash_profile, we need to make sure that .bashrc is properly sourced. # 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 # 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. # .bashrc has been properly sourced and you don't need to add it.
OS=`uname` OS=`uname`
if [ $OS == 'Darwin' -a `grep -c "^[[:space:]]*source\|\. ~/\.bashrc[[:space:]]*$" ~/.bash_profile` -eq 0 ]; then 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" echo "You are using OSX and your .bash_profile doesn't seem to be sourcing .bashrc"
echo "Adding source ~/.bashrc to your bashrc" echo "Adding source ~/.bashrc to your bashrc"
echo -e "\n# Get the aliases and functions" >> ~/.bash_profile echo -e "\n# Get the aliases and functions" >> ~/.bash_profile
echo -e "if [ -f ~/.bashrc ]; then\n . ~/.bashrc\nfi" >> ~/.bash_profile echo -e "if [ -f ~/.bashrc ]; then\n . ~/.bashrc\nfi" >> ~/.bash_profile
fi fi
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."
else else
echo "Then you need to put autojump.sh, or the code from it, somewhere where it will get read. Good luck!" echo "Then you need to put autojump.sh, or the code from it, somewhere where it will get read. Good luck!"
fi fi
else else
echo "Then you need to put autojump.sh, or the code from it, somewhere where it will get read. Good luck!" echo "Then you need to put autojump.sh, or the code from it, somewhere where it will get read. Good luck!"
fi fi

View File

@ -168,7 +168,7 @@ def settings(sender):
window.set_border_width(3) window.set_border_width(3)
window.set_resizable(False) window.set_resizable(False)
if os.path.isfile("icon.png"): window.set_icon_from_file("icon.png") if os.path.isfile("icon.png"): window.set_icon_from_file("icon.png")
elif os.path.isfile("/usr/share/autojump/icon.png"): window.set_icon_from_file("/usr/share/autojump/icon.png") elif os.path.isfile("/usr/local/share/autojump/icon.png"): window.set_icon_from_file("/usr/local/share/autojump/icon.png")
vbox=gtk.Table(5,2) vbox=gtk.Table(5,2)
vbox.set_row_spacings(3) vbox.set_row_spacings(3)
@ -234,7 +234,7 @@ def save_settings(sender,response,entries,window):
def init(): def init():
load_settings_file() load_settings_file()
if os.path.isfile("icon.png"): icon=gtk.status_icon_new_from_file("icon.png") if os.path.isfile("icon.png"): icon=gtk.status_icon_new_from_file("icon.png")
elif os.path.isfile("/usr/share/autojump/icon.png"): icon=gtk.status_icon_new_from_file("/usr/share/autojump/icon.png") elif os.path.isfile("/usr/local/share/autojump/icon.png"): icon=gtk.status_icon_new_from_file("/usr/local/share/autojump/icon.png")
else: icon=gtk.status_icon_new_from_icon_name("help") else: icon=gtk.status_icon_new_from_icon_name("help")
icon.set_visible(True) icon.set_visible(True)
icon.connect("popup-menu",popup) icon.connect("popup-menu",popup)