aboutsummaryrefslogtreecommitdiffstats
path: root/dhcpcd-hooks/50-dhcpcd-compat
blob: 651bc0861e1ab0fe2ce616f781846256c12ed5a2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# Compat enter hook shim for older dhcpcd versions

IPADDR=$new_ip_address
INTERFACE=$interface
NETMASK=$new_subnet_mask
BROADCAST=$new_broadcast_address
NETWORK=$new_network_number
DHCPSID=$new_dhcp_server_identifier
GATEWAYS=$new_routers
DNSSERVERS=$new_domain_name_servers
DNSDOMAIN=$new_domain_name
DNSSEARCH=$new_domain_search
NISDOMAIN=$new_nis_domain
NISSERVERS=$new_nis_servers
NTPSERVERS=$new_ntp_servers

GATEWAY=
for x in $new_routers; do
	GATEWAY="$GATEWAY${GATEWAY:+,}$x"
done
DNS=
for x in $new_domain_name_servers; do
	DNS="$DNS${DNS:+,}$x"
done

x="down"
case "$reason" in
RENEW) x="up";;
BOUND|INFORM|REBIND|REBOOT|TEST|TIMEOUT|IPV4LL) x="new";;
esac

if [ "$reason" != "down" ]; then
	rm -f /var/lib/dhcpcd-"$INTERFACE".info
	for x in IPADDR INTERFACE NETMASK BROADCAST NETWORK DHCPSID GATEWAYS \
		DNSSERVERS DNSDOMAIN DNSSEARCH NISDOMAIN NISSERVERS \
		NTPSERVERS GATEWAY DNS; do
		eval echo "$x=\'\$$x\'" >> /var/lib/dhcpcd-"$INTERFACE".info
	done
fi

set -- /var/lib/dhcpcd-"$INTERFACE".info "$x"