2004-02-03 11:26:08 +00:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# $FreeBSD$
|
|
|
|
#
|
|
|
|
|
|
|
|
# PROVIDE: disks
|
2004-02-05 21:40:37 +00:00
|
|
|
# REQUIRE: initrandom
|
2004-03-08 12:25:05 +00:00
|
|
|
# KEYWORD: FreeBSD nojail
|
2004-02-03 11:26:08 +00:00
|
|
|
|
|
|
|
. /etc/rc.subr
|
|
|
|
|
|
|
|
name="gbde_swap"
|
|
|
|
start_cmd="gbde_swap_attach"
|
|
|
|
stop_cmd="gbde_swap_detach"
|
|
|
|
|
|
|
|
gbde_swap_attach()
|
|
|
|
{
|
|
|
|
cat /etc/fstab |
|
|
|
|
while read device mountpoint type options rest ; do
|
|
|
|
case "${device}:${type}:${options}" in
|
|
|
|
*.bde:swap:sw)
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
continue
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
passphrase=`dd if=/dev/random count=1 2>/dev/null | md5 -q`
|
|
|
|
device="${device%.bde}"
|
2004-02-04 15:53:49 +00:00
|
|
|
gbde init "${device}" -P "${passphrase}" || return 1
|
|
|
|
gbde attach "${device}" -p "${passphrase}" || return 1
|
2004-02-03 11:26:08 +00:00
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
gbde_swap_detach()
|
|
|
|
{
|
|
|
|
cat /etc/fstab |
|
|
|
|
while read device mountpoint type options rest ; do
|
|
|
|
case "${device}:${type}:${options}" in
|
|
|
|
*.bde:swap:sw)
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
continue
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
device="${device%.bde}"
|
|
|
|
gbde detach "${device}"
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
load_rc_config $name
|
|
|
|
run_rc_command "$1"
|