diff options
Diffstat (limited to 'meta/recipes-connectivity')
-rw-r--r-- | meta/recipes-connectivity/dhcp/files/dhclient-systemd-wrapper | 26 |
1 files changed, 1 insertions, 25 deletions
diff --git a/meta/recipes-connectivity/dhcp/files/dhclient-systemd-wrapper b/meta/recipes-connectivity/dhcp/files/dhclient-systemd-wrapper index 87c60fa95f..7d0e224a1d 100644 --- a/meta/recipes-connectivity/dhcp/files/dhclient-systemd-wrapper +++ b/meta/recipes-connectivity/dhcp/files/dhclient-systemd-wrapper | |||
@@ -1,19 +1,5 @@ | |||
1 | #!/bin/sh | 1 | #!/bin/sh |
2 | 2 | ||
3 | # Add an initial /var/lib/dhcp/dhclient.leases to make | ||
4 | # sure the IP which dhclient try to renew is the same | ||
5 | # with the IP which kernel got from dhcp server during | ||
6 | # boot | ||
7 | update_dhclient_leases() | ||
8 | { | ||
9 | local addr=$1 | ||
10 | local interface=$2 | ||
11 | echo "lease {" >> /var/lib/dhcp/dhclient.leases | ||
12 | echo " interface \"${addr}\";" >> /var/lib/dhcp/dhclient.leases | ||
13 | echo " fixed-address ${interface:0:-3};" >> /var/lib/dhcp/dhclient.leases | ||
14 | echo "}" >> /var/lib/dhcp/dhclient.leases | ||
15 | } | ||
16 | |||
17 | # In case the interface is used for nfs, skip it. | 3 | # In case the interface is used for nfs, skip it. |
18 | nfsroot=0 | 4 | nfsroot=0 |
19 | interfaces="" | 5 | interfaces="" |
@@ -33,7 +19,6 @@ while read dev mtpt fstype rest; do | |||
33 | done | 19 | done |
34 | exec 0<&9 9<&- | 20 | exec 0<&9 9<&- |
35 | 21 | ||
36 | |||
37 | if [ $nfsroot -eq 0 ]; then | 22 | if [ $nfsroot -eq 0 ]; then |
38 | interfaces="$INTERFACES" | 23 | interfaces="$INTERFACES" |
39 | else | 24 | else |
@@ -42,16 +27,7 @@ else | |||
42 | fi | 27 | fi |
43 | for i in $INTERFACES; do | 28 | for i in $INTERFACES; do |
44 | if test "x$i" = "x$nfs_iface"; then | 29 | if test "x$i" = "x$nfs_iface"; then |
45 | interface_addr=`ip -4 address show $nfs_iface | grep 'inet '|sed 's/.*inet \(\S\+\).*/\1/'` | 30 | echo "dhclient skipping nfsroot interface $i" |
46 | if [ "x$interface_addr" != "x" ] && cat /proc/cmdline | grep "ip=dhcp" > /dev/null ; then | ||
47 | # use to renew lease if needed | ||
48 | interfaces="$interfaces $i" | ||
49 | # use to update /var/lib/dhcp/dhclient.leases if needed | ||
50 | # when the ip got by kernel, we need use dhclient to renew the ip | ||
51 | update_dhclient_leases $nfs_iface $interface_addr | ||
52 | else | ||
53 | echo "dhclient skipping nfsroot interface $i" | ||
54 | fi | ||
55 | else | 31 | else |
56 | interfaces="$interfaces $i" | 32 | interfaces="$interfaces $i" |
57 | fi | 33 | fi |