Files
update/software/debian/deb_folder/rules
Heitor Matsui 93c9834c8e Create boot counter management service
The commit [1] introduces a boot failure counter to boot.env,
so that a logic can be created to boot the system in the
rollback deployment if the system fails to boot the to-release
deployment during an upgrade.

This commit creates a very simple service to reset the boot
failure counter variable to 0 in boot.env when the system boots
successfully.

[1] https://review.opendev.org/c/starlingx/metal/+/952864

Test Plan
PASS: verify the system runs successfully during the boot
      sequence on the console
PASS: verify boot.env once the system boots successfully
      and confirm that boot_failure is set to 0
PASS: force boot failure, verify the boot_failure counter
      increment with [1], and verify the boot_failure is
      reset to 0 when the system boots
PASS: integrated test for automatic boot recovery (AIO-SX)
      1. upgrade host from stx-10 to stx-11 with LVM snapshot
         feature enabled
      2. force failure during the boot sequence (3x)
      3. system boots in the rollback deployment
      4. LVM snapshots are restored during the boot sequence
         and system is rebooted again
      5. system boots in from-release ready to 'deploy delete'

Story: 2011357
Task: 52428

Change-Id: Ida4d5c811b376018b2703ff0e89bb65697995b3f
Signed-off-by: Heitor Matsui <heitorvieira.matsui@windriver.com>
2025-06-26 17:10:21 -03:00

109 lines
4.5 KiB
Makefile
Executable File

#!/usr/bin/make -f
export DH_VERBOSE = 1
export PYBUILD_NAME = software
export PBR_VERSION=1.0.0
ROOT := $(CURDIR)/debian/tmp
PMONDIR := ${ROOT}/usr/share/starlingx/pmon.d
SBINDIR := ${ROOT}/usr/sbin
SCRIPTDIR := ${SBINDIR}/software-deploy
export PLATFORM_RELEASE="$(shell grep SW_VERSION /usr/include/build_info.h | cut -d ' ' -f 3)"
export METADATA_FILE="starlingx-${PLATFORM_RELEASE}.0-metadata.xml"
%:
dh $@ --with python3 --buildsystem=pybuild
override_dh_auto_build:
cp service-files/starlingx-GA-metadata.xml ${METADATA_FILE}
sed -i "s/xxxPLATFORM_RELEASExxx/${PLATFORM_RELEASE}/g" ${METADATA_FILE}
sed -i "s/xxxPLATFORM_RELEASExxx/${PLATFORM_RELEASE}/g" software/utilities/constants.py
override_dh_install:
python3 setup.py install -f --install-layout=deb --root=$(ROOT)
python3 setup.py bdist_wheel --universal -d $(CURDIR)/debian/$(PYBUILD_NAME)-wheels/usr/share/python-wheels
install -d -m 755 $(ROOT)/usr/bin
install -d -m 755 ${SBINDIR}
install -d -m 755 ${SCRIPTDIR}
install -d -m 755 $(ROOT)/run
install -m 755 -d ${ROOT}/etc/goenabled.d
install -m 755 -d ${ROOT}/etc/init.d
install -m 755 -d ${ROOT}/etc/logrotate.d
install -m 755 -d ${ROOT}/etc/software
install -m 755 -d ${ROOT}/etc/software/software-scripts
install -m 755 -d ${ROOT}/lib/systemd/system
install -m 755 -d ${ROOT}/var/persist/software-agent
install -m 755 -d ${PMONDIR}
install -m 500 service-files/software-controller-daemon-init.sh \
${ROOT}/etc/init.d/software-controller-daemon
install -m 500 service-files/software-agent-init.sh \
${ROOT}/etc/init.d/software-agent
install -m 500 service-files/software-init.sh \
${ROOT}/etc/init.d/software
install -m 500 service-files/software-controller-init.sh \
${ROOT}/etc/init.d/software-controller
install -m 500 service-files/usm-initialize-init.sh \
${ROOT}/etc/init.d/usm-initialize
install -m 500 service-files/lvm-snapshot-restore.sh \
${ROOT}/etc/init.d/lvm-snapshot-restore
install -m 500 service-files/reset-boot-counter.sh \
${ROOT}/etc/init.d/reset-boot-counter
install -m 600 service-files/software.conf \
${ROOT}/etc/software/software.conf
install -m 644 service-files/policy.json \
${ROOT}/etc/software/policy.json
install -m 444 service-files/pmon-software-controller-daemon.conf \
${PMONDIR}/software-controller-daemon.conf
install -m 444 service-files/pmon-software-agent.conf \
${PMONDIR}/software-agent.conf
install -m 444 service-files/*.service \
${ROOT}/lib/systemd/system
install -m 400 service-files/software-functions \
${ROOT}/etc/software/software-functions
install -m 444 service-files/software-tmpdirs.conf \
${ROOT}/run/software-tmpdirs.conf
install -m 500 service-files/run-software-scripts \
${SBINDIR}/run-software-scripts
install -m 500 service-files/software-controller-daemon-restart \
${SBINDIR}/software-controller-daemon-restart
install -m 500 service-files/software-agent-restart \
${SBINDIR}/software-agent-restart
install -m 555 service-files/software_check_goenabled.sh \
${ROOT}/etc/goenabled.d/software_check_goenabled.sh
install -m 444 service-files/software.logrotate \
${ROOT}/etc/logrotate.d/software
install -m 444 ${METADATA_FILE} \
${ROOT}/etc/software/${METADATA_FILE}
install -m 755 scripts/controllers-software-sync \
${SCRIPTDIR}/controllers-software-sync
install -m 755 scripts/deploy-precheck \
${SCRIPTDIR}/deploy-precheck
install -m 755 scripts/deploy-start \
${SCRIPTDIR}/deploy-start
install -m 444 scripts/upgrade_utils.py \
${SCRIPTDIR}/upgrade_utils.py
install -m 755 scripts/prepare-data-migration \
${SCRIPTDIR}/prepare-data-migration
install -m 755 scripts/prepare-chroot-mounts \
${SCRIPTDIR}/prepare-chroot-mounts
install -m 755 scripts/create-postgres-database \
${SCRIPTDIR}/create-postgres-database
install -m 755 scripts/major-release-upload \
${SCRIPTDIR}/major-release-upload
install -m 755 scripts/sync-controllers-feed \
${SCRIPTDIR}/sync-controllers-feed
install -m 755 scripts/remove-temporary-data \
${SCRIPTDIR}/remove-temporary-data
install -m 755 software/lvm_snapshot.py \
${SCRIPTDIR}/manage-lvm-snapshots
install -d -m 755 $(ROOT)/usr/local/share/upgrade.d
install -p -D -m 755 upgrade-scripts/* $(ROOT)/usr/local/share/upgrade.d
install -d -m 755 $(ROOT)/etc/update.d
# TODO(heitormatsui): following lines are for backward compatibility and can be removed in stx-12
cd ${SCRIPTDIR} ; ln -sf major-release-upload usm_load_import
cd ${SCRIPTDIR} ; ln -sf deploy-start software-deploy-start
dh_install
override_dh_usrlocal: