base-files: make wifi report unknown command
authorThibaut VARÈNE <hacks@slashdirt.org>
Thu, 9 Aug 2018 18:33:45 +0000 (20:33 +0200)
committerJohn Crispin <john@phrozen.org>
Fri, 10 Aug 2018 03:30:57 +0000 (05:30 +0200)
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>
package/base-files/files/sbin/wifi

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