summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLyndon Brown <jnqnfe@gmail.com>2020-05-05 18:58:39 +0100
committerLyndon Brown <jnqnfe@gmail.com>2020-05-05 19:02:35 +0100
commit665372c19d7f54b5cfb92aaf313b7df9570f6191 (patch)
tree62346cd4ab9f760ccdcb0214ec826ab032e8a0b5
parentd68290058e523bed56a8235e6408816ae3c8607e (diff)
downloadvyos-live-build-665372c19d7f54b5cfb92aaf313b7df9570f6191.tar.gz
vyos-live-build-665372c19d7f54b5cfb92aaf313b7df9570f6191.zip
config: catch and report unexpected arguments
after handling arguments, catch and report any remaining "non-option" arguments. for instance users could make the basic mistake of using `lb config --bootloaders syslinux grub-efi`, i.e. failing to quote the multiple bootloaders (i actually encountered a user doing this who swore that "it just worked"). catching and reporting such mistakes could be valuable to users. previous behaviour: ``` $ lb config --bootloaders syslinux grub-efi P: Updating config tree for a debian/buster/amd64 system P: Symlinking hooks... ``` new behaviour: ``` $ lb config --bootloaders syslinux grub-efi [2020-05-05 18:56:07] lb config --bootloaders syslinux grub-efi E: Unexpected argument found: grub-efi ``` Gbp-Dch: Short
-rwxr-xr-xscripts/build/config9
1 files changed, 9 insertions, 0 deletions
diff --git a/scripts/build/config b/scripts/build/config
index 2bd929bc1..da8f3ce2f 100755
--- a/scripts/build/config
+++ b/scripts/build/config
@@ -822,6 +822,15 @@ Local_arguments ()
;;
esac
done
+
+ # Any remaining arguments should be reported as an unexpected arguments error.
+ if [ $# -ne 0 ]; then
+ local ARG
+ for ARG in "${@}"; do
+ Echo_error "Unexpected argument found: %s" "${ARG}"
+ done
+ exit 1
+ fi
}
# Processing args such that we have a value for --config if given