summarylogtreecommitdiffstats
path: root/cryptsetup
blob: bb67e3dd05f2b6a67134d2bceb4642e548cbffb2 (plain)
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
#!/bin/bash

# sourcing our current rc.conf requires this to be a bash script
. /usr/lib/rc/functions

case "$1" in
    start)
        if [ -e /etc/crypttab ]; then
             stat_busy "Activating encrypted devices"
	     awk -f /etc/runit/crypt.awk /etc/crypttab || stat_die cryptsetup
        fi
        add_daemon cryptsetup
        stat_done cryptsetup
        ;;
    stop)
        stat_busy "Stopping encrypted devices"
        rc=$?
        read_crypttab do_lock
        (( rc || $? )) && stat_die
        rm_daemon cryptsetup
        stat_done
        ;;

    *)
        echo "usage: $0 {start}"
        exit 1
        ;;
esac