pld-builder.new: etc/pld-builder.init - mount/umount/stat chroot /proc with...

glen glen at pld-linux.org
Mon May 21 21:20:05 CEST 2012


Author: glen                         Date: Mon May 21 19:20:05 2012 GMT
Module: pld-builder.new               Tag: HEAD
---- Log message:
- mount/umount/stat chroot /proc without having mount(1) installed inside chroot

---- Files affected:
pld-builder.new/etc:
   pld-builder.init (1.12 -> 1.13) 

---- Diffs:

================================================================
Index: pld-builder.new/etc/pld-builder.init
diff -u pld-builder.new/etc/pld-builder.init:1.12 pld-builder.new/etc/pld-builder.init:1.13
--- pld-builder.new/etc/pld-builder.init:1.12	Thu Jul  8 12:50:54 2010
+++ pld-builder.new/etc/pld-builder.init	Mon May 21 21:20:00 2012
@@ -22,8 +22,14 @@
 	local ret
 	for CHROOT in $CHROOTS; do
 		show "chroot: %s mount /proc" "$CHROOT"
-		ret=$(chroot $CHROOT mount /proc > /dev/null 2>&1; echo $?)
-		[ $ret -eq 0 ] && ok || fail
+		mount -t proc -o gid=17 none $CHROOT/proc
+		ret=$?
+		if [ $ret -eq 0 ]; then
+			ok
+		else
+			fail
+			RETVAL=$ret
+		fi
 	done
 }
 
@@ -31,8 +37,8 @@
 	local ret
 	for CHROOT in $CHROOTS; do
 		show "chroot: %s umount /proc" "$CHROOT"
-		ret=$(chroot $CHROOT umount /proc > /dev/null 2>&1; echo $?)
-		[ $ret -eq 0 ] && ok || fail
+		umount $CHROOT/proc
+		[ $? -eq 0 ] && ok || fail
 	done
 }
 
@@ -40,8 +46,14 @@
 	local ret
 	for CHROOT in $CHROOTS; do
 		show "chroot: %s is /proc mounted?" "$CHROOT"
-		ret=$(chroot $CHROOT mount 2> /dev/null | grep -q 'none.*/proc'; echo $?)
-		[ $ret -eq 0 ] && ok || fail
+		test -f $CHROOT/proc/mounts
+		ret=$?
+		if [ $ret -eq 0 ]; then
+			ok
+		else
+			fail
+			RETVAL=$ret
+		fi
 	done
 }
 
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/pld-builder.new/etc/pld-builder.init?r1=1.12&r2=1.13



More information about the pld-cvs-commit mailing list