3 # This file, originally written by Garrett A. Wollman, is in the public
15 start_precmd="find_gbde_devices start"
16 stop_precmd="find_gbde_devices stop"
17 start_cmd="gbde_start"
22 case "${gbde_devices-auto}" in
36 fstab=$(mktemp /tmp/mtab.XXXXXX)
42 # We can't use "mount -p | while ..." because when a shell loop
43 # is the target of a pipe it executes in a subshell, and so can't
44 # modify variables in the script.
46 while read device mountpt type options dump pass; do
58 if checkyesno gbde_autoattach_all; then
59 gbde_devices="${gbde_devices} ${device}"
63 gbde_devices="${gbde_devices} ${device}"
81 for device in $gbde_devices; do
83 parent=${parent#/dev/}
84 eval "lock=\${gbde_lock_${parent}-\"${gbde_lockdir}/${parent}.lock\"}"
85 if [ -e "/dev/${parent}" -a ! -e "/dev/${parent}.bde" ]; then
86 echo "Configuring Disk Encryption for ${parent}."
89 while [ ${count} -le ${gbde_attach_attempts} ]; do
90 if [ -e "${lock}" ]; then
91 gbde attach ${parent} -l ${lock}
95 if [ -e "/dev/${parent}.bde" ]; then
98 echo "Attach failed; attempt ${count} of ${gbde_attach_attempts}."
99 count=$((${count} + 1))
107 for device in $gbde_devices; do
108 parent=${device%.bde}
109 parent=${parent#/dev/}
110 if [ -e "/dev/${parent}.bde" ]; then
111 umount "/dev/${parent}.bde" 2>/dev/null
112 gbde detach "${parent}"