cli: add 'reboot' option to upgrade command

Usually, when upgrading a system, you want to reboot it so the upgrade
takes effect.  This commit adds a 'reboot' option/flag, alongside the
'force' option, to facilitate this.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg
2025-10-31 13:26:02 +01:00
parent ee37a19ab0
commit ee6def793c
+7 -1
View File
@@ -680,12 +680,18 @@
<COMMAND name="upgrade" help="Install a software update bundle from remote or local file">
<PARAM name="URI" ptype="/STRING" help="[(ftp|tftp|http|https|sftp)://(dns.name | ip.address)/path/to/]upgrade-bundle.pkg"/>
<SWITCH name="optional" min="0" max="1">
<SWITCH name="optional" min="0" max="2">
<COMMAND name="force" help="Force upgrade, ignoring compatibility check."/>
<COMMAND name="reboot" help="Reboot system after successful upgrade."/>
</SWITCH>
<ACTION sym="script" in="tty" out="tty" interrupt="true">
force=${KLISH_PARAM_force:+--ignore-compatible}
rauc install $force $KLISH_PARAM_URI
if [ $? -eq 0 -a -n "$KLISH_PARAM_reboot" ]; then
echo "Upgrade successful, rebooting..."
sleep 2
reboot
fi
</ACTION>
</COMMAND>
</VIEW>