properly test ppp connection availability

This commit is contained in:
Calin Crisan 2017-12-20 23:05:34 +02:00
parent d7d08cb07d
commit 246e788328
2 changed files with 4 additions and 4 deletions

View File

@ -28,7 +28,7 @@ test -n "$os_debug" || source /etc/init.d/conf
test "$os_networkless" == "true" && exit 0 test "$os_networkless" == "true" && exit 0
connected() { connected() {
ifconfig | grep $os_ppp &>/dev/null 2>&1 && return 0 || return 1 ifconfig | grep $os_ppp &>/dev/null && return 0 || return 1
} }
watch() { watch() {

View File

@ -170,7 +170,7 @@ start() {
ssid=$(cat /data/etc/wpa_supplicant.conf 2>&1 | grep ssid | grep -v scan_ssid | cut -d '"' -f 2) ssid=$(cat /data/etc/wpa_supplicant.conf 2>&1 | grep ssid | grep -v scan_ssid | cut -d '"' -f 2)
test -n "$ssid" && start_wlan && wlan_ok="ok" test -n "$ssid" && start_wlan && wlan_ok="ok"
test -r /data/etc/ppp/modem && ppp_ok="ok" # TODO actually test the ppp link test -r /data/etc/ppp/modem && ifconfig | grep $os_ppp &>/dev/null && ppp_ok="ok"
# if wifi or ppp link ok, start eth in background # if wifi or ppp link ok, start eth in background
if [ "$wlan_ok" == "ok" ] || [ "$ppp_ok" == "ok" ]; then if [ "$wlan_ok" == "ok" ] || [ "$ppp_ok" == "ok" ]; then
@ -181,11 +181,11 @@ start() {
if [ "$eth_ok" != "ok" ] && [ "$wlan_ok" != "ok" ] && [ "$ppp_ok" != "ok" ]; then if [ "$eth_ok" != "ok" ] && [ "$wlan_ok" != "ok" ] && [ "$ppp_ok" != "ok" ]; then
if [ "$link_watch" == "true" ]; then if [ "$link_watch" == "true" ]; then
logger -t ethernet -s "no network connection available, rebooting" logger -t network -s "no network connection available, rebooting"
reboot reboot
return 1 return 1
else else
logger -t ethernet -s "no network connection available" logger -t network -s "no network connection available"
return 0 return 0
fi fi
fi fi