Logo Search packages:      
Sourcecode: cfs version File versions

init.d

#! /bin/sh
#
### BEGIN INIT INFO
# Provides:          cfs
# Required-Start:    $local_fs
# Required-Stop:     $local_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start cfs
# Description:       Cryptographic File System daemon
### END INIT INFO

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

Generated by  Doxygen 1.6.0   Back to index