blob: 7d0e224a1dff6c6d112eb8299bc6dcd74f6bcb1d [file] [log] [blame]
Brad Bishopd7bf8c12018-02-25 22:55:05 -05001#!/bin/sh
2
3# In case the interface is used for nfs, skip it.
4nfsroot=0
5interfaces=""
6exec 9<&0 < /proc/mounts
7while read dev mtpt fstype rest; do
8 if test $mtpt = "/" ; then
9 case $fstype in
10 nfs | nfs4)
11 nfsroot=1
12 nfs_addr=`echo $rest | sed -e 's/^.*addr=\([0-9.]*\).*$/\1/'`
13 break
14 ;;
15 *)
16 ;;
17 esac
18 fi
19done
20exec 0<&9 9<&-
21
22if [ $nfsroot -eq 0 ]; then
23 interfaces="$INTERFACES"
24else
25 if [ -x /bin/ip -o -x /sbin/ip ] ; then
26 nfs_iface=`ip route get $nfs_addr | grep dev | sed -e 's/^.*dev \([-a-z0-9.]*\).*$/\1/'`
27 fi
28 for i in $INTERFACES; do
29 if test "x$i" = "x$nfs_iface"; then
30 echo "dhclient skipping nfsroot interface $i"
31 else
32 interfaces="$interfaces $i"
33 fi
34 done
35fi
36
37if test "x$interfaces" != "x"; then
38 /sbin/dhclient -d -cf /etc/dhcp/dhclient.conf -q -lf /var/lib/dhcp/dhclient.leases $interfaces
39fi