nfs_check 846 B

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