metal/bsp-files/kickstarts/post_usb_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

134 lines
3.9 KiB
INI

%pre --erroronfail
# Source common functions
. /tmp/ks-functions.sh
if [ -d /mnt/install/source ]; then
srcdir=/mnt/install/source
else
srcdir=/run/install/repo
fi
touch /tmp/repo-include
if [ -d ${srcdir}/patches ]; then
echo "repo --name=updates --baseurl=file://${srcdir}/patches/" > /tmp/repo-include
fi
%end
# Repository arguments from %pre
%include /tmp/repo-include
%post --erroronfail
# Source common functions
. /tmp/ks-functions.sh
mgmt_dev=none
# 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
# 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
# Note, this section is different and replaced with a wget
# if doing the initial install off the network
%post --nochroot
. /tmp/ks-functions.sh
KS="usb post:"
if [ -d /mnt/install/source ]; then
srcdir=/mnt/install/source
else
srcdir=/run/install/repo
fi
cksum_file="package_checksums"
pkg_dir=/mnt/sysimage/usr/local/share/pkg-list
pkg_list_file="xxxPLATFORM_RELEASExxx_packages_list.txt"
feed_dir=/mnt/sysimage/var/www/pages/feed/rel-xxxPLATFORM_RELEASExxx/
if [ ! mountpoint -q /mnt/sysimage ]; then
wlog "${KS} /mnt/sysimage not mounted. The installation will fail."
exit -1
fi
if [ ! -d ${pkg_dir} ]; then
mkdir -p ${pkg_dir}
fi
# Copy the package checksums to both the feed_dir as well as /usr/local/share/pkg-list
if [ -f ${srcdir}/${cksum_file} ]; then
wlog "${KS} copying ${srcdir}/${cksum_file} to ${pkg_dir}/${pkg_list_file}"
cp ${srcdir}/${cksum_file} ${pkg_dir}/${pkg_list_file}
wlog "${KS} copying ${srcdir}/${cksum_file} to ${feed_dir}/${cksum_file}"
cp ${srcdir}/${cksum_file} ${feed_dir}/${cksum_file}
fi
if [ -d $srcdir/Packages ] ; then
mkdir -p /mnt/sysimage/var/www/pages/feed/rel-xxxPLATFORM_RELEASExxx
cp -r $srcdir/Packages /mnt/sysimage/var/www/pages/feed/rel-xxxPLATFORM_RELEASExxx/Packages
cp -r $srcdir/repodata /mnt/sysimage/var/www/pages/feed/rel-xxxPLATFORM_RELEASExxx/repodata
fi
if [ -d $srcdir/patches ]; then
mkdir -p /mnt/sysimage/var/www/pages/updates/rel-xxxPLATFORM_RELEASExxx
cp -r $srcdir/patches/Packages /mnt/sysimage/var/www/pages/updates/rel-xxxPLATFORM_RELEASExxx/Packages
cp -r $srcdir/patches/repodata /mnt/sysimage/var/www/pages/updates/rel-xxxPLATFORM_RELEASExxx/repodata
mkdir -p /mnt/sysimage/opt/patching
cp -r $srcdir/patches/metadata /mnt/sysimage/opt/patching/metadata
mkdir -p /mnt/sysimage/opt/patching/packages/xxxPLATFORM_RELEASExxx
find /mnt/sysimage/var/www/pages/updates/rel-xxxPLATFORM_RELEASExxx/Packages -name '*.rpm' \
| xargs --no-run-if-empty -I files cp --preserve=all files /mnt/sysimage/opt/patching/packages/xxxPLATFORM_RELEASExxx/
fi
# Create a uuid specific to this installation
INSTALL_UUID=`uuidgen`
echo $INSTALL_UUID > /mnt/sysimage/var/www/pages/feed/rel-xxxPLATFORM_RELEASExxx/install_uuid
echo "INSTALL_UUID=$INSTALL_UUID" >> /mnt/sysimage/etc/platform/platform.conf
%end
%post
# This is a USB install, so set ONBOOT=yes for network devices.
# Doing this in the %post so we don't unintentionally setup a
# network device during the installation.
for f in /etc/sysconfig/network-scripts/ifcfg-*; do
if grep -q '^ONBOOT=' ${f}; then
sed -i 's/^ONBOOT=.*/ONBOOT=yes/' ${f}
else
echo "ONBOOT=yes" >> ${f}
fi
if grep -q '^IPV6_AUTOCONF=' ${f}; then
sed -i 's/^IPV6_AUTOCONF=.*/IPV6_AUTOCONF=no/' ${f}
else
echo "IPV6_AUTOCONF=no" >> ${f}
fi
done
%end