RHEL 7 needs different boot options to support kickstart
authorMartin Schwenke <martin@meltin.net>
Mon, 16 Jun 2014 05:57:44 +0000 (15:57 +1000)
committerMartin Schwenke <martin@meltin.net>
Wed, 25 Jun 2014 10:46:15 +0000 (20:46 +1000)
It no longer supports ks=floppy and needs inst.stage2 to point to the
DVD image.

Label the "floppy" as "KICKSTART" regardless of the version - this
does no harm.

If running RHEL >= 7 then set up the kickstart "floppy" as a hard disk
in libvirt and have the kernel command-line point to the label.  Also
set inst.stage2 so it can find root device to install from.

Signed-off-by: Martin Schwenke <martin@meltin.net>
autocluster
config.d/00base.defconf
templates/install.xml

index df4ed57d76065e8d514afcbbf89c04e15efaaad1..59678df3e5c3c1686bd08284d1732b524ae296de 100755 (executable)
@@ -592,7 +592,7 @@ EOF
     
     echo "Creating kickstart floppy"
     dd if=/dev/zero of=tmp/floppy.img bs=1024 count=1440
-    mkdosfs tmp/floppy.img
+    mkdosfs -n KICKSTART tmp/floppy.img
     mount -o loop -t msdos tmp/floppy.img mnt
     cp tmp/ks.cfg mnt
     mount -o loop,ro $ISO tmp/ISO
index 0765778abf568ef8ea7c1033b67712890a9d69b2..b41632db00043f46e54a5592800a0714208ebb0f 100644 (file)
@@ -62,6 +62,9 @@ defconf NODE_TEMPLATE "$installdir/templates/node.xml" \
 defconf INSTALL_TEMPLATE "$installdir/templates/install.xml" \
        "<file>" "libvirt template for initial install"
 
+defconf INSTALL_KERNEL_OPTIONS "@uto" \
+       "<options>" "installer kernel command-line options"
+
 defconf BOOT_TEMPLATE "$installdir/templates/bootbase.xml" \
        "<file>" "libvirt template for \"bootbase\" command"
 
@@ -418,6 +421,35 @@ rhel_get_services ()
     echo "$installdir/templates/RHEL${RHEL_VERSION%%.*}.services"
 }
 
+rhel_get_install_kernel_options ()
+{
+    case "$RHEL_VERSION" in
+       (7.*) echo "ks=hd:LABEL=KICKSTART inst.stage2=hd:LABEL=RHEL-${RHEL_VERSION}\\\\x20Server.${RHEL_ARCH}" ;;
+       (*) echo "ks=floppy" ;;
+    esac
+}
+
+rhel_get_install_ks_device_xml ()
+{
+    if [ ${RHEL_VERSION%%.*} -le 6 ] ; then
+       cat <<EOF
+    <disk type='file' device='floppy'>
+      <source file='@@PWD@@/tmp/floppy.img'/>
+      <target dev='fda'/>
+      <readonly/>
+    </disk>
+EOF
+    else
+       cat <<EOF
+    <disk type='file' device='disk'>
+      <source file='@@PWD@@/tmp/floppy.img'/>
+      <target dev='@@SYSTEM_DISK_PREFIX@@b' bus='@@SYSTEM_DISK_TYPE@@'/>
+      <driver name='qemu' type='raw'/>
+    </disk>
+EOF
+    fi
+}
+
 rhel_post_config_hook ()
 {
     if [ "$ISO" = "@uto" ] ; then
@@ -447,6 +479,14 @@ rhel_post_config_hook ()
     if [ "$RHEL_SERVICES" = "@uto" ] ; then
        RHEL_SERVICES=$(rhel_get_services) || exit $?
     fi
+
+    if [ "$INSTALL_KERNEL_OPTIONS" = "@uto" ] ; then
+       INSTALL_KERNEL_OPTIONS=$(rhel_get_install_kernel_options) || exit $?
+    fi
+
+    if [ "$INSTALL_KS_DEVICE_TEMPLATE" = "@uto" ] ; then
+       INSTALL_KS_DEVICE_TEMPLATE=$(rhel_get_install_ks_device_xml) || exit $?
+    fi
 }
 
 register_hook post_config_hooks rhel_post_config_hook
@@ -502,6 +542,8 @@ defconf KS_KERNEL_OPTS "rhgb console=tty1 console=ttyS0,19200 nodmraid nompath"
 defconf KS_DONE_MESSAGE "you may safely reboot your system|System halted." \
        "<string>" "string indicating kickstart install is complete"
 
+defconf INSTALL_KS_DEVICE_TEMPLATE "@uto"
+
 ##############################
 
 defconf CREATE_BASE_TIMEOUT 3600 \
index 87a4dd759f904da39872ca93db31ef81fdfeb480..437bc266fd57192f7a69aaa429e0b9c8ef596eee 100644 (file)
@@ -9,7 +9,7 @@
           <type>hvm</type>
           <kernel>@@PWD@@/tmp/vmlinuz</kernel>
           <initrd>@@PWD@@/tmp/initrd.img</initrd>
-          <cmdline>console=ttyS0,115200 ks=floppy</cmdline>
+          <cmdline>console=ttyS0,115200 selinux=0 @@INSTALL_KERNEL_OPTIONS@@</cmdline>
   </os>
   <features>
     <acpi/>
       <target dev='hdc' bus='ide'/>
       <readonly/>
     </disk>
-    <disk type='file' device='floppy'>
-      <source file='@@PWD@@/tmp/floppy.img'/>
-      <target dev='fda'/>
-      <readonly/>
-    </disk>
+@@INSTALL_KS_DEVICE_TEMPLATE@@
 @@@NETWORK_TEMPLATE@@@
     <input type='mouse' bus='ps2'/>
     <graphics type='vnc' port='-1' listen='127.0.0.1'/>