dualboot: update-firmware: new script option ('-s')

This option combined with '-a' ('--active') only prints the active block: a or b

The purpose an output to be consumed by other scripts or programs.

https://onedigi.atlassian.net/browse/DEL-8399

Signed-off-by: Tatiana Leon <Tatiana.Leon@digi.com>
This commit is contained in:
Tatiana Leon 2023-03-28 11:03:27 +02:00
parent 556bda6d57
commit 1b17e8f657
1 changed files with 11 additions and 1 deletions

View File

@ -25,6 +25,7 @@ VERBOSE=""
PUBLIC_KEY="/etc/ssl/certs/key.pub"
ACTIVE_SYSTEM="$(fw_printenv -n active_system 2>/dev/null)"
SHOW_ACTIVE_SYSTEM=0
SCRIPT_MODE=0
REBOOT=1
UPDATE_FILE=""
ALT_BOOT=""
@ -48,7 +49,14 @@ EOF
}
show_active_system() {
echo "Active system is $(echo ${ACTIVE_SYSTEM} | cut -d'_' -f2 | tr [:lower:] [:upper:])"
local act_sys="$(echo ${ACTIVE_SYSTEM} | cut -d'_' -f2)"
if [ ${SCRIPT_MODE} -eq 0 ]; then
act_sys="$(echo ${act_sys} | tr [:lower:] [:upper:])"
echo "Active system is ${act_sys}"
else
echo "${act_sys}"
fi
}
reboot_system() {
@ -157,6 +165,8 @@ while :; do
;;
--no-reboot) REBOOT=0
;;
-s) SCRIPT_MODE=1
;;
-v|--verbose) VERBOSE="-v"
;;
-h|--help) usage;exit