
<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
105 lines
4.0 KiB
INI
105 lines
4.0 KiB
INI
%post --erroronfail
|
|
|
|
# Source common functions
|
|
. /tmp/ks-functions.sh
|
|
|
|
http_port=$(get_http_port)
|
|
# Retrieve the installation uuid from the controller we booted from
|
|
INSTALL_UUID=`curl -sf http://pxecontroller:${http_port:-8080}/feed/rel-xxxPLATFORM_RELEASExxx/install_uuid`
|
|
if [ $? -ne 0 ]
|
|
then
|
|
INSTALL_UUID=unknown
|
|
fi
|
|
|
|
grep -q INSTALL_UUID /etc/platform/platform.conf
|
|
if [ $? -ne 0 ]; then
|
|
echo "INSTALL_UUID=$INSTALL_UUID" >> /etc/platform/platform.conf
|
|
fi
|
|
|
|
cd /var/www/pages
|
|
# Sync software repository
|
|
feed_url=http://pxecontroller:${http_port:-8080}/feed/
|
|
anaconda_logdir=/var/log/anaconda
|
|
mkdir -p $anaconda_logdir
|
|
|
|
pkg_file_loc=/usr/local/share/pkg-list
|
|
cksum_file="package_checksums"
|
|
pkg_file="xxxPLATFORM_RELEASExxx_packages_list.txt"
|
|
FEED_DIR=/var/www/pages/feed/rel-xxxPLATFORM_RELEASExxx
|
|
|
|
if [ ! -f ${pkg_file_loc} ]; then
|
|
mkdir -p ${pkg_file_loc}
|
|
fi
|
|
|
|
echo "Retrieving ${cksum_file} and writing to ${pkg_file_loc}/${pkg_file}" >/dev/console
|
|
curl ${feed_url}/rel-xxxPLATFORM_RELEASExxx/${cksum_file} \
|
|
-o ${pkg_file_loc}/${pkg_file}
|
|
|
|
# If the feed directory does not exist, create it now.
|
|
# The package checksums must be copied to it.
|
|
if [ ! -d ${FEED_DIR} ]; then
|
|
mkdir -p ${FEED_DIR}
|
|
fi
|
|
echo "Copying ${pkg_file_loc}/${pkg_file} to ${FEED_DIR}/${cksum_file}"
|
|
cp ${pkg_file_loc}/${pkg_file} ${FEED_DIR}/${cksum_file}
|
|
|
|
|
|
echo "Mirroring software repository (may take several minutes)..." >/dev/console
|
|
wget --recursive --no-parent --no-host-directories --no-clobber --reject 'index.html*' --reject '*.log' $feed_url/ -o $anaconda_logdir/wget-feed-mirror.log \
|
|
|| report_post_failure_with_logfile $anaconda_logdir/wget-feed-mirror.log
|
|
|
|
# Sync patching repository
|
|
updates_url=http://pxecontroller:${http_port:-8080}/updates/
|
|
wget --mirror --no-parent --no-host-directories --reject 'index.html*' --reject '*.log' $updates_url/ -o $anaconda_logdir/wget-updates-mirror.log \
|
|
|| report_post_failure_with_logfile $anaconda_logdir/wget-updates-mirror.log
|
|
echo "Done" >/dev/console
|
|
|
|
shopt -s nullglob
|
|
|
|
if [ "$(curl -sf http://pxecontroller:6385/v1/upgrade/$(hostname)/upgrade_in_progress 2>/dev/null)" = "true" ]; then
|
|
# Check whether a second release is installed
|
|
. /etc/build.info
|
|
CURRENT_REL_DIR=rel-${SW_VERSION}
|
|
OTHER_REL_DIR=
|
|
for REL_DIR in /var/www/pages/feed/*; do
|
|
if [[ ! $REL_DIR =~ "${SW_VERSION}" ]]; then
|
|
OTHER_REL_DIR=`basename $REL_DIR`
|
|
OTHER_REL_VERSION=${OTHER_REL_DIR:4}
|
|
break
|
|
fi
|
|
done
|
|
|
|
# If second release is installed, find the latest version of the installer
|
|
# RPM and install the pxeboot files we require to boot hosts with that release.
|
|
if [ ! -z "$OTHER_REL_DIR" ]; then
|
|
PATCH_RPM=`find /var/www/pages/updates/${OTHER_REL_DIR}/Packages -name 'pxe-network-installer*' | sort -V | tail -1`
|
|
BASE_RPM=`find /var/www/pages/feed/${OTHER_REL_DIR}/Packages -name 'pxe-network-installer*' | sort -V | tail -1`
|
|
|
|
if [ ! -z "$PATCH_RPM" ]; then
|
|
INSTALL_RPM=$PATCH_RPM
|
|
elif [ ! -z "$BASE_RPM" ]; then
|
|
INSTALL_RPM=$BASE_RPM
|
|
else
|
|
report_post_failure_with_msg "ERROR: Unable to find pxe-network-installer RPM for $OTHER_REL_DIR. Aborting installation."
|
|
fi
|
|
|
|
echo "Installing pxeboot files for release $OTHER_REL_DIR from $INSTALL_RPM" >/dev/console
|
|
TMP_RPM=/tmp/pxe-network-installer
|
|
mkdir $TMP_RPM
|
|
pushd $TMP_RPM
|
|
/usr/bin/rpm2cpio $INSTALL_RPM | cpio -idm \
|
|
|| report_post_failure_with_msg "Failed to extract pxe-network-installer"
|
|
|
|
cp -r $TMP_RPM/usr / \
|
|
|| report_post_failure_with_msg "Failed to copy pxe-network-installer /usr"
|
|
cp -r $TMP_RPM/pxeboot/$OTHER_REL_DIR /var/pxeboot/ \
|
|
|| report_post_failure_with_msg "Failed to copy pxe-network-installer /var/pxeboot/$OTHER_REL_DIR"
|
|
cp $TMP_RPM/pxeboot/pxelinux.cfg.files/*-$OTHER_REL_VERSION /var/pxeboot/pxelinux.cfg.files/ \
|
|
|| report_post_failure_with_msg "Failed to copy pxe-network-installer pxelinux.cfg files"
|
|
|
|
rm -rf $TMP_RPM
|
|
fi
|
|
fi
|
|
|
|
%end
|