Permalink
Browse files

Making the zsh script in line with sh

  • Loading branch information...
1 parent 3b68cd9 commit be7e2d8e1b7571da0ff70dc898e5423e4c4f3847 @tmcw tmcw committed with joelthelion Jun 21, 2010
Showing with 27 additions and 10 deletions.
  1. +27 −10 install.zsh
View
@@ -1,5 +1,4 @@
#! /bin/zsh
-
#Copyright Joel Schaerer 2008, 2009
#This file is part of autojump
@@ -16,21 +15,39 @@
#You should have received a copy of the GNU General Public License
#along with autojump. If not, see <http://www.gnu.org/licenses/>.
-# applet icon
-sudo mkdir -p /usr/share/autojump/
-sudo cp icon.png /usr/share/autojump/
+function show_help {
+ echo "sudo ./install.sh [--prefix /usr/local]"
+}
+
+prefix=/usr
-# scripts
-sudo cp jumpapplet /usr/bin/
-sudo cp autojump /usr/bin/
+#command line parsing
+while true; do
+ case "$1" in
+ -h|--help|-\?) show_help; exit 0;;
+ -p|--prefix) if [ $# -gt 1 ]; then
+ prefix=$2; shift 2
+ else
+ echo "--prefix or -p require an argument" 1>&2
+ exit 1
+ fi ;;
+ --) shift; break;;
+ -*) echo "invalid option: $1" 1>&2; show_help; exit 1;;
+ *) break;;
+ esac
+done
-# man pages
-sudo cp autojump.1 /usr/share/man/man1/
+echo "Installing to ${prefix} ..."
+
+sudo mkdir -p ${prefix}/share/autojump/
+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/
# autocompletion file in the first directory of the FPATH variable
sudo cp _j $(echo $FPATH | cut -d":" -f 1)
-
if [ -d "/etc/profile.d" ]; then
sudo cp autojump.zsh /etc/profile.d/
sudo cp autojump.sh /etc/profile.d/

0 comments on commit be7e2d8

Please sign in to comment.