diff options
Diffstat (limited to 'lib/rcscripts/net.modules.d/helpers.d/dhcpcd-wrapper')
-rwxr-xr-x | lib/rcscripts/net.modules.d/helpers.d/dhcpcd-wrapper | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/lib/rcscripts/net.modules.d/helpers.d/dhcpcd-wrapper b/lib/rcscripts/net.modules.d/helpers.d/dhcpcd-wrapper new file mode 100755 index 0000000..5aa1c53 --- /dev/null +++ b/lib/rcscripts/net.modules.d/helpers.d/dhcpcd-wrapper @@ -0,0 +1,48 @@ +#!/bin/bash +# Copyright (c) 2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +# Contributed by Roy Marples (uberlord@gentoo.org) + +interface="${1##*/dhcpcd-}" +interface="${interface%%.info}" + +if [[ $2 != "up" && $2 != "new" ]]; then + action="down" +else + action="up" +fi + +. /lib/rcscripts/net.modules.d/helpers.d/module-loader + +if [[ ${action} == "up" ]]; then + # Map MAC address variables to interface variables + macnet_pre_start "${interface}" 1>/dev/null + + # Map wireless ESSID variables to interface variables + if [[ -n ${wireless_module} ]]; then + if wireless_check_extensions "${interface}" ; then + essidnet_pre_start "${interface}" 1>/dev/null + fi + fi + + # Add any search paths if we have any defined + ifvar=$( bash_variable "${interface}" ) + eval d=\" \$\{dhcp_${ifvar}\} \" + [[ ${d} == " " ]] && d=" ${dhcp} " + + if [[ ${d} != *" nodns "* ]]; then + eval search=\"\$\{dns_search_path_${ifvar}\}\" + if [[ -n ${search} ]]; then + resolv="${statedir}/${interface}/resolv.conf" + tmp="${revolv}.$$" + egrep -v "^[ \t]*(search|domain)[ \t]*" "${resolv}" > "${tmp}" + echo "search ${search}" >> "${tmp}" + mv "${tmp}" "${resolv}" + fi + fi +fi + +. /lib/rcscripts/net.modules.d/helpers.d/dhcp-state + +# vim:ts=4 |