diff options
author | pjd <pjd@FreeBSD.org> | 2004-10-07 10:02:46 +0000 |
---|---|---|
committer | pjd <pjd@FreeBSD.org> | 2004-10-07 10:02:46 +0000 |
commit | d8c70aa7231230b2525fde7dfc60c2bb045da54f (patch) | |
tree | 83bc138c75ba461b3a5b7679de43d285a613ad6d /etc/rc.d/gbde | |
parent | e7198173ce57a6387891e9385b9f810386ed6cc4 (diff) | |
download | FreeBSD-src-d8c70aa7231230b2525fde7dfc60c2bb045da54f.zip FreeBSD-src-d8c70aa7231230b2525fde7dfc60c2bb045da54f.tar.gz |
- 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.
Diffstat (limited to 'etc/rc.d/gbde')
-rw-r--r-- | etc/rc.d/gbde | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/etc/rc.d/gbde b/etc/rc.d/gbde index 78d698f..42a9b56 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 } |