Files
Lindley Vieira 51ed9820f7 Run post-install script before and after reboot
This change runs the post-install script before and after the reboot
for all reboot-required patches. And it passes an argument to the
script indicating if it is running before or after.

Also adds a pre-install and a post-install script boilerplate to make
them standard across multiple patches.

Test-Plan:
PASS: Run a patch without a post-install script.
PASS: (SX/DX) Run a RR patch with a post-install script
      running functions both before and after reboot.
PASS: Run an inservice patch with a post-install script.
PASS: A failure in the install script should fail the deploy.
PASS: Run pre-bootstrap a patch with a post-install script.
PASS: Remove a RR patch with a post-install script
      running functions both before and after reboot.

Story: 2010676
Task: 53590

Change-Id: Ib80282de17d9160a792749adba4ddcbc19cd5c38
Signed-off-by: Lindley Vieira <lindley.vieira@windriver.com>
2026-01-16 10:50:47 -05:00

30 lines
753 B
Bash

#!/bin/bash
#
# Copyright (c) 2026 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
# import common functions and constants
# file in update/software/service-files/software-functions
. /etc/software/software-functions
running="$BEFORE_REBOOT"
if [ -n "$1" ]; then
running="$1"
fi
loginfo "### Start of post-install script running $running ###"
if [[ "$running" == "$BEFORE_REBOOT" ]]; then
loginfo "Running script before reboot (or in-service)"
# Put commands to run before reboot here
else
loginfo "Running script after reboot"
# Put commands to run after reboot here
fi
loginfo "### End of post-install script ###"
exit $PATCH_STATUS_OK # in case of success
# exit $PATCH_STATUS_FAILED # in case of an error