OpenWrt – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | #!/bin/sh |
2 | |||
3 | # This must run before 10-wifi-detect |
||
4 | |||
5 | |||
6 | [ "${ACTION}" = "add" ] || return |
||
7 | |||
8 | |||
9 | . /lib/functions.sh |
||
10 | |||
11 | |||
12 | check_radio() |
||
13 | { |
||
14 | local cfg="$1" to="$2" |
||
15 | |||
16 | config_get path "$cfg" path |
||
17 | |||
18 | [ "$path" = "$to" ] && PATH_EXISTS=true |
||
19 | } |
||
20 | |||
21 | do_migrate_radio() |
||
22 | { |
||
23 | local cfg="$1" from="$2" to="$3" |
||
24 | |||
25 | config_get path "$cfg" path |
||
26 | |||
27 | [ "$path" = "$from" ] || return |
||
28 | |||
29 | uci set "wireless.${cfg}.path=${to}" |
||
30 | WIRELESS_CHANGED=true |
||
31 | |||
32 | logger -t wifi-migrate "Updated path of wireless.${cfg} from '${from}' to '${to}'" |
||
33 | } |
||
34 | |||
35 | migrate_radio() |
||
36 | { |
||
37 | local from="$1" to="$2" |
||
38 | |||
39 | config_load wireless |
||
40 | |||
41 | # Check if there is already a section with the target path: In this case, the system |
||
42 | # was already upgraded to a version without this migration script before; better bail out, |
||
43 | # as we can't be sure we don't break more than we fix. |
||
44 | PATH_EXISTS=false |
||
45 | config_foreach check_radio wifi-device "$to" |
||
46 | $PATH_EXISTS && return |
||
47 | |||
48 | config_foreach do_migrate_radio wifi-device "$from" "$to" |
||
49 | } |
||
50 | |||
51 | |||
52 | WIRELESS_CHANGED=false |
||
53 | |||
54 | case "$(board_name)" in |
||
55 | tplink,tl-wdr4900-v1) |
||
56 | migrate_radio 'ffe09000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0' 'ffe09000.pcie/pci9000:00/9000:00:00.0/9000:01:00.0' |
||
57 | migrate_radio 'ffe0a000.pcie/pci0001:02/0001:02:00.0/0001:03:00.0' 'ffe0a000.pcie/pcia000:02/a000:02:00.0/a000:03:00.0' |
||
58 | ;; |
||
59 | esac |
||
60 | |||
61 | $WIRELESS_CHANGED && uci commit wireless |
||
62 | |||
63 | exit 0 |