d9d7111cd8
Details: Since this is the first Debian to Debian upgrade, we need to refactor some existing code that is used for centOS upgrade. This commit is 1. clean up CentOS related code 2. copy to-load pxeboot-update.sh to /etc/ during the import instead of /usr/sbin/ 3. install to-load pxeboot-update.sh in /etc/ instead of /usr/sbin/ during iso installation 4. update kickstart Upgrade Support accordingly to set up from-load feed Test Plan: PASS: built the iso for upgrade PASS: upgraded from 22.12 to 23.09 in DX PASS: downgrade from 23.09 to 22.12 in DX Depends-on: https://review.opendev.org/c/starlingx/tools/+/881882 Task: 47805 Story: 2010651 Signed-off-by: Junfeng (Shawn) Li <junfeng.li@windriver.com> Change-Id: Ia67f5f3e66f5b33c3d7fb8d93a15547d59eaa71e
87 lines
2.5 KiB
Bash
87 lines
2.5 KiB
Bash
#!/bin/bash
|
|
# Copyright (c) 2015-2022 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
|
|
|
|
SCRIPT_DIR=$(dirname $0)
|
|
ISO_DIR=$(dirname $SCRIPT_DIR)
|
|
|
|
source $SCRIPT_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/ \;
|
|
|
|
echo 'import has completed'
|