- Be more userfriendly and allow to specify gbde device name in those forms:

device
	device.bde
	/dev/device
	/dev/device.bde
- Fix stop routine:
	+ There don't have to be file system mounted on gbde device,
	  so ignore errors from umount(8).
	+ Only detach existing gbde devices.
This commit is contained in:
Pawel Jakub Dawidek 2004-10-07 10:02:46 +00:00
parent 1af0547f8b
commit 57dd0a90b6

View File

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