refuse to start without a network connection

This commit is contained in:
Calin Crisan 2016-03-16 22:35:48 +02:00
parent 1a76a44a3c
commit dca861266c
4 changed files with 19 additions and 11 deletions

View File

@ -79,7 +79,6 @@ start() {
if [ $count -gt $link_watch_timeout ] || ! pidof wpa_supplicant > /dev/null; then
msg_fail
reboot
return 1
fi
@ -119,5 +118,7 @@ case "$1" in
exit 1
esac
exit $?
# continue after an unsuccessfull wifi start
# as we may still have an ethernet connection available
exit 0

View File

@ -102,7 +102,7 @@ start_eth() {
count=$(($count + 1))
if [ $count -ge 3 ]; then
msg_done "no device"
return
return 1
fi
done
@ -116,7 +116,7 @@ start_eth() {
count=$(($count + 1))
if [ $count -ge 3 ]; then
msg_done "no link"
return
return 1
fi
done
@ -127,7 +127,7 @@ start_eth() {
count=$(($count + 1))
if [ $count -ge $link_nego_timeout ]; then
msg_done "no link"
return
return 1
fi
done
@ -157,13 +157,20 @@ start() {
start_lo
test -n "$ssid" && start_wlan
test -n "$ssid" && start_wlan && wlan_ok="ok"
# if wifi or ppp connection configured, start eth in background
if [ -n "$ssid" ] || [ -r /data/etc/ppp/modem ]; then
test -r /data/etc/ppp/modem && ppp_ok="ok" # TODO actually test the ppp link
# if wifi or ppp link ok, start eth in background
if [ "$wlan_ok" == "ok" ] || [ "$ppp_ok" == "ok" ]; then
start_eth &>/dev/null &
else
start_eth
start_eth && eth_ok="ok"
fi
if [ "$eth_ok" != "ok" ] && [ "$wlan_ok" != "ok" ] && [ "$ppp_ok" != "ok" ]; then
reboot
return 1
fi
if [ -n "$static_gw" ]; then

View File

@ -12,7 +12,7 @@ echo "---- shutting down $os_name $os_version ----" >> $boot_log
(for i in $(ls -r /etc/init.d/S??*); do
[ ! -x "$i" ] && continue
[ -f /data/etc/no_$(basename $i) ] && continue
$i stop
$i stop || break
done& echo $! > $pid_file) | tee -a $boot_log &
pid=$(cat $pid_file)

View File

@ -13,7 +13,7 @@ echo "---- booting $os_name $os_version----" >> $tmp_boot_log
(for i in /etc/init.d/S??*; do
[ ! -x "$i" ] && continue
[ -f /data/etc/no_$(basename $i) ] && continue
$i start
$i start || break
done& echo $! > $pid_file) | tee -a $tmp_boot_log &
pid=$(cat $pid_file)