From: Roy Marples Date: Wed, 16 Apr 2008 13:47:39 +0000 (+0000) Subject: Add dhcpcd-compat.sh, so that distros can make available old style variables. X-Git-Tag: v4.0.2~482 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1b088dd4d517c97fb65024406eb2aeef55cca51e;p=thirdparty%2Fdhcpcd.git Add dhcpcd-compat.sh, so that distros can make available old style variables. --- diff --git a/README b/README index 10a30609..4f62044b 100644 --- a/README +++ b/README @@ -1,4 +1,4 @@ -dhcpcd-3 - DHCP client daemon +dhcpcd-4 - DHCP client daemon Copyright 2006-2008 Roy Marples @@ -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 index 00000000..7b6c0f42 --- /dev/null +++ b/dhcpcd-compat.sh @@ -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}"