source: trunk/debathena/config/recovery-mode-config/debian/require_network.sh @ 25023

Revision 25023, 781 bytes checked in by jdreed, 14 years ago (diff)
In recovery-mode-config: * Don't poweroff, reboot, since kexec is nolonger an issue (Trac #759) * Make athena-update functional by requiring network (Trac #759) * Make athena-renumber less stupid
Line 
1# This is sourced by sh, not executed
2#
3# Ensure that networking is up
4
5require_network() {
6    # Ensure that eth0 is up
7    ifup eth0 2>/dev/null
8    gw=$(route -n | grep ^0.0.0.0\ | awk '{print $2}')
9    if [ -z "$gw" ]; then
10        echo "Something is wrong with the networking config (no default route)"
11        return 1
12    fi
13    # Re-verify connection to gateway... one ping only.
14    ping -w 5 -c 1 $gw >/dev/null 2>&1
15    if [ $? != 0 ]; then
16        echo "Could not ping gateway after trying for 5 seconds"
17        return 1
18    fi
19    if ! grep nameserver /etc/resolv.conf | grep -qv 127.0.0.1$; then
20        echo "Trying to start bind..."
21        service bind9 start
22    fi
23    host web.mit.edu >/dev/null 2>&1
24    if [ $? != 0 ]; then
25        echo "Couldn't look up web.mit.edu - DNS may be broken"
26        return 1
27    fi
28}
Note: See TracBrowser for help on using the repository browser.