Debian Codegraph @

debian/pvpgn.init.d

raw
1 #! /bin/sh
2 #
3 # Written by Miquel van Smoorenburg <[email protected]>
4 # Modified for Debian by Ian Murdock <[email protected]>
5 #
6
7 ### BEGIN INIT INFO
8 # Provides: pvpgn
9 # Required-Start: $local_fs $remote_fs $syslog $network $time
10 # Required-Stop: $local_fs $remote_fs $syslog $network
11 # Default-Start: 2 3 4 5
12 # Default-Stop: 0 1 6
13 # Short-Description: Gaming server that emulates Battle.net(R)
14 # Description: control bnetd daemon
15 ### END INIT INFO
16
17 set -e
18
19 . /lib/lsb/init-functions
20
21 PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
22 DAEMON=/usr/sbin/bnetd
23 NAME=bnetd
24 DESC="bnetd daemon"
25
26 # checks for the pvpgn support files
27 check_support()
28 {
29 FILES="
30 ad000001.smk
31 ad000002.mng
32 ad000002.smk
33 icons.bni
34 icons_STAR.bni
35 icons-WAR3.bni
36 IX86ExtraWork.mpq
37 IX86ver1.mpq
38 newbie.save
39 PMACver1.mpq
40 ver-IX86-1.mpq
41 XMACver1.mpq
42 "
43
44 START=1
45 for i in $FILES; do
46 if [ ! -f "/var/lib/pvpgn/files/$i" ]; then
47 START=0;
48 fi
49 done
50
51 if [ "$START" = "0" ]; then
52 echo
53 echo "You are missing the pvpgn support files and daemon will not start without them."
54 echo "Run 'sudo pvpgn-support-installer' or read /usr/share/doc/pvpgn/README.Debian"
55 exit 0
56 fi
57
58 }
59
60 test -x $DAEMON || exit 0
61
62 case "$1" in
63 start)
64 check_support
65 echo -n "Starting $DESC: "
66 start-stop-daemon --start --quiet --exec $DAEMON -- $DAEMON_OPTS
67 echo "$NAME."
68 ;;
69 stop)
70 echo -n "Stopping $DESC: "
71 start-stop-daemon --stop --quiet --oknodo --exec $DAEMON
72 echo "$NAME."
73 ;;
74 status)
75 status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
76 ;;
77 restart|force-reload)
78 check_support
79 echo -n "Restarting $DESC: "
80 start-stop-daemon --stop --quiet --exec $DAEMON
81 sleep 1
82 start-stop-daemon --start --quiet --exec $DAEMON -- $DAEMON_OPTS
83 echo "$NAME."
84 ;;
85 *)
86 N=/etc/init.d/$NAME
87 echo "Usage: $N {start|stop|restart|status|force-reload}" >&2
88 exit 1
89 ;;
90 esac
91
92 exit 0