#!/bin/bash # # Copyright (c) 2023-2024 Wind River Systems, Inc. # # SPDX-License-Identifier: Apache-2.0 # . /etc/software/software-functions if [ -z "$1" ] then loginfo "No input parameter provided to identify script type." exit 0 fi declare DIR="${PATCH_SCRIPTDIR}/${1}" declare SCRIPTS=$(find $DIR -type f -executable | sort) if [ ${#SCRIPTS} -eq 0 ] then loginfo "No in-service patch scripts found at the directory ${DIR}" exit 0 fi declare -i NUM_SCRIPTS=$(echo "$SCRIPTS" | wc -l) loginfo "Running $NUM_SCRIPTS in-service patch scripts" declare SCRIPTLOG=/var/log/software.log cat <>$SCRIPTLOG ############################################################ `date "+%FT%T.%3N"`: Running $NUM_SCRIPTS install patch scripts: $SCRIPTS ############################################################ EOF declare -i FAILURES=0 for cmd in $SCRIPTS do cat <>$SCRIPTLOG ############################################################ `date "+%FT%T.%3N"`: Running $cmd EOF bash -x $cmd >>$SCRIPTLOG 2>&1 rc=$? if [ $rc -ne $PATCH_STATUS_OK ] then let -i FAILURES++ fi cat <>$SCRIPTLOG `date "+%FT%T.%3N"`: Completed running $cmd (rc=$rc) ############################################################ EOF done cat <>$SCRIPTLOG `date "+%FT%T.%3N"`: Completed running scripts with $FAILURES failures ############################################################ EOF exit $FAILURES