b2ef1f8c0a
Adapt filesystem usage to meet OSTree requirements relocating /pxeboot to /var/pxeboot Test Plan: PASS: CentOS -> CentOS upgrade: - 22.06 -> 22.12 Story: 2009303 Task: 45898 Signed-off-by: lbonatti <LuizEduardo.Bonatti@windriver.com> Change-Id: I30a35937cd6da1489e04fd1b0257f0fbe825af96
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/var/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/var/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
|