read bash?

Jan Eidtmann cmak at lunar-linux.org
Sun Feb 11 21:04:12 CET 2007


did i forget the patch?
i did.

 ///
cmak
-------------- next part --------------
--- mount.old	2007-02-11 20:22:31.013738454 +0100
+++ mount	2007-02-11 20:21:15.829208326 +0100
@@ -107,7 +107,7 @@
 		return
 	fi
 
-	echo -n "$1"
+	echo -ne "$1"
 
 	if [ -n "$DEBUG" ]; then
 		 echo -n "< $2 >"
@@ -206,6 +206,36 @@
 		fi
 	fi
 
+	# unlock luks devices as configured in /etc/crypttab
+	# doesnt work for encrypted root partitions for obvious reasons (same for LVM stuff below)
+	#run_with_msg "Opening device /dev/sdb1:\n" "/sbin/cryptsetup luksOpen /dev/sdb1 sdb1_c"
+	if [ -f /etc/crypttab ]; then
+		# check for luks support
+		if ! /sbin/cryptsetup --help | grep -q luksFormat ; then
+			echo "Error: We need cryptsetup-luks"
+		else
+			sed 's/#.*$//g' /etc/crypttab | tr '\t' ' ' | grep -v -e '^$' | while read DEVICE MAPPING
+			do
+				if [ -z "$DEVICE" ] || [ ! -e "$DEVICE" ] ; then
+					echo "Unable to find \"$DEVICE\""
+					echo "please check /etc/crypttab"
+					continue
+				elif ! /sbin/cryptsetup isLuks "$DEVICE" ; then
+					echo "please check /etc/crypttab"
+					continue
+				fi
+				echo "Unlocking device $DEVICE:"
+				/sbin/cryptsetup luksOpen $DEVICE $MAPPING <&1
+			done
+		fi
+	fi
+
+	# LVM
+	if [ -f /etc/lvm/lvm.conf ]; then
+		run_with_msg "Initializing linux volume groups" "/sbin/vgscan --ignorelockingfailure"
+    	run_without_msg "/sbin/vgchange -a y --ignorelockingfailure"
+	fi
+
 	# or do we want to explicitly _not_ fsck at all
 	if ! grep -qw nofsck /proc/cmdline ; then
 		# force fsck run?
@@ -372,6 +402,17 @@
 			esac
 		fi
 	fi
+
+	# crypt + lvm
+	if [ -f /etc/lvm/lvm.conf ]; then
+		run_without_msg "/sbin/vgchange -an"
+	fi
+	if [ -f /etc/crypttab ]; then
+		sed 's/#.*$//g' /etc/crypttab | tr '\t' ' ' | grep -v -e '^$' | while read DEVICE MAPPING
+		do
+			run_without_msg "/usr/sbin/cryptsetup luksClose $MAPPING"
+		done
+	fi
 }
 
 


More information about the Lunar-dev mailing list