Shrikumar Sharma f31cd0b255 Copying the package_checksums file to
<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
2022-06-13 13:55:22 -04:00

80 lines
1.9 KiB
Bash

#!/bin/bash
# Copyright (c) 2015-2017 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
trap cleanup 0
SCRIPT_DIR=$(dirname $0)
ISO_DIR=$(dirname $SCRIPT_DIR)
source $SCRIPT_DIR/version
source /etc/build.info
FEED_DIR=/www/pages/feed/rel-$VERSION
CURRENT_FEED_DIR=/www/pages/feed/rel-$SW_VERSION
TMP_RPM=/tmp/cpio
rm -rf $TMP_RPM
rm -rf $FEED_DIR
mkdir -p $FEED_DIR
cp -rp $ISO_DIR/Packages $ISO_DIR/repodata $ISO_DIR/LiveOS $FEED_DIR/
cp -p $CURRENT_FEED_DIR/install_uuid $FEED_DIR/
if [ -d $ISO_DIR/patches ]; then
mkdir -p /www/pages/updates/rel-${VERSION}
cp -r ${ISO_DIR}/patches/Packages ${ISO_DIR}/patches/repodata /www/pages/updates/rel-${VERSION}/
rsync -ac ${ISO_DIR}/patches/metadata/ /opt/patching/metadata/
mkdir -p /opt/patching/packages/${VERSION}
find /www/pages/updates/rel-${VERSION}/Packages -name '*.rpm' \
| xargs --no-run-if-empty -I files cp --preserve=all files /opt/patching/packages/${VERSION}/
fi
# copy package checksum if it exists
PKG_FILE="package_checksums"
PKG_FILE_LOC=/usr/local/share/pkg-list
if [ -f ${ISO_DIR}/${PKG_FILE} ]; then
DEST_PKG_FILE="${VERSION}_packages_list.txt"
if [ ! -d ${PKG_FILE_LOC} ]; then
mkdir -p ${PKG_FILE_LOC}
fi
cp ${ISO_DIR}/${PKG_FILE} ${PKG_FILE_LOC}/${DEST_PKG_FILE}
cp ${ISO_DIR}/${PKG_FILE} ${FEED_DIR}/${PKG_FILE}
fi