- The bootcd environment does not have device mapper enabled, and newer
authorMark Huang <mlhuang@cs.princeton.edu>
Wed, 18 Aug 2004 19:44:51 +0000 (19:44 +0000)
committerMark Huang <mlhuang@cs.princeton.edu>
Wed, 18 Aug 2004 19:44:51 +0000 (19:44 +0000)
mkinitrd scripts depend upon the existence of "/dev/mapper" somewhere in
the rootdev name to enable root LVM support. The initrd image generated
by the initial kernel RPM installation thus ends up lacking root LVM
support.

scripts/kernel-2.6-planetlab.spec

index 4aa6906..367faab 100644 (file)
@@ -387,7 +387,19 @@ exit 0
 exit 0
 
 %post 
+# trick mkinitrd in case the current environment does not have device mapper
+rootdev=$(awk '/^[ \t]*[^#]/ { if ($2 == "/") { print $1; }}' /etc/fstab)
+if echo $rootdev |grep -q /dev/mapper 2>/dev/null ; then
+    if [ ! -f $rootdev ]; then
+       fake_root_lvm=1
+       mkdir -p $(dirname $rootdev)
+       touch $rootdev
+    fi
+fi
 [ -x /sbin/new-kernel-pkg ] && /sbin/new-kernel-pkg --mkinitrd --depmod --install %{KVERREL}
+if [ -n "$fake_root_lvm" ]; then
+    rm -f $rootdev
+fi
 if [ -x /usr/sbin/hardlink ] ; then
 pushd /lib/modules/%{KVERREL}/build > /dev/null ; {
        cd /lib/modules/%{KVERREL}/build