From 1b17e8f6573679b77a0a89a456b03ea00639a848 Mon Sep 17 00:00:00 2001 From: Tatiana Leon Date: Tue, 28 Mar 2023 11:03:27 +0200 Subject: [PATCH] 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 --- .../recipes-digi/dualboot/dualboot/update-firmware | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/meta-digi-dey/recipes-digi/dualboot/dualboot/update-firmware b/meta-digi-dey/recipes-digi/dualboot/dualboot/update-firmware index 063283242..eec6aad3e 100755 --- a/meta-digi-dey/recipes-digi/dualboot/dualboot/update-firmware +++ b/meta-digi-dey/recipes-digi/dualboot/dualboot/update-firmware @@ -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