base-files: fix typo in rfkill script
[openwrt.git] / package / base-files / files / etc / rc.button / rfkill
1 #!/bin/sh
2
3 [ "${ACTION}" = "released" -o -n "${TYPE}" ] || exit 0
4
5 . /lib/functions.sh
6
7 local rfkill_state=0
8
9 wifi_rfkill_set() {
10         uci set wireless.$1.disabled=$rfkill_state
11 }
12
13 wifi_rfkill_check() {
14         local disabled
15         config_get disabled $1 disabled
16         [ "$disabled" = "1" ] || rfkill_state=1
17 }
18
19 config_load wireless
20 case "${TYPE}" in
21 "switch")
22         [ "${ACTION}" = "released" ] && rfkill_state=1
23         ;;
24 *)
25         config_foreach wifi_rfkill_check wifi-device
26         ;;
27 esac
28 config_foreach wifi_rfkill_set wifi-device
29 uci commit wireless
30 wifi up