package/dhcp/S80dhcp-server: allow empty INTERFACES
[buildroot-gz.git] / package / skeleton / nfs_check
blobdfa0cbf58028c8872022d7fd135da5c1241d8fb9
1 #!/bin/sh
3 # This allows NFS booting to work while also being able to configure
4 # the network interface via DHCP when not NFS booting. Otherwise, a
5 # NFS booted system will likely hang during DHCP configuration.
7 # Attempting to configure the network interface used for NFS will
8 # initially bring that network down. Since the root filesystem is
9 # accessed over this network, the system hangs.
11 # This script is run by ifup and will attempt to detect if a NFS root
12 # mount uses the interface to be configured (IFACE), and if so does
13 # not configure it. This should allow the same build to be disk/flash
14 # booted or NFS booted.
16 nfsip=`sed -n '/^[^ ]*:.* \/ nfs.*[ ,]addr=\([0-9.]\+\).*/s//\1/p' /proc/mounts`
17 if [ -n "$nfsip" ] && ip route get to "$nfsip" | grep -q "dev $IFACE"; then
18 echo Skipping $IFACE, used for NFS from $nfsip
19 exit 1