Author: autopsy
Update of /cvs/devel/kadischi/livecd_generator
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv17155/kadischi/livecd_generator
Modified Files:
install-boot.sh kadischi.py livecd-mkinitrd.sh
Log Message:
Support multiple combinations of possible user installed kernels. UP, SMP, UP & SMP, Xen0, Xen0 & XenU
Index: install-boot.sh
===================================================================
RCS file: /cvs/devel/kadischi/livecd_generator/install-boot.sh,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- install-boot.sh 21 Jun 2006 04:56:57 -0000 1.8
+++ install-boot.sh 30 Jun 2006 23:03:46 -0000 1.9
@@ -5,6 +5,8 @@
kernel=$3
kernel_is_xen0=$(echo $kernel | /bin/grep -G [[:alnum:]]xen0)
kernel_is_xenU=$(echo $kernel | /bin/grep -G [[:alnum:]]xenU)
+kernel_is_smp=$(echo $kernel | /bin/grep -G [[:alnum:]]smp)
+kernel_is_up=$(echo $kernel | grep -v smp)
kernel_version_proper=$(echo $kernel | /bin/sed -e 's|xen0||' | /bin/sed -e 's|xenU||')
kernel_params='selinux=0'
@@ -31,12 +33,47 @@
kernel_params="$kernel_params rhgb"
fi
-/bin/cp $sysdir/boot/isolinux/initrd.img $csysdir/boot/isolinux/initrd.img
-/bin/cp $sysdir/boot/vmlinuz-$kernel $csysdir/boot/isolinux/vmlinuz
+if [ -f $sysdir/boot/isolinux/initrd.smp.img ] && [ -f $sysdir/boot/isolinux/initrd.img ]; then
+ /bin/cp $sysdir/boot/isolinux/initrd.smp.img $csysdir/boot/isolinux/initrd.smp.img
+ /bin/cp $sysdir/boot/vmlinuz-$kernel_version_proper'smp' $csysdir/boot/isolinux/vmlinuz-smp
+ /bin/cp $sysdir/boot/isolinux/initrd.img $csysdir/boot/isolinux/initrd.img
+ /bin/cp $sysdir/boot/vmlinuz-$kernel $csysdir/boot/isolinux/vmlinuz
+
/bin/cp /usr/lib/syslinux/isolinux.bin $csysdir/boot/isolinux/
-
-if [ ! $kernel_is_xen0 ] && [ ! $kernel_is_xenU ]; then
- if [ -d $INSTALLDIR/bootsplash ]; then
+elif [ -f $sysdir/boot/isolinux/initrd.smp.img ] && [ ! -f $sysdir/boot/isolinux/initrd.img ]; then
+ /bin/cp $sysdir/boot/isolinux/initrd.smp.img $csysdir/boot/isolinux/initrd.smp.img
+ /bin/cp $sysdir/boot/vmlinuz-$kernel $csysdir/boot/isolinux/vmlinuz-smp
+ /bin/cp /usr/lib/syslinux/isolinux.bin $csysdir/boot/isolinux/
+ if [ -d $INSTALLDIR/bootsplash ]; then
+ /bin/cp $INSTALLDIR/bootsplash/{memtest,splash.lss,{boot,general,options,license}.msg} $csysdir/boot/isolinux/
+ else
+ echo "Nothing found for bootsplashing."
+ nobootsplash
+ fi
+/bin/cat > $csysdir/boot/isolinux/isolinux.cfg <<_EOF_
+default linux-smp
+prompt 1
+display boot.msg
+timeout 600
+F1 boot.msg
+F2 options.msg
+F3 general.msg
+F4 license.msg
+label linux-smp
+ kernel vmlinuz-smp
+ append initrd=initrd.smp.img quiet $kernel_params
+label debug
+ kernel vmlinuz-smp
+ append initrd=initrd.smp.img INITRD_DBG=x
+label memtest86
+ kernel memtest
+ append -
+_EOF_
+else
+ /bin/cp $sysdir/boot/isolinux/initrd.img $csysdir/boot/isolinux/initrd.img
+ /bin/cp $sysdir/boot/vmlinuz-$kernel $csysdir/boot/isolinux/vmlinuz
+ /bin/cp /usr/lib/syslinux/isolinux.bin $csysdir/boot/isolinux/
+ if [ -d $INSTALLDIR/bootsplash ]; then
/bin/cp $INSTALLDIR/bootsplash/{memtest,splash.lss,{boot,general,options,license}.msg} $csysdir/boot/isolinux/
else
echo "Nothing found for bootsplashing."
@@ -45,15 +82,47 @@
/bin/cat > $csysdir/boot/isolinux/isolinux.cfg <<_EOF_
default linux
prompt 1
+display boot.msg
+timeout 600
+F1 boot.msg
+F2 options.msg
+F3 general.msg
+F4 license.msg
+label linux
+ kernel vmlinuz
+ append initrd=initrd.img quiet $kernel_params
+label debug
+ kernel vmlinuz
+ append initrd=initrd.img INITRD_DBG=x
+label memtest86
+ kernel memtest
+ append -
+_EOF_
+fi
+
+if [ ! $kernel_is_xen0 ] && [ ! $kernel_is_xenU ]; then
+ if [ -f $csysdir/boot/isolinux/initrd.smp.img ] && [ -f $csysdir/boot/isolinux/initrd.img ]; then
+ if [ -d $INSTALLDIR/bootsplash ]; then
+ /bin/cp $INSTALLDIR/bootsplash/{memtest,splash.lss,{boot,general,options,license}.msg} $csysdir/boot/isolinux/
+ else
+ echo "Nothing found for bootsplashing."
+ nobootsplash
+ fi
+/bin/cat > $csysdir/boot/isolinux/isolinux.cfg <<_EOF_
+default linux-smp
+prompt 1
display boot.msg
timeout 600
F1 boot.msg
F2 options.msg
F3 general.msg
F4 license.msg
+label linux-smp
+ kernel vmlinuz-smp
+ append initrd=initrd.smp.img quiet $kernel_params
label linux
kernel vmlinuz
- append initrd=initrd.img quiet $kernel_params
+ append initrd=initrd.img
label debug
kernel vmlinuz
append initrd=initrd.img INITRD_DBG=x
@@ -61,6 +130,7 @@
kernel memtest
append -
_EOF_
+ fi
elif [ $kernel_is_xen0 ]; then
if [ -d $INSTALLDIR/bootsplash ]; then
/bin/cp $INSTALLDIR/bootsplash/{memtest,splash.lss,{xenboot,general,options,license,xen}.msg} $csysdir/boot/isolinux/
@@ -90,7 +160,7 @@
kernel memtest
append -
_EOF_
-else
+elif [ $kernel_is_xenU ]; then
if [ -d $INSTALLDIR/bootsplash ]; then
/bin/cp $INSTALLDIR/bootsplash/{memtest,splash.lss,{xenboot,general,options,license,xen}.msg} $csysdir/boot/isolinux/
else
Index: kadischi.py
===================================================================
RCS file: /cvs/devel/kadischi/livecd_generator/kadischi.py,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- kadischi.py 22 May 2006 05:36:38 -0000 1.12
+++ kadischi.py 30 Jun 2006 23:03:46 -0000 1.13
@@ -2,6 +2,7 @@
import os
import sys
+import string
import optparse
import shutil
from shvar import shvarFile
@@ -20,7 +21,7 @@
buildstamp = ''
product_path = ''
kernel_version = ''
-
+kernel_version_smp = ''
# OK, we`re starting
flc_log ('Starting kadischi...')
@@ -213,7 +214,10 @@
# now`s the time to pickup kernel version cause when we move files arround, it will be late
+# Borrow some functions to do logic processing
kernel_version = get_kernel_version (sysdir)
+kernel_version_smp = string.join([kernel_version, 'smp'], '')
+
# run post_install_scripts
@@ -234,9 +238,22 @@
# make initrd image
+# Borrow some more functions to do our logic
flc_log ('making initrd image')
-run ("%s %s %s" % (normalize_path([bindir, 'livecd-mkinitrd.sh']), sysdir, kernel_version), builddir)
-
+kernel_smp = ("kernel-smp")
+kernel = ("kernel")
+has_kernel_smp = check_installed_rpms(sysdir, kernel_smp, False)
+has_kernel = check_installed_rpms(sysdir, kernel, False)
+
+if has_kernel and has_kernel_smp:
+ run ("%s %s %s" % (normalize_path([bindir, 'livecd-mkinitrd.sh']), sysdir, kernel_version), builddir)
+ run ("%s %s %s" % (normalize_path([bindir, 'livecd-mkinitrd.sh']), sysdir, kernel_version_smp), builddir)
+elif has_kernel_smp == 0 and has_kernel == -1:
+ string.split(kernel_version, 'smp')
+ string.join([kernel_version, 'smp'], '')
+ run ("%s %s %s" % (normalize_path([bindir, 'livecd-mkinitrd.sh']), sysdir, kernel_version), builddir)
+else:
+ run ("%s %s %s" % (normalize_path([bindir, 'livecd-mkinitrd.sh']), sysdir, kernel_version), builddir)
# move files
flc_log ('moving files that should be on tmpfs')
Index: livecd-mkinitrd.sh
===================================================================
RCS file: /cvs/devel/kadischi/livecd_generator/livecd-mkinitrd.sh,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- livecd-mkinitrd.sh 20 Jun 2006 20:30:07 -0000 1.12
+++ livecd-mkinitrd.sh 30 Jun 2006 23:03:46 -0000 1.13
@@ -5,6 +5,7 @@
# based on diskless-mkinitrd from readonly-root package
#
# diskless-mkinitrd is based heavily on mkinitrd and updateDiskless from system-config-boot
+# set -x
PATH=/sbin:/usr/sbin:/bin:/usr/bin:$PATH
export PATH
@@ -16,7 +17,11 @@
rootdir=""
imagedir="/boot/isolinux/"
image="initrd.img"
+imagesmp="initrd.smp.img"
+
kernel=""
+is_up_kernel=""
+is_smp_kernel=""
force=""
verbose=""
basedir=""
@@ -86,7 +91,7 @@
compress=""
;;
- -f)
+ --force)
force=1
;;
@@ -112,6 +117,35 @@
shift
done
+is_smp_kernel() {
+ echo "$kernel" | /bin/grep smp >/dev/null 2>&1
+ if [ "$?" -eq "0" ]; then
+ is_smp_kernel="yes"
+ elif [ "$?" -ne "0" ]; then
+ is_smp_kernel="no"
+ fi
+}
+
+is_up_kernel() {
+ echo "$kernel" | /bin/grep -v smp >/dev/null 2>&1
+ if [ "$?" -eq "0" ]; then
+ is_up_kernel="yes"
+ elif [ "$?" -ne "0" ]; then
+ is_up_kernel="no"
+ fi
+}
+
+is_smp_kernel
+is_up_kernel
+
+if [ "$is_smp_kernel" == "yes" ] && [ "$is_up_kernel" == "no" ]; then
+ image="initrd.smp.img"
+else
+ if [ "$is_smp_kernel" == "no" ] && [ "$is_up_kernel" == "yes" ]; then
+ image="initrd.img"
+ fi
+fi
+
if [ -z "$rootdir" -o -z "$kernel" ]; then
usage
fi
@@ -120,10 +154,15 @@
# target="$target-$kernel"
#fi
-if [ -z "$force" -a -f $rootdir/$imagedir/$image ]; then
+if [ -z "$force" -a -f $rootdir/$imagedir/$image ] && [ "$is_smp_kernel" == "yes" ]; then
+ echo "$rootdir/$imagedir/$image already exists. Must be 2 kernels.. continuing" >&2
+elif [ -z "$force" -a -f $rootdir/$imagedir/$image ] && [ "$is_smp_kernel" == "no" ]; then
echo "$rootdir/$imagedir/$image already exists." >&2
exit 1
-fi
+elif [ -z "$force" -a -f $rootdir/$imagedir/$image ] && [ -z "$force" -a -f $rootdir/$imagedir/$imagesmp ]; then
+ echo "$rootdir/$imagedir/$image and $imagesmp already exists." >&2
+ exit 1
+fi
if [ ! -d $rootdir/$imagedir ]; then
/bin/mkdir $rootdir/$imagedir
@@ -215,7 +254,7 @@
/bin/ln -s bin $MNTIMAGE/sbin
# We don't need this directory, so let's save space
-/bin/rm -rf $MNTPOINT/lost+found
+# /bin/rm -rf $MNTPOINT/lost+found
inst $rootdir/lib/ld-linux.so.2 "$MNTIMAGE/lib/ld-linux.so.2"
inst $rootdir/lib/libselinux.so.1 "$MNTIMAGE/lib/libselinux.so.1"
@@ -285,11 +324,22 @@
/bin/umount $MNTPOINT
/sbin/losetup -d $LODEV
-if [ -n "$compress" ]; then
- /bin/gzip -9 < $IMAGE > $rootdir/$imagedir/$image || rc=1
+if [ "$compress" == "1" ]; then
+ if [ "$is_smp_kernel" == "yes" ]; then
+ /bin/gzip -9 < $IMAGE > $rootdir/$imagedir/initrd.smp.img || rc=1
+ elif [ "$is_up_kernel" == "yes" ]; then
+ /bin/gzip -9 < $IMAGE > $rootdir/$imagedir/$image || rc=1
+ fi
else
- /bin/cp -a $IMAGE $rootdir/$imagedir/$image || rc=1
+ if [ "$is_smp_kernel" == "yes" ]; then
+ /bin/cp -a $IMAGE $rootdir/$imagedir/initrd.smp.img || rc=1
+ elif [ "$is_up_kernel" == "yes" ]; then
+ /bin/cp -a $IMAGE $rootdir/$imagedir/$image || rc=1
+ fi
fi
+
+
/bin/rm -rf $MNTIMAGE $MNTPOINT $IMAGE
+echo "$kernel initrd made successfully!"
exit $rc