comparison setup @ 1:a68d7feeba88 draft

initial commit Signed-off-by: Changaco <changaco ατ changaco δοτ net>
author Changaco <changaco ατ changaco δοτ net>
date Sun, 15 Apr 2012 18:05:20 +0200
parents
children 0d4378996672
comparison
equal deleted inserted replaced
0:31c0a15dd43d 1:a68d7feeba88
1 #!/bin/sh
2
3 usage () {
4 echo "usage: [DESTDIR=/] [PREFIX=/usr] $(basename "$0") install|uninstall" && exit 1
5 }
6
7 remove () {
8 [ -e "$1" ] && rm -vrf --preserve-root "$1"
9 }
10
11 install_dir () {
12 mkdir -p "$2"
13 cp -rv "$1" "$2"
14 }
15
16 [ $# -eq 1 ] && action=$1 || usage
17
18 [ -z "$DESTDIR" ] && DESTDIR=/
19 [ -z "$PREFIX" ] && PREFIX=/usr
20 _PREFIX=${DESTDIR%%/}/${PREFIX##/}
21
22 [ ! -w "$DESTDIR" ] && echo "You don't have write access on $DESTDIR" && exit 1
23
24 progname=feed-push
25
26 if [ "$action" == install ]; then
27 install -v -m 755 -D $progname "$_PREFIX/bin/$progname"
28 install_dir examples "$_PREFIX/share/$progname"
29 [ -d /etc/rc.d ] && install_dir rc.d "${DESTDIR}etc"
30 elif [ "$action" == uninstall ]; then
31 remove "$PREFIX/bin/$progname"
32 remove "$PREFIX/share/$progname/examples"
33 remove "/etc/rc.d/$progname"
34 else
35 usage
36 fi
37
38 exit 0