base-files: make wifi report unknown command

Avoid having /sbin/wifi silently ignore unknown keywords and execute
"up"; instead display the help message and exit with an error.

Spell out the "up" keyword (which has users), add it to usage output,
and preserve the implicit assumption that runing /sbin/wifi without
argument performs "up".

Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
(backported from 78b5764fd8)
openwrt-18.06
Thibaut VARÈNE 2018-08-09 20:33:45 +02:00 committed by Jo-Philipp Wich
parent 7a52e0a7ab
commit a2b2a9c55f
1 changed files with 3 additions and 2 deletions

View File

@ -6,7 +6,7 @@
usage() { usage() {
cat <<EOF cat <<EOF
Usage: $0 [config|down|reload|status] Usage: $0 [config|up|down|reload|status]
enables (default), disables or configures devices not yet configured. enables (default), disables or configures devices not yet configured.
EOF EOF
exit 1 exit 1
@ -241,5 +241,6 @@ case "$1" in
reload) wifi_reload "$2";; reload) wifi_reload "$2";;
reload_legacy) wifi_reload_legacy "$2";; reload_legacy) wifi_reload_legacy "$2";;
--help|help) usage;; --help|help) usage;;
*) ubus call network reload; wifi_updown "enable" "$2";; ''|up) ubus call network reload; wifi_updown "enable" "$2";;
*) usage; exit 1;;
esac esac