summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafał Miłecki <rafal@milecki.pl>2024-02-12 11:56:59 +0100
committerRafał Miłecki <rafal@milecki.pl>2024-02-22 22:18:36 +0100
commit4ba5eba94cb65bacd0b3cda3e9d8b40ce2b3002e (patch)
tree054739271d93c35be13b3f031b93cceb27fa855c
parent73da77fd00a4401420b649c17664248905195c42 (diff)
downloadopenwrt-4ba5eba94cb65bacd0b3cda3e9d8b40ce2b3002e.tar.gz
openwrt-4ba5eba94cb65bacd0b3cda3e9d8b40ce2b3002e.tar.bz2
openwrt-4ba5eba94cb65bacd0b3cda3e9d8b40ce2b3002e.zip
base-files: sysupgrade: exit with no error for --help
Calling "sysupgrade --help" should result in printing help and exiting with 0 code. Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
-rwxr-xr-xpackage/base-files/files/sbin/sysupgrade17
1 files changed, 13 insertions, 4 deletions
diff --git a/package/base-files/files/sbin/sysupgrade b/package/base-files/files/sbin/sysupgrade
index 08f92c659f..592b1f3781 100755
--- a/package/base-files/files/sbin/sysupgrade
+++ b/package/base-files/files/sbin/sysupgrade
@@ -63,9 +63,7 @@ while [ -n "$1" ]; do
shift;
done
-IMAGE="$1"
-
-[ -z "$IMAGE" -a -z "$NEED_IMAGE" -a $CONF_BACKUP_LIST -eq 0 -o $HELP -gt 0 ] && {
+print_help() {
cat <<EOF
Usage: $0 [<upgrade-option>...] <image file or URL>
$0 [-q] [-i] [-c] [-u] [-o] [-k] <backup-command> <file>
@@ -105,9 +103,20 @@ backup-command:
sysupgrade -b. Does not create a backup file.
EOF
- exit 1
}
+IMAGE="$1"
+
+if [ $HELP -gt 0 ]; then
+ print_help
+ exit 0
+fi
+
+if [ -z "$IMAGE" -a -z "$NEED_IMAGE" -a $CONF_BACKUP_LIST -eq 0 ]; then
+ print_help
+ exit 1
+fi
+
[ -n "$IMAGE" -a -n "$NEED_IMAGE" ] && {
cat <<-EOF
-b|--create-backup and -r|--restore-backup do not perform a firmware upgrade.