[Fai-commit] r6561 - trunk/examples/simple/scripts/CENTOS
Thomas Lange
lange at alioth.debian.org
Fri May 27 16:23:57 UTC 2011
Author: lange
Date: 2011-05-27 16:23:57 +0000 (Fri, 27 May 2011)
New Revision: 6561
Modified:
trunk/examples/simple/scripts/CENTOS/30-mkinitrd
Log:
safer generation of initrd, add drivers only if available
Modified: trunk/examples/simple/scripts/CENTOS/30-mkinitrd
===================================================================
--- trunk/examples/simple/scripts/CENTOS/30-mkinitrd 2011-05-27 15:01:50 UTC (rev 6560)
+++ trunk/examples/simple/scripts/CENTOS/30-mkinitrd 2011-05-27 16:23:57 UTC (rev 6561)
@@ -1,6 +1,7 @@
#! /bin/bash
# (c) Michael Goetze, 2010-2011, mgoetze at mgoetze.net
+# (c) Thomas Lange, 2011, Uni Koeln
error=0; trap 'error=$(($?>$error?$?:$error))' ERR # save maximum error code
@@ -15,10 +16,19 @@
drivers=""
for bus in pci virtio; do
for dr in `$ROOTCMD kudzu -p -k $version -b $bus|grep driver:|cut -d' ' -f2|sort -u`; do
+ found=`find $target/lib/modules/$version/ -name $dr.ko 2>/dev/null`
+ if [ -n "$found" ]; then
+ # add driver only if it's available as .ko module in the destination kernel
drivers+=" --with=$dr"
+ fi
done
done
$ROOTCMD mkinitrd -f -v $drivers /boot/initrd-$version.img $version
+if [ $? -eq 1 ]; then
+ echo "WARNING: generating initrd with list of drivers failed. Trying without."
+ $ROOTCMD mkinitrd -f -v /boot/initrd-$version.img $version
+fi
+
exit $error
More information about the Fai-commit
mailing list