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"
20 # Change every ${_src} in ${_str} to ${_dst}.
29 for _com in ${_str}; do
30 if [ -z "${_out}" ]; then
33 _out="${_out}${_dst}${_com}"
41 case "${gbde_devices-auto}" in
55 fstab=$(mktemp /tmp/mtab.XXXXXX)
61 # We can't use "mount -p | while ..." because when a shell loop
62 # is the target of a pipe it executes in a subshell, and so can't
63 # modify variables in the script.
65 while read device mountpt type options dump pass; do
77 if checkyesno gbde_autoattach_all; then
78 gbde_devices="${gbde_devices} ${device}"
82 gbde_devices="${gbde_devices} ${device}"
100 for device in $gbde_devices; do
101 parent=${device%.bde}
102 parent=${parent#/dev/}
103 parent_=`local_tr ${parent} '/' '_'`
104 eval "lock=\${gbde_lock_${parent_}-\"${gbde_lockdir}/${parent_}.lock\"}"
105 if [ -e "/dev/${parent}" -a ! -e "/dev/${parent}.bde" ]; then
106 echo "Configuring Disk Encryption for ${parent}."
109 while [ ${count} -le ${gbde_attach_attempts} ]; do
110 if [ -e "${lock}" ]; then
111 gbde attach ${parent} -l ${lock}
113 gbde attach ${parent}
115 if [ -e "/dev/${parent}.bde" ]; then
118 echo "Attach failed; attempt ${count} of ${gbde_attach_attempts}."
119 count=$((${count} + 1))
127 for device in $gbde_devices; do
128 parent=${device%.bde}
129 parent=${parent#/dev/}
130 if [ -e "/dev/${parent}.bde" ]; then
131 umount "/dev/${parent}.bde" 2>/dev/null
132 gbde detach "${parent}"