f5c0ba9da4
When installing a release, the script was not getting executed,
on software.log we couldn't see the script output.
This is happening because run-software-scripts bash script is called
as follows `run-software-scripts preinstall` (or postinstall).
The run-software-scripts looks for executable files within PATCH_SCRIPTDIR/$1
but PATCH_SCRIPTDIR wasn't defined anywhere so it couldn't find the scripts.
This fix declares the PATCH_SCRIPTDIR, so the scripts are found
and executed as expected.
The legacy implementation (sw-patch) has a very similar mechanism and the
PATCH_SCRIPTDIR properly declared
7847f7087e/sw-patch/bin/patch-functions (L15)
Another minor issue is that the run-software-scripts doesn't properly
report when there are no scripts, creating a false impression that
the script was executed.
Test Plan:
SUCCESS: preinstall and postinstall script execution is triggered properly.
SUCCESS: run-software-scripts <folder_name> properly logs when no scripts are present
Closes-bug: 2070391
Change-Id: I91f315d29171a19f9b5c8c09db7c40465dcb49b6
Signed-off-by: caio-volpato <caio.volpato@windriver.com>
55 lines
1.0 KiB
Plaintext
55 lines
1.0 KiB
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 PATCH_SCRIPTDIR=/run/software/software-scripts
|
|
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
|
|
}
|
|
|