update/software/service-files/software-functions
Jessica Castelino 276d3f071d Support install scripts for in-service patch
This commit adds support for
1) Post-install scripts for In-Service patches
2) Pre-install scripts for In-Service patches

Test Plan:
[PASS] Install scripts run before and after install
[PASS] Scripts are optional

Story: 2010676
Task: 49480
Change-Id: I6729798a59ac61c7eae395d8a3a3b425fe4e6f72
Signed-off-by: Jessica Castelino <jessica.castelino@windriver.com>
Signed-off-by: sshathee <shunmugam.shatheesh@windriver.com>
2024-05-23 05:54:10 -04:00

54 lines
1020 B
Plaintext

#
# Copyright (c) 2023 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
#
# This bash source file provides variables and functions that
# may be used by in-service patch scripts.
#
# Source platform.conf, for nodetype and subfunctions
. /etc/platform/platform.conf
declare PRE_INSTALL_SCRIPTDIR=/run/software/software-scripts/preinstall
declare POST_INSTALL_SCRIPTDIR=/run/software/software-scripts/postinstall
declare PATCH_FLAGDIR=/run/software/software-flags
declare -i PATCH_STATUS_OK=0
declare -i PATCH_STATUS_FAILED=1
declare logfile=/var/log/software.log
declare NAME=$(basename $0)
function loginfo()
{
echo "`date "+%FT%T.%3N"`: $NAME: $*" >> $logfile
}
function is_controller()
{
[[ $nodetype == "controller" ]]
}
function is_worker()
{
[[ $nodetype == "worker" ]]
}
function is_storage()
{
[[ $nodetype == "storage" ]]
}
function is_cpe()
{
[[ $nodetype == "controller" && $subfunction =~ worker ]]
}
function is_locked()
{
test -f /var/run/.node_locked
}