/[pkg-mixmaster]/trunk/debian/mixmaster.init
ViewVC logotype

Contents of /trunk/debian/mixmaster.init

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1010 - (show annotations) (download)
Wed Nov 4 21:44:20 2009 UTC (3 years, 6 months ago) by colint
File size: 2611 byte(s)
Misc minor debian dir changes
1 #!/bin/sh
2 #
3 # Start/Stop the Mixmaster daemon
4
5 ### BEGIN INIT INFO
6 # Provides: mixmaster
7 # Required-Start: $local_fs $remote_fs $named $network $time
8 # Required-Stop: $local_fs $remote_fs $named $network
9 # Should-Start: mail-transport-agent
10 # Should-Stop: mail-transport-agent
11 # Default-Start: 2 3 4 5
12 # Default-Stop: 0 1 6
13 # Short-Description: Anonymous remailer client and server
14 # Description: Mixmaster is the reference implementation
15 # of the type II remailer protocol
16 # which is also called Mixmaster.
17 ### END INIT INFO
18
19 set -e
20
21 DESC="Mixmaster Daemon"
22 NAME="mixmaster"
23 DAEMON="/usr/bin/mixmaster"
24 ARGS="--daemon --no-ask-passphrase"
25 USER=mixmaster
26 GROUP=mixmaster
27 REMAILCONFIGFILE=/etc/mixmaster/remailer.conf
28
29
30 # whitespace for some grep magic
31 WS="[ `printf \\\t`]"
32 WSE="[= `printf \\\t`]"
33
34 grep_from_mix() {
35 VALUE=`grep "^$WS*$1$WSE" $REMAILCONFIGFILE | tail -n 1 | sed -e "s,^$WS*[a-zA-Z0-9_-]*$WS*\(\|=$WS*\),,"`
36 }
37
38 convert_bool() {
39 if [ "$1" = "false" ] ; then
40 if [ "$VALUE" = "y" -o "$VALUE" = "Y" ] ; then VALUE="true"; else VALUE="false"; fi
41 else
42 if [ "$VALUE" = "n" -o "$VALUE" = "n" ] ; then VALUE="false"; else VALUE="true"; fi
43 fi;
44 }
45
46
47 [ -x $DAEMON ] || exit 0
48 [ -e $REMAILCONFIGFILE ] || exit 0
49
50 # ensure pid file directory exists
51 if [ ! -e /var/run/mixmaster ]; then
52 mkdir -m 02775 /var/run/mixmaster
53 chown root:mixmaster /var/run/mixmaster
54 fi
55
56 . /lib/lsb/init-functions
57
58 case $1 in
59 start)
60 grep_from_mix REMAIL; convert_bool false;
61 if [ ! "$VALUE" = "true" ]; then
62 echo "Not starting $DESC: remailer mode not enabled in $REMAILCONFIGFILE."
63 log_success_msg "Not starting $DESC: remailer mode not enabled in $REMAILCONFIGFILE."
64 exit 0;
65 fi
66
67 grep_from_mix PASSPHRASE
68 if [ "$VALUE" = "" ]; then
69 echo "Not starting $DESC: Passphrase must be set in $REMAILCONFIGFILE." >&2
70 log_failure_msg "Not starting $DESC: Passphrase must be set in $REMAILCONFIGFILE."
71 exit 1;
72 fi
73 log_begin_msg "Starting $DESC..."
74 start-stop-daemon --start --quiet --user $USER --chuid $USER:$GROUP --exec $DAEMON -- $ARGS || { log_end_msg 1; exit 1; }
75 log_end_msg 0
76 ;;
77
78 stop)
79 log_begin_msg "Stopping $DESC..."
80 start-stop-daemon --stop --quiet --oknodo --pidfile /var/run/mixmaster/mixmaster.pid --user $USER --exec $DAEMON || { log_end_msg 1; exit 1; }
81 log_end_msg 0
82 ;;
83
84 reload|force-reload|restart)
85 $0 stop
86 sleep 2
87 $0 start
88 ;;
89
90 *)
91 echo "Usage: $0 (start|stop|reload|force-reload|restart)" >&2
92 exit 1
93 ;;
94 esac
95
96 exit 0
97
98 # vim:set ts=2:
99 # vim:set shiftwidth=2:

  ViewVC Help
Powered by ViewVC 1.1.5