File: init.d

package info (click to toggle)
cfs 1.4.1-17
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 600 kB
  • ctags: 648
  • sloc: ansic: 7,684; sh: 362; makefile: 185
file content (72 lines) | stat: -rw-r--r-- 1,634 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#! /bin/sh
set -e

PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin
DAEMON=/usr/sbin/cfsd
NAME=cfsd
DESC='Cryptographic File System daemon'

CONFIG_FILE=/etc/cfs.conf

test ! -h /var/service/cfs || exit 0
test -f "$DAEMON" || exit 0

# source config file
test ! -r "$CONFIG_FILE" || . "$CONFIG_FILE"

test -n "$CRYPT_ROOT" || exit 0
test -n "$NULL_EXPORT" || exit 0
test -n "$CFS_MOUNT" || exit 0
test -n "$CFS_UMOUNT" || exit 0

missing_export () {
  cat <<EOT >&2
failed.
When using cfs with the nfs-user-server package, add the following line
to /etc/exports and reload the nfs-user-server, then start cfsd again:

$NULL_EXPORT localhost(rw)

Not starting cfs.

EOT
}

case "$1" in
  start)
    echo -n "Starting $DESC: "
    if ! test -x /usr/sbin/exportfs; then
      # nfs-user-server
      if ! grep "^$NULL_EXPORT[[:space:]]*localhost(rw" \
        /etc/exports >/dev/null; then
  	missing_export
	exit 0
      fi
    fi
    # start daemon
    env NODAEMON=1 CFS_MOUNT="$CFS_MOUNT" CFS_UMOUNT="$CFS_UMOUNT"\
      start-stop-daemon --start --pidfile /var/run/cfs.pid \
        --make-pidfile --background --exec $DAEMON
    echo "$NAME."
    ;;
  stop)
    echo -n "Stopping $DESC: "
    start-stop-daemon --oknodo --stop --pidfile /var/run/cfs.pid \
      && rm -f /var/run/cfs.pid
    umount $CRYPT_ROOT >/dev/null 2>&1 || :
    echo "$NAME."
    ;;
  restart|force-reload)
    echo "Restarting $DESC: "
    $0 stop
    $0 start
    ;;
  *)
    N=/etc/init.d/$NAME
    # echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
    echo "Usage: $N {start|stop|restart|force-reload}" >&2
    exit 1
    ;;
esac

exit 0