diff options
| author | Perry Melange <isprotejesvalkata@gmail.com> | 2021-10-12 18:17:08 +0200 |
|---|---|---|
| committer | Nick Hainke <vincent@systemli.org> | 2021-10-13 09:11:14 +0200 |
| commit | 0bb6aa04f6ed27fcea341d21a09fd3bcab86cd89 (patch) | |
| tree | 81a0ac2b8299e8d049787ff552bb74f3c7820bc6 /olsrd | |
| parent | e35255710bda08f162a185be8c460b6a80e19fb1 (diff) | |
olsrd: wait for wireless to initialize before starting
Wait for wireless to initialize (pending="false") to ensure
that any olsrd(6) configured interfaces and their associated
devices are up. This provides the init script the ability
to properly add all interface sections to the generated
config file /tmp/etc/olsrd(6).conf
Signed-off-by: Perry Melange <isprotejesvalkata@gmail.com>
Diffstat (limited to 'olsrd')
| -rw-r--r-- | olsrd/files/olsrd4.init | 14 | ||||
| -rw-r--r-- | olsrd/files/olsrd6.init | 14 |
2 files changed, 28 insertions, 0 deletions
diff --git a/olsrd/files/olsrd4.init b/olsrd/files/olsrd4.init index 28a84a6..62cb66d 100644 --- a/olsrd/files/olsrd4.init +++ b/olsrd/files/olsrd4.init @@ -15,10 +15,24 @@ wait_for_network() ubus -t 15 wait_for network.interface.$1 2>/dev/null } +wait_for_wireless() +{ + local count=0 + ubus -t 15 wait_for network.wireless 2>/dev/null + while [ $count -lt 30 ]; do + if [ "$(ubus call network.wireless status | jsonfilter -e '@[*]["pending"]' | grep true | wc -l)" == "0" ]; then + break + fi + count=$((count+1)) + sleep 1 + done +} + boot() { config_load network config_foreach wait_for_network interface + wait_for_wireless rc_procd start_service } diff --git a/olsrd/files/olsrd6.init b/olsrd/files/olsrd6.init index 8f9b91a..a20e967 100644 --- a/olsrd/files/olsrd6.init +++ b/olsrd/files/olsrd6.init @@ -15,10 +15,24 @@ wait_for_network() ubus -t 15 wait_for network.interface.$1 2>/dev/null } +wait_for_wireless() +{ + local count=0 + ubus -t 15 wait_for network.wireless 2>/dev/null + while [ $count -lt 30 ]; do + if [ "$(ubus call network.wireless status | jsonfilter -e '@[*]["pending"]' | grep true | wc -l)" == "0" ]; then + break + fi + count=$((count+1)) + sleep 1 + done +} + boot() { config_load network config_foreach wait_for_network interface + wait_for_wireless rc_procd start_service } |
