The following patch to mkinitrd will prevent monumental screwups when your 
fstab accidentally contains multiple entries for / (k3b screwed mine over).



**********************************************************************
The information contained in this message is confidential and 
is intended for the addressee(s) only.  If you have received 
this message in error or there are any problems please notify 
the originator immediately.  The unauthorised use, disclosure, 
copying or alteration of this message is strictly forbidden. This
message and any attachments have been scanned for viruses.
Orbiscom Ltd. will not be liable for direct, special, indirect or 
consequential damages arising from alteration of the contents 
of this message by a third party or as a result of any virus being
passed on.


www.Orbiscom.com
**************************************

--- /sbin/mkinitrd	2002-11-07 11:26:46.000000000 +0000
+++ /tmp/mkinitrd	2002-12-04 17:52:32.000000000 +0000
@@ -402,11 +402,11 @@
 	
 fi
 
-rootfs=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $3; }}' $fstab)
-rootfsopts=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/" && $6) { print $4; }}' $fstab | sed "s|defaults||;s|auto||;s|loop||;s|,,|,|;s|,$||;s|^,||")
+rootfs=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $3; }}' $fstab | head -1)
+rootfsopts=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/" && $6) { print $4; }}' $fstab | sed "s|defaults||;s|auto||;s|loop||;s|,,|,|;s|,$||;s|^,||" | head -1)
 
-rootdev=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $1; }}' $fstab)
-root_major=$(ls -l $rootdev | awk '{ print $5}')
+rootdev=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $1; }}' $fstab | head -1)
+root_major=$(ls -l $rootdev | awk '{ print $5}' | head -1)
 
 if [ $root_major = 58, ]; then
 # root is on an LVM LV

Reply via email to