- 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
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=136212

View File

@ -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
}