#!/bin/sh # PROVIDE: cryptdisks # REQUIRE: # BEFORE: mountcritlocal localswap dumpon $_rc_subr_loaded . /etc/rc.subr name="cryptdisks" start_cmd="cryptdisks_start" stop_cmd="cryptdisks_stop" CRYPTTAB="/etc/crypttab" cryptdisks_start() { if [ ! -f $CRYPTTAB ]; then return 0; fi if [ -x /sbin/dmsetup ]; then /sbin/dmsetup version >/dev/null if [ $? -ne 0 ]; then warn "Device-mapper not present in kernel" return 1; fi fi if [ ! -x /sbin/cryptdisks ]; then warn "cryptdisks is not executable" return 1; fi echo "Configuring crypto disks." /sbin/cryptdisks -1 } cryptdisks_stop() { if [ ! -f $CRYPTTAB ]; then return 0; fi if [ -x /sbin/dmsetup ]; then /sbin/dmsetup version >/dev/null if [ $? -ne 0 ]; then warn "Device-mapper not present in kernel" return 1; fi fi if [ ! -x /sbin/cryptdisks ]; then warn "cryptdisks is not executable" return 1; fi echo "Unconfiguring crypto disks." /sbin/cryptdisks -0 } load_rc_config $name run_rc_command "$1"