invirt-svn-server is also Architecture: all.
[invirt/packages/invirt-svn-server.git] / debian / invirt-svn-server.init
1 #!/usr/bin/pagsh -e
2 ### BEGIN INIT INFO
3 # Provides:          invirt-svn-server
4 # Required-Start:    $local_fs $remote_fs $network $syslog openafs-client
5 # Required-Stop:     $local_fs $remote_fs $network $syslog openafs-client
6 # Default-Start:     2 3 4 5
7 # Default-Stop:      0 1 6
8 # Short-Description: Start/stop subversion server
9 ### END INIT INFO
10 #
11 # Apache kstart wrapper by anders.
12 #
13
14 SCRIPT=/etc/init.d/apache2.invirt-orig
15 KSTART_PIDFILE=/var/run/k5start-invirt-svn.pid
16 KSTART_KEYTAB=/etc/invirt/keytab
17
18 export AFSCELL=sipb.mit.edu
19
20 kstart_start () {
21     TMP_PIDFILE=$(mktemp /tmp/k5start-invirt-svn-server.pid-XXXXXX)
22     chown invirt-svn "$TMP_PIDFILE"
23     export KRB5CCNAME=$(mktemp /tmp/krb5cc_33.kstart-XXXXXX)
24     chown invirt-svn $KRB5CCNAME
25     export KRB5_KTNAME=/etc/invirt/svn.keytab
26     /sbin/start-stop-daemon --start --pidfile "$TMP_PIDFILE" -c invirt-svn \
27         --exec /usr/bin/k5start -- -b -p "$TMP_PIDFILE" \
28         -U -f "$KSTART_KEYTAB" -K10 -S afs -I "$AFSCELL" -t -b \
29         sudo -u invirt-svn svnserve -d --foreground -r "$(invirt-getconf svn.repopath)"
30     cat "$TMP_PIDFILE" >|"$KSTART_PIDFILE"
31     rm -f "$TMP_PIDFILE"
32 }
33 kstart_stop () {
34     if [ -e $KSTART_PIDFILE ]; then
35         /sbin/start-stop-daemon --stop --pidfile $KSTART_PIDFILE
36         rm -f $KSTART_PIDFILE
37     else
38         echo -n " ... no kstart pidfile"
39     fi
40 }
41
42 case "$1" in
43   start)
44     echo -n "Starting kstart for Subversion: k5start"
45     kstart_start
46     echo "."
47     ;;
48   stop)
49     echo -n "Stopping kstart for Subversion: k5start"
50     kstart_stop
51     echo "."
52     ;;
53   restart|force-reload)
54     "$0" stop
55     sleep 1
56     "$0" start
57     ;;
58   *)
59     exec "$SCRIPT" "$@"
60     ;;
61 esac