On Tue, Jul 30, 2002 at 12:12:45PM +0200, Pixel wrote:
> 
> please give it. If it's really small and benign, that's ok :)

Attached.  Thanx much!

b.

-- 
Brian J. Murrell
--- sbin/mkinitrd       2002-07-30 00:09:02.000000000 -0400
+++ /sbin/mkinitrd      2002-04-15 18:41:25.000000000 -0400
@@ -396,6 +396,15 @@
 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|^,||")
 
+rootdev=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $1; }}' $fstab)
+root_major=$(ls -l $rootdev | awk '{ print $5}')
+
+if [ $root_major = 58, ]; then
+# root is on an LVM LV
+    lvmroot=1
+    findmodule lvm-mod
+fi
+
 # in case the root filesystem is modular
 findmodule -${rootfs}
 
@@ -472,6 +481,13 @@
     inst /sbin/insmod.static "$MNTIMAGE/bin/insmod"
 fi
 ln -s ../bin/nash $MNTIMAGE/sbin/modprobe
+if [ -n "$lvmroot" ]; then
+    INITRDFILES="/sbin/vgchange /sbin/vgscan"
+    cp -aL /sbin/vgchange $MNTIMAGE/sbin
+    cp -aL /sbin/vgscan $MNTIMAGE/sbin
+    cp -aL /lib/libc.so.6 $MNTIMAGE/lib
+    cp -aL /lib/ld-linux.so.2 $MNTIMAGE/lib
+fi
 
 for MODULE in $MODULES; do
     f="/lib/modules/$kernel/$MODULE"
@@ -546,6 +562,12 @@
 else
 # Linux-2.4
 echo "echo 0x0100 > /proc/sys/kernel/real-root-dev" >> $RCFILE
+if [ -n "$lvmroot" ]; then
+    echo "echo Configuring LVM" >> $RCFILE
+    echo "/sbin/vgscan" >> $RCFILE
+    echo "/sbin/vgchange -a y" >> $RCFILE
+    IMAGESIZE=$[IMAGESIZE + 5000]
+fi
 echo "umount /proc" >> $RCFILE
 
 [ -n "$rootfsopts" ] && rootfsopts_msg="with flags $rootfsopts"

Attachment: msg68958/pgp00000.pgp
Description: PGP signature

Reply via email to