metal/bsp-files/kickstarts/post_pxeboot_controller.cfg
Shrikumar Sharma f31cd0b255 Copying the package_checksums file to
<platform_release>_packages_list.txt

The prestaging operation on the system controller requires the list
of packages and their checksums in a file named
"<platform_release>_packages_list.txt", where <software_version> is
the version of the system controller (i.e. the new version which the
subclouds are being upgraded to).

The list of packages and their checksums is obtained from different
sources as a file named "package_checksums". This file should be
copied to /usr/local/share/pkg-list as
<platform_release>_packages_list.txt. It is currently copied as
package_checksums.

This fix copies the file "package_checksums" to
/usr/local/share/pkg-list as <platform_release>_packages_list.txt.

Test Plan:

PASS: Verify that package_checksums is copied to
      /usr/local/share/pkg-list as <platform_release>_packages_list.txt
      when upgrading the system controller to a higher version.

PASS: Verify that package_checksums is copied to
      /usr/local/share/pkg-list as <platform_release>_packages_list.txt
      when installing a controller over pxeboot

PASS: Verify that package_checksums is copied to
      /usr/local/share/pkg-list as <platform_release>_packages_list.txt
      when adding a subcloud from the system controller (using dcmanager
      add)

PASS: Verify that package_checksums is copied to
      /usr/local/share/pkg-list as <platform_release>_packages_list.txt
      when installing a system controller in virtualbox from
      bootimage.iso.

Closes-Bug: 1978420
Signed-off-by: Shrikumar Sharma <shrikumar.sharma@windriver.com>
Change-Id: I6270a7c9169718b2096a83135eeadb634d37b76b
2022-06-13 13:55:22 -04:00

161 lines
5.5 KiB
INI

%pre --erroronfail
# Source common functions
. /tmp/ks-functions.sh
echo "repo --name=base --baseurl=xxxHTTP_URLxxx/" > /tmp/repo-include
echo "repo --name=updates --baseurl=xxxHTTP_URLxxx/patches/" > /tmp/repo-include
%end
# Repository arguments from %pre
%include /tmp/repo-include
%post --erroronfail
# Source common functions
. /tmp/ks-functions.sh
# Obtain the boot interface from the PXE boot
BOOTIF=$(cat /proc/cmdline |xargs -n1 echo |grep BOOTIF=)
BOOTIF=${BOOTIF#BOOTIF=}
mgmt_dev=none
if [ -n "$BOOTIF" ] ; then
BOOTIF=$(echo $BOOTIF | sed -r -e 's/.*(..-..-..-..-..-..)$/\1/' -e 's/-/:/g')
ndev=$(ip -br link | awk -v mac="$BOOTIF" '$0 ~ mac {print $1}')
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
# 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 default http port number to platform configuration. This
# will get overwritten when config_controller is run.
echo http_port=8080 >> /etc/platform/platform.conf
# Build networking scripts
cat << EOF > /etc/sysconfig/network-scripts/ifcfg-lo
DEVICE=lo
IPADDR=127.0.0.1
NETMASK=255.0.0.0
NETWORK=127.0.0.0
BROADCAST=127.255.255.255
ONBOOT=yes
IPV6_AUTOCONF=no
NAME=loopback
EOF
%end
%post --erroronfail
# Source common functions
. /tmp/ks-functions.sh
KS="pxeboot post:"
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
FEED_DIR=/var/www/pages/feed/rel-xxxPLATFORM_RELEASExxx
mkdir -p ${FEED_DIR}/Packages
mkdir -p ${FEED_DIR}/repodata
cd ${FEED_DIR}
feed_url=xxxHTTP_URLxxx
declare -i cut_dirs=NUM_DIRS
# download the package_checksums file if /mnt/sysimage is mounted
if [ mountpoint -q /mnt/sysimage ]; then
wlog "${KS} Downloading package_checksums from controller"
cksum_file="package_checksums"
pkg_file="xxxPLATFORM_RELEASExxx_packages_list.txt"
pkg_file_loc=/mnt/sysimage/usr/local/share/pkg-list
if [ ! -d ${pkg_file_loc} ]; then
mkdir -p ${pkg_file_loc}
fi
wlog "${KS} Downloading ${cksum_file} from ${feed_url} to ${pkg_file_loc}/${pkg_file}"
wget ${NOVERIFYSSL_WGET_OPT} -O ${pkg_file_loc}/${pkg_file} ${feed_url}/${pkg_file} \
-o $anaconda_logdir/${pkg_file}.log \
|| wlog "${KS} Failed to download packages list from controller"
wlog "${KS} Copying ${pkg_file_loc}/${pkg_file} to ${FEED_DIR}/${cksum_file}"
cp ${pkg_file_loc}/${pkg_file} ${FEED_DIR}/${cksum_file}
fi
echo "Mirroring software repository (may take several minutes)..." >/dev/console
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 ${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
echo "Done" >/dev/console
patches_url=xxxHTTP_URLxxx/patches
wget ${NOVERIFYSSL_WGET_OPT} -q --spider ${patches_url}/
if [ $? -eq 0 ]; then
echo "Downloading patches..." >/dev/console
cd /var/www/pages
mkdir -p updates/rel-xxxPLATFORM_RELEASExxx/Packages
mkdir -p updates/rel-xxxPLATFORM_RELEASExxx/repodata
cd updates/rel-xxxPLATFORM_RELEASExxx
declare -i patches_cut_dirs=$((cut_dirs+1))
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 ${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 ${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 /var/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/
echo "Done" >/dev/console
fi
# Create a uuid specific to this installation
INSTALL_UUID=`uuidgen`
echo $INSTALL_UUID > /var/www/pages/feed/rel-xxxPLATFORM_RELEASExxx/install_uuid
echo "INSTALL_UUID=$INSTALL_UUID" >> /etc/platform/platform.conf
%end