]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Add dhcpcd-compat.sh, so that distros can make available old style variables.
authorRoy Marples <roy@marples.name>
Wed, 16 Apr 2008 13:47:39 +0000 (13:47 +0000)
committerRoy Marples <roy@marples.name>
Wed, 16 Apr 2008 13:47:39 +0000 (13:47 +0000)
README
dhcpcd-compat.sh [new file with mode: 0644]

diff --git a/README b/README
index 10a30609e24a62dcd444bbf432b4032b6bdd63c9..4f62044b0c68ffa88edf89e0369d43839013403b 100644 (file)
--- a/README
+++ b/README
@@ -1,4 +1,4 @@
-dhcpcd-3 - DHCP client daemon
+dhcpcd-4 - DHCP client daemon
 Copyright 2006-2008 Roy Marples <roy@marples.name>
 
 
@@ -33,6 +33,9 @@ linux-2.6.24 finally ships with a working 32-bit header.
 If your linux headers are older, or your distro hasn't patched them you can
 set CSTD=gnu99 to work around this.
 
+If you require compatibility with dhcpcd-3 and older style variables,
+you can install dhcpcd-compat.sh into the directory /etc/dhcpcd-enter-hook.d
+We don't install this by default.
 
 ChangeLog
 ---------
diff --git a/dhcpcd-compat.sh b/dhcpcd-compat.sh
new file mode 100644 (file)
index 0000000..7b6c0f4
--- /dev/null
@@ -0,0 +1,32 @@
+#!/bin/sh
+# Compat shim for older dhcpcd versions
+
+IPADDR=${new_ip_address}
+INTERFACE=${interface}
+NETMASK=${new_subnet_mask}
+BROADCAST=${new_broadcast_address}
+NETWORK=${new_network_address}
+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) "up";;
+       BOUND|INFORM|REBIND|REBOOT|TEST|TIMEOUT|IPV4LL) x="new";;
+esac
+set -- "" "${x}"