Update pxeboot kickstart to allow for hybrid install

The generated pxeboot kickstart templates that are included in the
installation ISO will be used by the gen-bootloader-iso.sh in setting
up a hybrid ISO/network installation, where the kernel and initrd are
loaded from ISO, but the rootfs, kickstart, and software repositories
are accessed via http/https. In order to support this installation,
the pxeboot kickstart is updated to allow for the case where the
BOOTIF cmdline parameter is not set (ie. node booted from ISO rather
than network).

This update also adds a check to the pxeboot kickstart to mount the
installation media if in this scenario. In the case where a controller
has been booted from an ISO with installation media accessed from the
network, dracut does not mount the ISO. This results in the 'reboot
--eject' in the kickstart being ignored, and when the newly installed
node is rebooted, it may just boot the ISO again. By mounting the
media in this case, Anaconda will eject it as expected.

Story: 2006980
Task: 38466

Change-Id: I9330a2d50b8966a2b3f2b59cabec20f084372d8c
Signed-off-by: Don Penney <don.penney@windriver.com>
This commit is contained in:
Don Penney 2020-02-05 14:36:43 -05:00
parent 932d7df90a
commit 041049063e

View File

@ -30,17 +30,29 @@ if [ -n "$BOOTIF" ] ; then
ndev=`ip link show |grep -B 1 $BOOTIF |head -1 |awk '{print $2}' |sed -e 's/://'`
if [ -n "$ndev" ] ; then
mgmt_dev=$ndev
# Persist the boot device to the platform configuration. This will get
# overwritten when config_controller is run.
echo management_interface=$mgmt_dev >> /etc/platform/platform.conf
cat << EOF > /etc/sysconfig/network-scripts/ifcfg-$mgmt_dev
DEVICE=$mgmt_dev
BOOTPROTO=dhcp
ONBOOT=yes
IPV6_AUTOCONF=no
EOF
else
report_post_failure_with_msg "ERROR: Unable to determine mgmt interface from BOOTIF=$BOOTIF."
fi
else
report_post_failure_with_msg "ERROR: BOOTIF is not set. Unable to determine mgmt interface."
# This is a hybrid ISO/network install. Mount the media to ensure Anaconda
# ejects it on reboot.
if [ -e /dev/disk/by-label/oe_iso_boot ]; then
mkdir /mnt/iso
mount /dev/disk/by-label/oe_iso_boot /mnt/iso
fi
fi
# Persist the boot device to the platform configuration. This will get
# overwritten when config_controller is run.
echo management_interface=$mgmt_dev >> /etc/platform/platform.conf
# persist the default http port number to platform configuration. This
# will get overwritten when config_controller is run.
echo http_port=8080 >> /etc/platform/platform.conf
@ -57,13 +69,6 @@ IPV6_AUTOCONF=no
NAME=loopback
EOF
cat << EOF > /etc/sysconfig/network-scripts/ifcfg-$mgmt_dev
DEVICE=$mgmt_dev
BOOTPROTO=dhcp
ONBOOT=yes
IPV6_AUTOCONF=no
EOF
%end
%post --erroronfail
@ -74,6 +79,13 @@ EOF
anaconda_logdir=/var/log/anaconda
mkdir -p $anaconda_logdir
# Check for inst.noverifyssl
if grep -q inst.noverifyssl /proc/cmdline; then
NOVERIFYSSL_WGET_OPT="--no-check-certificate"
else
NOVERIFYSSL_WGET_OPT=""
fi
cd /www/pages
mkdir -p feed/rel-xxxPLATFORM_RELEASExxx/Packages
mkdir -p feed/rel-xxxPLATFORM_RELEASExxx/repodata
@ -81,16 +93,18 @@ cd feed/rel-xxxPLATFORM_RELEASExxx
feed_url=xxxHTTP_URLxxx
declare -i cut_dirs=NUM_DIRS
echo "Mirroring software repository (may take several minutes)..." >/dev/console
wget --mirror --no-parent --no-host-directories --reject 'index.html*' --cut-dirs=$cut_dirs $feed_url/Packages/ -o $anaconda_logdir/rpmget.log \
wget ${NOVERIFYSSL_WGET_OPT} --mirror --no-parent --no-host-directories --reject 'index.html*' \
--cut-dirs=$cut_dirs $feed_url/Packages/ -o $anaconda_logdir/rpmget.log \
|| report_post_failure_with_logfile $anaconda_logdir/rpmget.log
wget --mirror --no-parent --no-host-directories --reject 'index.html*' --cut-dirs=$cut_dirs $feed_url/repodata/ -o $anaconda_logdir/rpmget_repo.log \
wget ${NOVERIFYSSL_WGET_OPT} --mirror --no-parent --no-host-directories --reject 'index.html*' \
--cut-dirs=$cut_dirs $feed_url/repodata/ -o $anaconda_logdir/rpmget_repo.log \
|| report_post_failure_with_logfile $anaconda_logdir/rpmget_repo.log
wget $feed_url/isolinux.cfg --append $anaconda_logdir/wget_kickstarts.log \
wget ${NOVERIFYSSL_WGET_OPT} $feed_url/isolinux.cfg --append $anaconda_logdir/wget_kickstarts.log \
|| report_post_failure_with_logfile $anaconda_logdir/wget_kickstarts.log
echo "Done" >/dev/console
patches_url=xxxHTTP_URLxxx/patches
wget -q --spider ${patches_url}/
wget ${NOVERIFYSSL_WGET_OPT} -q --spider ${patches_url}/
if [ $? -eq 0 ]; then
echo "Downloading patches..." >/dev/console
cd /www/pages
@ -99,15 +113,18 @@ if [ $? -eq 0 ]; then
cd updates/rel-xxxPLATFORM_RELEASExxx
declare -i patches_cut_dirs=$((cut_dirs+1))
wget --mirror --no-parent --no-host-directories --reject 'index.html*' --cut-dirs=$patches_cut_dirs $patches_url/Packages/ -o $anaconda_logdir/patches_rpmget.log \
wget ${NOVERIFYSSL_WGET_OPT} --mirror --no-parent --no-host-directories --reject 'index.html*' \
--cut-dirs=$patches_cut_dirs $patches_url/Packages/ -o $anaconda_logdir/patches_rpmget.log \
|| report_post_failure_with_logfile $anaconda_logdir/patches_rpmget.log
wget --mirror --no-parent --no-host-directories --reject 'index.html*' --cut-dirs=$patches_cut_dirs $patches_url/repodata/ -o $anaconda_logdir/patches_rpmget_repo.log \
wget ${NOVERIFYSSL_WGET_OPT} --mirror --no-parent --no-host-directories --reject 'index.html*' \
--cut-dirs=$patches_cut_dirs $patches_url/repodata/ -o $anaconda_logdir/patches_rpmget_repo.log \
|| report_post_failure_with_logfile $anaconda_logdir/patches_rpmget_repo.log
mkdir -p /opt/patching/metadata
mkdir -p /opt/patching/packages/xxxPLATFORM_RELEASExxx
cd /opt/patching
wget --mirror --no-parent --no-host-directories --reject 'index.html*' --cut-dirs=$patches_cut_dirs $patches_url/metadata/ -o $anaconda_logdir/patches_rpmget_metadata.log \
wget ${NOVERIFYSSL_WGET_OPT} --mirror --no-parent --no-host-directories --reject 'index.html*' \
--cut-dirs=$patches_cut_dirs $patches_url/metadata/ -o $anaconda_logdir/patches_rpmget_metadata.log \
|| report_post_failure_with_logfile $anaconda_logdir/patches_rpmget_metadata.log
find /www/pages/updates/rel-xxxPLATFORM_RELEASExxx/Packages -name '*.rpm' \
| xargs --no-run-if-empty -I files cp --preserve=all files /opt/patching/packages/xxxPLATFORM_RELEASExxx/