--- a/dhcpcd.sh 2010-08-28 15:54:28.000000000 -0400 +++ b/dhcpcd.sh 2010-08-29 07:45:19.000000000 -0400 @@ -66,27 +66,42 @@ dhcpcd_start() { interface_exists "${iface}" true || return 1 # Get our options - opts="dhcpcd_${ifvar}" - opts="${dhcpcd} ${!opts}" + eval opts=\$dhcp_${ifvar} + [ -z "${opts}" ] && opts=${dhcp} - # Map some generic options to dhcpcd - d="dhcp_${ifvar}" - d=" ${!d} " - [[ ${d} == " " ]] && d=" ${dhcp} " - [[ ${d} == *" nodns "* ]] && opts="${opts} -R" - [[ ${d} == *" nontp "* ]] && opts="${opts} -N" - [[ ${d} == *" nonis "* ]] && opts="${opts} -Y" - [[ ${d} == *" nogateway "* ]] && opts="${opts} -G" - if [[ ${d} == *" nosendhost "* ]] ; then - opts="${opts} -h ''" - else - # We transmit the hostname by default - if [[ " ${opts} " != *" -h "* ]]; then - local hname=$(hostname) - [[ -n ${hname} && ${hname} != "(none)" && ${hname} != "localhost" ]] \ - && opts="-h \"${hname}\" ${opts}" - fi - fi + case "$(dhcpcd --version)" in + "dhcpcd "[123]*) new=false;; + *) new=true;; + esac + + # Map some generic options to dhcpcd + for opt in ${opts}; do + case "${opt}" in + nodns) + if ${new}; then + opts="${opts} -C resolv.conf" + else + opts="${opts} -R" + fi + ;; + nontp) + if ${new}; then + opts="${opts} -C ntp.conf" + else + opts="${opts} -N" + fi + ;; + nonis) + if ${new}; then + opts="${opts} -C yp.conf" + else + opts="${opts} -Y" + fi + ;; + nogateway) opts="${opts} -G";; + nosendhost) opts="${opts} -h ''"; + esac + done # Add our route metric metric="metric_${ifvar}"