/mandos/trunk

To get this branch, use:
bzr branch http://bzr.recompile.se/loggerhead/mandos/trunk

« back to all changes in this revision

Viewing changes to init.d-mandos

  • Committer: Teddy Hogeborn
  • Date: 2008-11-09 06:40:29 UTC
  • mto: (24.1.113 mandos)
  • mto: This revision was merged to the branch mainline in revision 238.
  • Revision ID: teddy@fukt.bsnet.se-20081109064029-df71jpoce308cq3v
First steps of a D-Bus interface to the server.

* mandos: Also import "dbus.service".
  (Client): Inherit from "dbus.service.Object", which is a new-style
            class, so inheriting from "object" is no longer necessary.
  (Client.interface): New temporary variable which only exists during
                     class definition.

  (Client.getName, Client.getFingerprint): New D-Bus getter methods.
  (Client.setSecret): New D-Bus setter method.
  (Client._set_timeout): Emit D-Bus signal "TimeoutChanged".
  (Client.getTimeout): New D-Bus getter method.
  (Client.TimeoutChanged): New D-Bus signal.
  (Client._set_interval): Emit D-Bus signal "IntervalChanged".
  (Client.getInterval): New D-Bus getter method.
  (Client.intervalChanged): New D-Bus signal.
  (Client.__init__): Also call "dbus.service.Object.__init__".
  (Client.started): New boolean attribute.
  (Client.start, Client.stop): Update "self.started", and emit D-Bus
                               signal "StateChanged".
  (Client.StateChanged): New D-Bus signal.
  (Client.stop): Use "self.started" instead of misusing "self.secret".
                 Also simplify code by using "getattr" instead of
                 "hasattr".
  (Client.checker_callback): Emit D-Bus signal "CheckerCompleted".
  (Client.CheckerCompleted): New D-Bus signal.
  (Client.bumpTimeout): D-Bus method name for "bump_timeout".
  (Client.start_checker): Emit D-Bus signal "CheckerStarted".
  (Client.CheckerStarted): New D-Bus signal.
  (Client.checkerIsRunning): New D-Bus method.
  (Client.StopChecker): D-Bus method name for "stop_checker".
  (Client.still_valid): First check "self.started".
  (Client.stillValid): D-Bus method name for "still_valid".

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#! /bin/sh
2
2
### BEGIN INIT INFO
3
3
# Provides:          mandos
4
 
# Required-Start:    $remote_fs $syslog avahi-daemon
5
 
# Required-Stop:     $remote_fs $syslog avahi-daemon
 
4
# Required-Start:    $remote_fs avahi-daemon
 
5
# Required-Stop:     $remote_fs
6
6
# Default-Start:     2 3 4 5
7
7
# Default-Stop:      0 1 6
8
8
# Short-Description: Mandos server
9
 
# Description:       Server of encrypted passwords to Mandos clients
 
9
# Description:       Gives encrypted passwords to Mandos clients
10
10
### END INIT INFO
11
11
 
12
 
# Author: Teddy Hogeborn <teddy@recompile.se>
13
 
# Author: Björn Påhlsson <belorn@recompile.se>
 
12
# Author: Teddy Hogeborn <teddy@fukt.bsnet.se>
 
13
# Author: Björn Påhlsson <belorn@fukt.bsnet.se>
14
14
#
15
15
# Please remove the "Author" lines above and replace them
16
16
# with your own name if you copy and modify this script.
23
23
NAME=mandos
24
24
DAEMON=/usr/sbin/$NAME
25
25
DAEMON_ARGS=""
26
 
if [ -d /run/. ]; then
27
 
    PIDFILE=/run/$NAME.pid
28
 
else
29
 
    PIDFILE=/var/run/$NAME.pid
30
 
fi
 
26
PIDFILE=/var/run/$NAME.pid
31
27
SCRIPTNAME=/etc/init.d/$NAME
32
28
 
33
29
# Exit if the package is not installed
44
40
. /lib/init/vars.sh
45
41
 
46
42
# Define LSB log_* functions.
47
 
# Depend on lsb-base (>= 3.2-14) to ensure that this file is present
48
 
# and status_of_proc is working.
 
43
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
49
44
. /lib/lsb/init-functions
50
45
 
51
46
#
77
72
        #   1 if daemon was already stopped
78
73
        #   2 if daemon could not be stopped
79
74
        #   other if a failure occurred
80
 
        start-stop-daemon --stop --quiet --pidfile $PIDFILE --name $NAME
81
 
        mandos-ctl >/dev/null 2>&1
82
 
        start-stop-daemon --stop --quiet --retry=30/KILL/5 --pidfile $PIDFILE --name $NAME
 
75
        start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
83
76
        RETVAL="$?"
84
77
        [ "$RETVAL" = 2 ] && return 2
85
78
        # Wait for children to finish too if this is a daemon that forks
125
118
                2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
126
119
        esac
127
120
        ;;
128
 
  status)
129
 
        status_of_proc "$DAEMON" "$NAME" -p "$PIDFILE" && exit 0 || exit $?
130
 
        ;;
131
121
  #reload|force-reload)
132
122
        #
133
123
        # If do_reload() is not implemented then leave this commented out
154
144
                esac
155
145
                ;;
156
146
          *)
157
 
                # Failed to stop
 
147
                # Failed to stop
158
148
                log_end_msg 1
159
149
                ;;
160
150
        esac
161
151
        ;;
162
152
  *)
163
153
        #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
164
 
        echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
 
154
        echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
165
155
        exit 3
166
156
        ;;
167
157
esac