geom mirror and gbde

Attila Nagy bra at fsn.hu
Fri Jan 21 00:57:07 PST 2005


Hello,

I would like to use gbde on a geom mirror, but /etc/rc.d/gbde fails if 
there is a slash in the device name.

I don't know what would be the clean solution, I used the attached diff 
to solve the problem.

Please review it and if there is a better solution, commit it.

Thanks,
-- 
Attila Nagy                                   e-mail: Attila.Nagy at fsn.hu
Adopt a directory on our free software   phone @work: +361 371 3536
server! http://www.fsn.hu/?f=brick             cell.: +3630 306 6758
-------------- next part --------------
--- /tmp/gbde	Fri Jan 21 09:38:51 2005
+++ gbde	Thu Dec  9 10:53:51 2004
@@ -3,7 +3,7 @@
 # This file, originally written by Garrett A. Wollman, is in the public
 # domain.
 #
-# $FreeBSD: /repoman/r/ncvs/src/etc/rc.d/gbde,v 1.5.2.2 2004/10/15 06:14:43 pjd Exp $
+# $FreeBSD: src/etc/rc.d/gbde,v 1.5.2.2 2004/10/15 06:14:43 pjd Exp $
 #
 
 # PROVIDE: disks
@@ -81,16 +81,17 @@
 	for device in $gbde_devices; do
 		parent=${device%.bde}
 		parent=${parent#/dev/}
-		eval "lock=\${gbde_lock_${parent}-\"${gbde_lockdir}/${parent}.lock\"}"
+		parent_=`echo ${parent} | sed "s/\//_/g"`
+		eval "lock=\${gbde_lock_${parent_}-\"${gbde_lockdir}/${parent_}.lock\"}"
 		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 ${parent} -l ${lock}
+					gbde attach /dev/${parent} -l ${lock}
 				else
-					gbde attach ${parent}
+					gbde attach /dev/${parent}
 				fi
 				if [ -e "/dev/${parent}.bde" ]; then
 					break
@@ -109,7 +110,7 @@
 		parent=${parent#/dev/}
 		if [ -e "/dev/${parent}.bde" ]; then
 			umount "/dev/${parent}.bde" 2>/dev/null
-			gbde detach "${parent}"
+			gbde detach "/dev/${parent}"
 		fi
 	done
 }


More information about the freebsd-hackers mailing list