encswap revision 125498
1#!/bin/sh 2# 3# $FreeBSD: head/etc/rc.d/encswap 125498 2004-02-05 21:40:37Z des $ 4# 5 6# PROVIDE: disks 7# REQUIRE: initrandom 8# KEYWORD: FreeBSD 9 10. /etc/rc.subr 11 12name="gbde_swap" 13start_cmd="gbde_swap_attach" 14stop_cmd="gbde_swap_detach" 15 16gbde_swap_attach() 17{ 18 cat /etc/fstab | 19 while read device mountpoint type options rest ; do 20 case "${device}:${type}:${options}" in 21 *.bde:swap:sw) 22 ;; 23 *) 24 continue 25 ;; 26 esac 27 passphrase=`dd if=/dev/random count=1 2>/dev/null | md5 -q` 28 device="${device%.bde}" 29 gbde init "${device}" -P "${passphrase}" || return 1 30 gbde attach "${device}" -p "${passphrase}" || return 1 31 done 32} 33 34gbde_swap_detach() 35{ 36 cat /etc/fstab | 37 while read device mountpoint type options rest ; do 38 case "${device}:${type}:${options}" in 39 *.bde:swap:sw) 40 ;; 41 *) 42 continue 43 ;; 44 esac 45 device="${device%.bde}" 46 gbde detach "${device}" 47 done 48} 49 50load_rc_config $name 51run_rc_command "$1" 52