Mercurial > feed-push
annotate setup @ 27:75563016f269 draft
add systemd .service unit
Signed-off-by: Changaco <changaco ατ changaco δοτ net>
author | Changaco <changaco ατ changaco δοτ net> |
---|---|
date | Sat, 04 Aug 2012 18:33:17 +0200 |
parents | 70bf588021fa |
children |
rev | line source |
---|---|
1 | 1 #!/bin/sh |
2 | |
3 usage () { | |
3 | 4 echo "usage: [DESTDIR=/] [PREFIX=/usr] $(basename "$0") install|uninstall|update" && exit 1 |
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 | |
3 | 25 confdir="${DESTDIR}etc/$progname" |
1 | 26 |
27 if [ "$action" == install ]; then | |
28 install -v -m 755 -D $progname "$_PREFIX/bin/$progname" | |
29 install_dir examples "$_PREFIX/share/$progname" | |
27
75563016f269
add systemd .service unit
Changaco <changaco ατ changaco δοτ net>
parents:
4
diff
changeset
|
30 install -vd "$confdir" |
75563016f269
add systemd .service unit
Changaco <changaco ατ changaco δοτ net>
parents:
4
diff
changeset
|
31 install -v -m 755 -D init/$progname.bash "${DESTDIR}etc/rc.d/$progname" |
75563016f269
add systemd .service unit
Changaco <changaco ατ changaco δοτ net>
parents:
4
diff
changeset
|
32 install -v -m 644 -D init/$progname.service "${DESTDIR}usr/lib/systemd/system/$progname.service" |
1 | 33 elif [ "$action" == uninstall ]; then |
3 | 34 remove "$_PREFIX/bin/$progname" |
35 remove "$_PREFIX/share/$progname/examples" | |
36 remove "${DESTDIR}etc/rc.d/$progname" | |
4 | 37 if [ $(ls -a "$confdir" | wc -l) -eq 2 ]; then rmdir "$confdir" |
3 | 38 else echo "not removing config dir $confdir (not empty)" |
39 fi | |
40 elif [ "$action" == update ]; then | |
41 $0 uninstall &>/dev/null | |
42 $0 install | |
1 | 43 else |
44 usage | |
45 fi | |
46 | |
47 exit 0 |