[Fai-commit] r6564 - trunk/examples/simple/scripts/CENTOS

Thomas Lange lange at alioth.debian.org
Fri Jun 3 09:53:25 UTC 2011


Author: lange
Date: 2011-06-03 09:53:25 +0000 (Fri, 03 Jun 2011)
New Revision: 6564

Modified:
   trunk/examples/simple/scripts/CENTOS/30-mkinitrd
   trunk/examples/simple/scripts/CENTOS/40-install-grub
Log:
add support for CentOD6/SLC6


Modified: trunk/examples/simple/scripts/CENTOS/30-mkinitrd
===================================================================
--- trunk/examples/simple/scripts/CENTOS/30-mkinitrd	2011-05-30 15:50:53 UTC (rev 6563)
+++ trunk/examples/simple/scripts/CENTOS/30-mkinitrd	2011-06-03 09:53:25 UTC (rev 6564)
@@ -9,6 +9,10 @@
 ainsl -v $target/etc/fstab "sysfs	/sys	sysfs	auto		0 0"
 
 version=`$ROOTCMD rpm -qv kernel | cut -d- -f2-`
+
+use_mkinitrd() {
+
+# CentOS 5 uses mkinitrd
 $ROOTCMD kudzu -q -k $version
 # Unfortunately mkinitrd is horrible at guessing which modules to include,
 # especially when the running kernel is different than the kernel for which
@@ -31,4 +35,15 @@
     $ROOTCMD mkinitrd -f -v /boot/initrd-$version.img $version
 fi
 
+}
+
+if [ -f $target/sbin/dracut ]; then
+    # CentOS 6 uses dracut, but we do not need to call it
+    #$ROOTCMD dracut -v "initramfs-$version.img" $version
+else
+    # CentOS 5 uses mkinitrd
+    use_mkinitrd
+fi
+
+
 exit $error

Modified: trunk/examples/simple/scripts/CENTOS/40-install-grub
===================================================================
--- trunk/examples/simple/scripts/CENTOS/40-install-grub	2011-05-30 15:50:53 UTC (rev 6563)
+++ trunk/examples/simple/scripts/CENTOS/40-install-grub	2011-06-03 09:53:25 UTC (rev 6564)
@@ -23,6 +23,7 @@
 
 mount -o bind /dev $target/dev
 
+
 $ROOTCMD grub-install --just-copy
 
 $ROOTCMD grub --device-map=/dev/null --no-floppy --batch <<-EOF
@@ -42,18 +43,28 @@
 	pretty="color cyan/blue white/blue"
 fi
 
+if [ -f $target/sbin/dracut ]; then
+    # CentOS 6
+    iname=initramfs
+else
+    # CentOS 5
+    iname=initrd
+fi
+title=`head -1 $target/etc/redhat-release`
+
 cat > $target/boot/grub/grub.conf <<-EOF
 	timeout 5
 	default 0
 	$pretty
 	hiddenmenu
 	
-	title CentOS ($version)
+	title $title
 	  root $bootpart
 	  kernel $bootdir/vmlinuz-$version root=$ROOT_PARTITION ro
-	  initrd $bootdir/initrd-$version.img
+	  initrd $bootdir/$iname-$version.img
 	EOF
 
+
 echo ""
 echo "Grub installed on $BOOT_DEVICE = $bootdev"
 echo "Grub boot partition is $BOOT_PARTITION = $bootpart"




More information about the Fai-commit mailing list