Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | # In case the interface is used for nfs, skip it. |
| 4 | nfsroot=0 |
| 5 | interfaces="" |
| 6 | exec 9<&0 < /proc/mounts |
| 7 | while 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 |
| 19 | done |
| 20 | exec 0<&9 9<&- |
| 21 | |
| 22 | if [ $nfsroot -eq 0 ]; then |
| 23 | interfaces="$INTERFACES" |
| 24 | else |
| 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 |
| 35 | fi |
| 36 | |
| 37 | if test "x$interfaces" != "x"; then |
| 38 | /sbin/dhclient -d -cf /etc/dhcp/dhclient.conf -q -lf /var/lib/dhcp/dhclient.leases $interfaces |
| 39 | fi |