From 197e9440922ed01a30261c52af1775125b0440af Mon Sep 17 00:00:00 2001 From: junfeng-li Date: Tue, 4 Jun 2024 13:54:21 +0000 Subject: [PATCH] Remove legacy upgrade code This commit is to remove legacy upgrade code in update 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: 50259 Story: 2010676 Change-Id: If2020a6f529ab478f4bd048fdf7c14e9bf462ed6 Signed-off-by: junfeng-li --- cgcs-patch/bin/upgrade-start-pkg-extract | 153 ------------------ cgcs-patch/centos/cgcs-patch.spec | 2 - sw-patch/bin/upgrade-start-pkg-extract | 153 ------------------ .../deb_folder/cgcs-patch-controller.install | 1 - sw-patch/debian/deb_folder/rules | 2 - 5 files changed, 311 deletions(-) delete mode 100644 cgcs-patch/bin/upgrade-start-pkg-extract delete mode 100644 sw-patch/bin/upgrade-start-pkg-extract diff --git a/cgcs-patch/bin/upgrade-start-pkg-extract b/cgcs-patch/bin/upgrade-start-pkg-extract deleted file mode 100644 index 5b50b70c..00000000 --- a/cgcs-patch/bin/upgrade-start-pkg-extract +++ /dev/null @@ -1,153 +0,0 @@ -#!/bin/bash -# -# Copyright (c) 2018-2021 Wind River Systems, Inc. -# -# SPDX-License-Identifier: Apache-2.0 -# - -function show_usage() -{ - cat >&2 < - -This tool will extract required packages to support upgrade-start - -Options: - -r : Release ID for target release. - -EOF - exit 1 -} - -. /etc/build.info -if [ -z "${SW_VERSION}" ]; then - logger -t $0 "Unable to identify running release ID" - exit 1 -fi - -declare TGT_RELEASE= - -while getopts "r:h" opt; do - case $opt in - r) - TGT_RELEASE=$OPTARG - ;; - h) - show_usage - ;; - *) - logger -t $0 "Unsupported option" - show_usage - ;; - esac -done - -if [ -z "${TGT_RELEASE}" ]; then - logger -t $0 "You must specify the target release." - exit 1 -fi - -if [ "${TGT_RELEASE}" = "${SW_VERSION}" ]; then - logger -t $0 "Target release cannot be running release." - exit 1 -fi - -declare TGT_BASE_REPO=/var/www/pages/feed/rel-${TGT_RELEASE} -declare TGT_PATCHES_REPO=/var/www/pages/updates/rel-${TGT_RELEASE} - -if [ ! -d ${TGT_BASE_REPO} ]; then - logger -t $0 "Target release ${TGT_RELEASE} is not installed" - exit 1 -fi - -# Copy files to destination folders on Debian -if [ -d "${TGT_BASE_REPO}/ostree_repo/" ]; then - rsync -ac ${TGT_BASE_REPO}/kickstart/kickstart.cfg ${TGT_BASE_REPO}/ && - rsync -ac ${TGT_BASE_REPO}/pxeboot/bzImage* /var/pxeboot/rel-${TGT_RELEASE}/ && - rsync -ac ${TGT_BASE_REPO}/pxeboot/initrd* /var/pxeboot/rel-${TGT_RELEASE}/ && - rsync -ac ${TGT_BASE_REPO}/pxeboot/pxelinux.cfg.files/*-${TGT_RELEASE} /var/pxeboot/pxelinux.cfg.files/ - rsync -ac ${TGT_BASE_REPO}/upgrades/pxeboot-update-${TGT_RELEASE}.sh /usr/sbin/ - - if [ $? -ne 0 ]; then - logger -t $0 "rsync command failed on Debian extracting" - exit 1 - fi - exit 0 -fi - -# The code below is only used on CentOS and will be removed when CentOS is no longer supported. -declare TGT_PATCHES_REPO_OPT="" -if [ -d ${TGT_PATCHES_REPO} ]; then - TGT_PATCHES_REPO_OPT="--repofrompath updates,${TGT_PATCHES_REPO}" -fi - -declare WORKDIR= - -function cleanup() { - if [ -n "${WORKDIR}" -a -d "${WORKDIR}" ]; then - rm -rf ${WORKDIR} - fi -} - -trap cleanup EXIT - -function extract_pkg() { - local pkgname=$1 - - ORIG_PWD=$PWD - cd $WORKDIR - - # Find the RPM - local pkgfile=$(dnf repoquery --disablerepo=* --repofrompath base,${TGT_BASE_REPO} ${TGT_PATCHES_REPO_OPT} --latest-limit=1 --location -q ${pkgname}) - if [ -z "${pkgfile}" ]; then - logger -t $0 "Could not find ${pkgname}" - exit 1 - fi - - # Chop off the file: from the start of the file location - local rpmfile=${pkgfile/file://} - - rpm2cpio ${rpmfile} | cpio -idm - if [ $? -ne 0 ]; then - logger -t $0 "Failed to extract $pkgname files from ${pkgfile/file://}" - exit 1 - fi - - cd ${ORIG_PWD} -} - -# Extract files from pxe-network-installer -WORKDIR=$(mktemp -d --tmpdir=/scratch pkgextract_XXXX) -if [ -z "${WORKDIR}" -o ! -d "${WORKDIR}" ]; then - logger -t $0 "Failed to create workdir" - exit 1 -fi -# Clean dnf cache in case a previous load had different package versions -dnf clean expire-cache -extract_pkg pxe-network-installer -rsync -ac ${WORKDIR}/usr/ /usr/ && -rsync -ac ${WORKDIR}/var/pxeboot/rel-${TGT_RELEASE}/ /var/pxeboot/rel-${TGT_RELEASE}/ && -rsync -c ${WORKDIR}/var/pxeboot/pxelinux.cfg.files/*-${TGT_RELEASE} /var/pxeboot/pxelinux.cfg.files/ && -rsync -ac ${WORKDIR}/var/www/pages/feed/rel-${TGT_RELEASE}/ /var/www/pages/feed/rel-${TGT_RELEASE}/ -if [ $? -ne 0 ]; then - logger -t $0 "rsync command failed, extracting pxe-network-installer" - exit 1 -fi -rm -rf ${WORKDIR} - -# Extract files from platform-kickstarts -WORKDIR=$(mktemp -d --tmpdir=/scratch pkgextract_XXXX) -if [ -z "${WORKDIR}" -o ! -d "${WORKDIR}" ]; then - logger -t $0 "Failed to create workdir" - exit 1 -fi -extract_pkg platform-kickstarts -rsync -ac ${WORKDIR}/var/www/pages/feed/rel-${TGT_RELEASE}/ /var/www/pages/feed/rel-${TGT_RELEASE}/ -if [ $? -ne 0 ]; then - logger -t $0 "rsync command failed, extracting platform-kickstarts" - exit 1 -fi -rm -rf ${WORKDIR} - -exit 0 - diff --git a/cgcs-patch/centos/cgcs-patch.spec b/cgcs-patch/centos/cgcs-patch.spec index 061b475a..2af9e44e 100644 --- a/cgcs-patch/centos/cgcs-patch.spec +++ b/cgcs-patch/centos/cgcs-patch.spec @@ -105,8 +105,6 @@ install -m 555 ${RPM_BUILD_DIR}/%{name}-%{version}/bin/patch_check_goenabled.sh install -m 444 ${RPM_BUILD_DIR}/%{name}-%{version}/bin/patching.logrotate \ %{buildroot}%{_sysconfdir}/logrotate.d/patching -install -m 500 ${RPM_BUILD_DIR}/%{name}-%{version}/bin/upgrade-start-pkg-extract \ - %{buildroot}%{_sbindir}/upgrade-start-pkg-extract %clean rm -rf $RPM_BUILD_ROOT diff --git a/sw-patch/bin/upgrade-start-pkg-extract b/sw-patch/bin/upgrade-start-pkg-extract deleted file mode 100644 index 5b50b70c..00000000 --- a/sw-patch/bin/upgrade-start-pkg-extract +++ /dev/null @@ -1,153 +0,0 @@ -#!/bin/bash -# -# Copyright (c) 2018-2021 Wind River Systems, Inc. -# -# SPDX-License-Identifier: Apache-2.0 -# - -function show_usage() -{ - cat >&2 < - -This tool will extract required packages to support upgrade-start - -Options: - -r : Release ID for target release. - -EOF - exit 1 -} - -. /etc/build.info -if [ -z "${SW_VERSION}" ]; then - logger -t $0 "Unable to identify running release ID" - exit 1 -fi - -declare TGT_RELEASE= - -while getopts "r:h" opt; do - case $opt in - r) - TGT_RELEASE=$OPTARG - ;; - h) - show_usage - ;; - *) - logger -t $0 "Unsupported option" - show_usage - ;; - esac -done - -if [ -z "${TGT_RELEASE}" ]; then - logger -t $0 "You must specify the target release." - exit 1 -fi - -if [ "${TGT_RELEASE}" = "${SW_VERSION}" ]; then - logger -t $0 "Target release cannot be running release." - exit 1 -fi - -declare TGT_BASE_REPO=/var/www/pages/feed/rel-${TGT_RELEASE} -declare TGT_PATCHES_REPO=/var/www/pages/updates/rel-${TGT_RELEASE} - -if [ ! -d ${TGT_BASE_REPO} ]; then - logger -t $0 "Target release ${TGT_RELEASE} is not installed" - exit 1 -fi - -# Copy files to destination folders on Debian -if [ -d "${TGT_BASE_REPO}/ostree_repo/" ]; then - rsync -ac ${TGT_BASE_REPO}/kickstart/kickstart.cfg ${TGT_BASE_REPO}/ && - rsync -ac ${TGT_BASE_REPO}/pxeboot/bzImage* /var/pxeboot/rel-${TGT_RELEASE}/ && - rsync -ac ${TGT_BASE_REPO}/pxeboot/initrd* /var/pxeboot/rel-${TGT_RELEASE}/ && - rsync -ac ${TGT_BASE_REPO}/pxeboot/pxelinux.cfg.files/*-${TGT_RELEASE} /var/pxeboot/pxelinux.cfg.files/ - rsync -ac ${TGT_BASE_REPO}/upgrades/pxeboot-update-${TGT_RELEASE}.sh /usr/sbin/ - - if [ $? -ne 0 ]; then - logger -t $0 "rsync command failed on Debian extracting" - exit 1 - fi - exit 0 -fi - -# The code below is only used on CentOS and will be removed when CentOS is no longer supported. -declare TGT_PATCHES_REPO_OPT="" -if [ -d ${TGT_PATCHES_REPO} ]; then - TGT_PATCHES_REPO_OPT="--repofrompath updates,${TGT_PATCHES_REPO}" -fi - -declare WORKDIR= - -function cleanup() { - if [ -n "${WORKDIR}" -a -d "${WORKDIR}" ]; then - rm -rf ${WORKDIR} - fi -} - -trap cleanup EXIT - -function extract_pkg() { - local pkgname=$1 - - ORIG_PWD=$PWD - cd $WORKDIR - - # Find the RPM - local pkgfile=$(dnf repoquery --disablerepo=* --repofrompath base,${TGT_BASE_REPO} ${TGT_PATCHES_REPO_OPT} --latest-limit=1 --location -q ${pkgname}) - if [ -z "${pkgfile}" ]; then - logger -t $0 "Could not find ${pkgname}" - exit 1 - fi - - # Chop off the file: from the start of the file location - local rpmfile=${pkgfile/file://} - - rpm2cpio ${rpmfile} | cpio -idm - if [ $? -ne 0 ]; then - logger -t $0 "Failed to extract $pkgname files from ${pkgfile/file://}" - exit 1 - fi - - cd ${ORIG_PWD} -} - -# Extract files from pxe-network-installer -WORKDIR=$(mktemp -d --tmpdir=/scratch pkgextract_XXXX) -if [ -z "${WORKDIR}" -o ! -d "${WORKDIR}" ]; then - logger -t $0 "Failed to create workdir" - exit 1 -fi -# Clean dnf cache in case a previous load had different package versions -dnf clean expire-cache -extract_pkg pxe-network-installer -rsync -ac ${WORKDIR}/usr/ /usr/ && -rsync -ac ${WORKDIR}/var/pxeboot/rel-${TGT_RELEASE}/ /var/pxeboot/rel-${TGT_RELEASE}/ && -rsync -c ${WORKDIR}/var/pxeboot/pxelinux.cfg.files/*-${TGT_RELEASE} /var/pxeboot/pxelinux.cfg.files/ && -rsync -ac ${WORKDIR}/var/www/pages/feed/rel-${TGT_RELEASE}/ /var/www/pages/feed/rel-${TGT_RELEASE}/ -if [ $? -ne 0 ]; then - logger -t $0 "rsync command failed, extracting pxe-network-installer" - exit 1 -fi -rm -rf ${WORKDIR} - -# Extract files from platform-kickstarts -WORKDIR=$(mktemp -d --tmpdir=/scratch pkgextract_XXXX) -if [ -z "${WORKDIR}" -o ! -d "${WORKDIR}" ]; then - logger -t $0 "Failed to create workdir" - exit 1 -fi -extract_pkg platform-kickstarts -rsync -ac ${WORKDIR}/var/www/pages/feed/rel-${TGT_RELEASE}/ /var/www/pages/feed/rel-${TGT_RELEASE}/ -if [ $? -ne 0 ]; then - logger -t $0 "rsync command failed, extracting platform-kickstarts" - exit 1 -fi -rm -rf ${WORKDIR} - -exit 0 - diff --git a/sw-patch/debian/deb_folder/cgcs-patch-controller.install b/sw-patch/debian/deb_folder/cgcs-patch-controller.install index 9d03acfc..90311ab8 100644 --- a/sw-patch/debian/deb_folder/cgcs-patch-controller.install +++ b/sw-patch/debian/deb_folder/cgcs-patch-controller.install @@ -5,6 +5,5 @@ lib/systemd/system/sw-patch-controller-daemon.service usr/sbin/sw-patch usr/sbin/sw-patch-controller-daemon usr/sbin/sw-patch-controller-daemon-restart -usr/sbin/upgrade-start-pkg-extract usr/share/bash-completion/completions/sw-patch usr/share/starlingx/pmon.d/sw-patch-controller-daemon.conf diff --git a/sw-patch/debian/deb_folder/rules b/sw-patch/debian/deb_folder/rules index 0ff7bd1b..a6f04981 100755 --- a/sw-patch/debian/deb_folder/rules +++ b/sw-patch/debian/deb_folder/rules @@ -73,8 +73,6 @@ override_dh_install: ${DEBIAN_DESTDIR}/etc/goenabled.d/patch_check_goenabled.sh install -m 444 bin/patching.logrotate \ ${DEBIAN_DESTDIR}/etc/logrotate.d/patching - install -m 500 bin/upgrade-start-pkg-extract \ - ${DEBIAN_DESTDIR}/usr/sbin/upgrade-start-pkg-extract dh_install override_dh_python3: