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 parent_=`ltr ${parent} '/' '_'`
85 eval "lock=\${gbde_lock_${parent_}-\"${gbde_lockdir}/${parent_}.lock\"}"
86 if [ -e "/dev/${parent}" -a ! -e "/dev/${parent}.bde" ]; then
87 echo "Configuring Disk Encryption for ${parent}."
90 while [ ${count} -le ${gbde_attach_attempts} ]; do
91 if [ -e "${lock}" ]; then
92 gbde attach ${parent} -l ${lock}
96 if [ -e "/dev/${parent}.bde" ]; then
99 echo "Attach failed; attempt ${count} of ${gbde_attach_attempts}."
100 count=$((${count} + 1))
108 for device in $gbde_devices; do
109 parent=${device%.bde}
110 parent=${parent#/dev/}
111 if [ -e "/dev/${parent}.bde" ]; then
112 umount "/dev/${parent}.bde" 2>/dev/null
113 gbde detach "${parent}"