diff --git a/etc/rc.d/gbde b/etc/rc.d/gbde index 78d698f96df0..42a9b562b04b 100644 --- a/etc/rc.d/gbde +++ b/etc/rc.d/gbde @@ -79,26 +79,25 @@ find_gbde_devices() gbde_start() { for device in $gbde_devices; do - parentdev=${device%.bde} - parent=${parentdev#/dev/} + parent=${device%.bde} + parent=${parent#/dev/} eval "lock=\${gbde_lock_${parent}-\"${gbde_lockdir}/${parent}.lock\"}" - if [ -e "/dev/${parent}" -a ! -e "${device}" ]; then - echo "Configuring Disk Encryption for ${device}." + if [ -e "/dev/${parent}" -a ! -e "/dev/${parent}.bde" ]; then + echo "Configuring Disk Encryption for ${parent}." count=1 while [ ${count} -le ${gbde_attach_attempts} ]; do if [ -e "${lock}" ]; then - gbde attach ${parentdev} -l ${lock} + gbde attach ${parent} -l ${lock} else - gbde attach ${parentdev} + gbde attach ${parent} fi - if [ -e ${device} ]; then + if [ -e "/dev/${parent}.bde" ]; then break fi echo "Attach failed; attempt ${count} of ${gbde_attach_attempts}." count=$((${count} + 1)) done - fi done } @@ -106,8 +105,12 @@ gbde_start() gbde_stop() { for device in $gbde_devices; do - umount ${device} - gbde detach ${device%.bde} + parent=${device%.bde} + parent=${parent#/dev/} + if [ -e "/dev/${parent}.bde" ]; then + umount "/dev/${parent}.bde" 2>/dev/null + gbde detach "${parent}" + fi done }