/lib/recovery-mode/options/network is in friendly-recovery 0.2.38.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | #!/bin/sh
if [ "$1" = "test" ]; then
. /lib/recovery-mode/l10n.sh
echo $(eval_gettext "Enable networking")
exit 0
fi
# Check for existing connectivity
check_connectivity() {
ip route get 1.2.3.4 >/dev/null 2>&1
retval_route=$?
grep ^nameserver -q /etc/resolv.conf
retval_resolve=$?
if [ "$retval_route" = "0" ] && [ "$retval_resolve" ]; then
exit 0
fi
}
# Try handling networking using systemd
if [ -d /run/systemd/system ]; then
for i in dbus.socket systemd-resolved.service networking.service systemd-networkd.service NetworkManager.service; do
systemctl is-enabled -q $i && systemctl start $i
done
/lib/systemd/systemd-networkd-wait-online && exit 0
fi
# Start by trying to bring everything up
ifup -a
check_connectivity
# Then try Network Manager
if type NetworkManager >/dev/null 2>&1; then
echo "Trying to start NetworkManager..."
mkdir -p /run/dbus
chown messagebus:messagebus /run/dbus
dbus-daemon --system --nopidfile
NetworkManager
trap "killall dbus-daemon NetworkManager" EXIT HUP INT QUIT PIPE
timeout=15
while [ $timeout -ge 0 ]; do
check_connectivity
sleep 1
timeout=$((timeout-1))
done
fi
# Try running dhclient on everything else
cd /sys/class/net/
for interface in *; do
dhclient -1 $interface
check_connectivity
done
exit 0
|