Mercurial > feed-push
comparison setup @ 3:0d4378996672 draft
improve setup script
Signed-off-by: Changaco <changaco ατ changaco δοτ net>
author | Changaco <changaco ατ changaco δοτ net> |
---|---|
date | Mon, 16 Apr 2012 00:24:59 +0200 |
parents | a68d7feeba88 |
children | 70bf588021fa |
comparison
equal
deleted
inserted
replaced
2:292896092ee6 | 3:0d4378996672 |
---|---|
1 #!/bin/sh | 1 #!/bin/sh |
2 | 2 |
3 usage () { | 3 usage () { |
4 echo "usage: [DESTDIR=/] [PREFIX=/usr] $(basename "$0") install|uninstall" && exit 1 | 4 echo "usage: [DESTDIR=/] [PREFIX=/usr] $(basename "$0") install|uninstall|update" && exit 1 |
5 } | 5 } |
6 | 6 |
7 remove () { | 7 remove () { |
8 [ -e "$1" ] && rm -vrf --preserve-root "$1" | 8 [ -e "$1" ] && rm -vrf --preserve-root "$1" |
9 } | 9 } |
20 _PREFIX=${DESTDIR%%/}/${PREFIX##/} | 20 _PREFIX=${DESTDIR%%/}/${PREFIX##/} |
21 | 21 |
22 [ ! -w "$DESTDIR" ] && echo "You don't have write access on $DESTDIR" && exit 1 | 22 [ ! -w "$DESTDIR" ] && echo "You don't have write access on $DESTDIR" && exit 1 |
23 | 23 |
24 progname=feed-push | 24 progname=feed-push |
25 confdir="${DESTDIR}etc/$progname" | |
25 | 26 |
26 if [ "$action" == install ]; then | 27 if [ "$action" == install ]; then |
27 install -v -m 755 -D $progname "$_PREFIX/bin/$progname" | 28 install -v -m 755 -D $progname "$_PREFIX/bin/$progname" |
28 install_dir examples "$_PREFIX/share/$progname" | 29 install_dir examples "$_PREFIX/share/$progname" |
29 [ -d /etc/rc.d ] && install_dir rc.d "${DESTDIR}etc" | 30 [ -d /etc/rc.d ] && install_dir rc.d "${DESTDIR}etc" && mkdir -v "$confdir" |
30 elif [ "$action" == uninstall ]; then | 31 elif [ "$action" == uninstall ]; then |
31 remove "$PREFIX/bin/$progname" | 32 remove "$_PREFIX/bin/$progname" |
32 remove "$PREFIX/share/$progname/examples" | 33 remove "$_PREFIX/share/$progname/examples" |
33 remove "/etc/rc.d/$progname" | 34 remove "${DESTDIR}etc/rc.d/$progname" |
35 if [ $(ls -a "$confdir") -eq 2 ]; then rmdir "$confdir" | |
36 else echo "not removing config dir $confdir (not empty)" | |
37 fi | |
38 elif [ "$action" == update ]; then | |
39 $0 uninstall &>/dev/null | |
40 $0 install | |
34 else | 41 else |
35 usage | 42 usage |
36 fi | 43 fi |
37 | 44 |
38 exit 0 | 45 exit 0 |