Remove legacy upgrade code

This commit is to remove legacy upgrade code in metal repo.
After removal, the USM is used for platform upgrade.

Test Plan:

PASS: build the iso
PASS: deploy iso in SX
PASS: deploy iso in DX

Task: 50230
Story: 2010676

Change-Id: I1f6d99369e79095789ea7a69731ec3e87bb609cf
Signed-off-by: junfeng-li <junfeng.li@windriver.com>
This commit is contained in:
junfeng-li 2024-06-13 15:01:42 +00:00
parent dbb9543c08
commit b63f47b165
3 changed files with 0 additions and 162 deletions

View File

@ -9,7 +9,6 @@ export ROOT=$(CURDIR)/debian/tmp
override_dh_install:
install -v -d -m 755 $(ROOT)/opt/upgrades
install -p -D -m 700 import.sh $(ROOT)/opt/upgrades/import.sh
install -p -D -m 600 metadata.xml $(ROOT)/opt/upgrades/metadata.xml
dh_install

View File

@ -1,100 +0,0 @@
#!/bin/bash
# Copyright (c) 2015-2023 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
# This script is run during the load-import command
# It is used to copy the required files from the iso to the
# controller.
set -e
exec 2>>/var/log/load-import.log
set -x
echo "$(date): Starting execution: $0 $@"
cleanup() {
rm -rf ${TMP_RPM}
}
rollback() {
rm -rf ${FEED_DIR}
}
error() {
local parent_lineno="$1"
local err_code="${2}"
echo "Error executing import script at line: ${parent_lineno} with error code: ${err_code}"
rollback
exit "${err_code}"
}
trap 'error ${LINENO} $?' ERR
if [ -n "$1" ]; then
# mount point of the ISO to be imported.
# This is to import inactive load (an older load)
ISO_DIR=$1
UPGRADES_DIR="${ISO_DIR}/upgrades"
else
UPGRADES_DIR=$(dirname $0)
ISO_DIR=$(dirname ${UPGRADES_DIR})
fi
source ${UPGRADES_DIR}/version
source /etc/build.info
FEED_DIR=/var/www/pages/feed/rel-${VERSION}
# Feed directory is different in 21.12 vs. 22.06
CURRENT_FEED_DIR=/var/www/pages/feed/rel-${SW_VERSION}
if [ ${SW_VERSION} == "21.12" ]; then
CURRENT_FEED_DIR=/www/pages/feed/rel-${SW_VERSION}
FEED_DIR=/www/pages/feed/rel-${VERSION}
fi
rm -rf ${FEED_DIR}
mkdir -p ${FEED_DIR}
# copy pxeboot, kickstart, ostree_repo to feed directory
echo "Copy kickstart to ${FEED_DIR}"
cp -rp ${ISO_DIR}/kickstart ${FEED_DIR}/
echo "Copy pxeboot to ${FEED_DIR}"
cp -rp ${ISO_DIR}/pxeboot ${FEED_DIR}/
echo "Copy ostree_repo to ${FEED_DIR}"
cp -rp ${ISO_DIR}/ostree_repo ${FEED_DIR}/
echo "Copy install_uuid to ${FEED_DIR}"
cp ${CURRENT_FEED_DIR}/install_uuid ${FEED_DIR}/
mkdir ${FEED_DIR}/upgrades
echo "Copy pxeboot-update-${VERSION}.sh to ${FEED_DIR}/upgrades"
cp ${ISO_DIR}/upgrades/pxeboot-update-${VERSION}.sh ${FEED_DIR}/upgrades/
echo "Copy efi.img to ${FEED_DIR}"
cp ${ISO_DIR}/efi.img ${FEED_DIR}/
# for upgrade from 22.06 to Debian 22.12, patch during upgrade is not supported
echo "Copy pxeboot-update-${SW_VERSION}.sh to ${CURRENT_FEED_DIR}/upgrades"
mkdir -p ${CURRENT_FEED_DIR}/upgrades/
# In stx 8.0, the pxeboot-update-22.12.sh is in /usr/sbin
# In stx 9.0, the pxeboot-update-23.09.sh is in /etc due to the ostree managed
# /usr directory.
cp -rp /usr/sbin/pxeboot-update-22.12.sh ${CURRENT_FEED_DIR}/upgrades/ 2>/dev/null || \
cp -rp /etc/pxeboot-update-${SW_VERSION}.sh ${CURRENT_FEED_DIR}/upgrades/
# The pxelinux.cfg.files directory is from the current release feed in Debian.
echo "Copy pxelinux.cfg.files directory to ${CURRENT_FEED_DIR}"
mkdir -p ${CURRENT_FEED_DIR}/pxeboot/pxelinux.cfg.files/
find /var/pxeboot/pxelinux.cfg.files -type f ! -name "*${VERSION}" \
-exec cp -p {} ${CURRENT_FEED_DIR}/pxeboot/pxelinux.cfg.files/ \;
if [ -d ${ISO_DIR}/patches ]; then
rsync --mkpath -ac ${ISO_DIR}/patches/ /opt/patching/metadata/committed/
# copy patch metadata to feed, so to be picked up by kickstart to copy to release N+1
mkdir ${CURRENT_FEED_DIR}/patches -p
cp -a ${ISO_DIR}/patches/* ${CURRENT_FEED_DIR}/patches/
fi
echo 'import has completed'

View File

@ -40,7 +40,6 @@
# Post - Set Kernel Args
# Post - Interface Setup
# Post - Kickstart Finalize Install UUID
# Post - Upgrade Support
# Post Nochroot - Restage OSTree repo
# - Save Install Scripts and Logs
# Post - Log Filesystem Setup
@ -2932,66 +2931,6 @@ true
%end
##########################################################################
%post --interpreter=/bin/bash --nochroot
HOOK_LABEL="post_nochroot"
. /tmp/lat/ks_functions.sh
ilog "****************************************************"
ilog "*** Post - Upgrade Support ***"
ilog "****************************************************"
# INSTALL_UUID was written into platform.conf in the Post - Kickstart Finalize Install UUID section
if [[ "${insturl}" == *"pxecontroller"* && "${insturl}" == *"http"* ]] ; then
http_port=$(echo $(cat /proc/cmdline |xargs -n1 echo |grep '^insturl=' | sed -r 's#^[^/]*://[^/]*:([0-9]*)/.*#\1#'))
else
http_port=8080
fi
cd ${IMAGE_ROOTFS}/var/www/pages
# Sync software repository
feed_url=http://pxecontroller:${http_port}/feed/
sw_release="xxxPLATFORM_RELEASExxx"
hostname="hostname"
if [ "$(curl -sf http://pxecontroller:6385/v1/upgrade/${hostname}/upgrade_in_progress 2>/dev/null)" = "true" ]; then
ilog "System upgrade in progress"
ilog "Mirroring software repository (may take several minutes)..."
wget --recursive --no-parent --no-host-directories --no-clobber --reject 'index.html*' --reject '*.log' \
-o /${LAT_DIR}/wget_sw_repo.log --exclude-directories=/feed/rel-${sw_release} ${feed_url} \
|| report_failure_with_msg "Mirroring software repository failed"
# Check whether a second release is installed
CURRENT_REL_DIR=rel-${sw_release}
OTHER_REL_DIR=$(find ${IMAGE_ROOTFS}/var/www/pages/feed/* -maxdepth 0 -type d ! -name *${sw_release}*)
OTHER_REL_VERSION=$(basename "${OTHER_REL_DIR}")
ilog "Installing pxeboot files for release ${OTHER_REL_DIR}"
mkdir -p ${IMAGE_ROOTFS}/var/pxeboot/${OTHER_REL_VERSION} \
|| report_failure_with_msg "Failed to create /var/pxeboot/${OTHER_REL_VERSION}"
cp -rp ${OTHER_REL_DIR}/kickstart/kickstart.cfg ${OTHER_REL_DIR}/ \
|| report_failure_with_msg "Failed to copy kickstart.cfg for to ${OTHER_REL_DIR}"
cp -rp ${OTHER_REL_DIR}/pxeboot/bzImage* ${IMAGE_ROOTFS}/var/pxeboot/${OTHER_REL_VERSION} \
|| report_failure_with_msg "Failed to copy pxeboot bzImage files for to /var/pxeboot/${OTHER_REL_VERSION}"
cp -rp ${OTHER_REL_DIR}/pxeboot/initrd* ${IMAGE_ROOTFS}/var/pxeboot/${OTHER_REL_VERSION} \
|| report_failure_with_msg "Failed to copy pxeboot initrd files for to /var/pxeboot/${OTHER_REL_VERSION}"
cp -rp ${OTHER_REL_DIR}/pxeboot/pxelinux.cfg.files/* ${IMAGE_ROOTFS}/var/pxeboot/pxelinux.cfg.files/ \
|| report_failure_with_msg "Failed to copy pxeboot pxelinux.cfg files for to /var/pxeboot/${OTHER_REL_VERSION}"
cp -rp ${OTHER_REL_DIR}/upgrades/pxeboot-update-${OTHER_REL_VERSION:4}.sh ${IMAGE_ROOTFS}/etc/ \
|| report_failure_with_msg "Failed to copy pxeboot-update-${OTHER_REL_VERSION:4}.sh to /etc/"
chmod 755 ${IMAGE_ROOTFS}/etc/pxeboot-update-${OTHER_REL_VERSION:4}.sh \
|| report_failure_with_msg "Failed to chmod 755 /etc/pxeboot-update-${OTHER_REL_VERSION:4}.sh"
fi
true
%end
##########################################################################
%post --interpreter=/bin/bash