| 1 |
#!/bin/bash
|
| 2 |
# Copyright (c) 2005 Gentoo Foundation
|
| 3 |
# Distributed under the terms of the GNU General Public License v2
|
| 4 |
|
| 5 |
# Contributed by Roy Marples (uberlord@gentoo.org)
|
| 6 |
|
| 7 |
interface="${1##*/dhcpcd-}"
|
| 8 |
interface="${interface%%.info}"
|
| 9 |
|
| 10 |
if [[ $2 != "up" && $2 != "new" ]]; then
|
| 11 |
action="down"
|
| 12 |
else
|
| 13 |
action="up"
|
| 14 |
fi
|
| 15 |
|
| 16 |
. /lib/rcscripts/net.modules.d/helpers.d/module-loader
|
| 17 |
|
| 18 |
if [[ ${action} == "up" ]]; then
|
| 19 |
# Map MAC address variables to interface variables
|
| 20 |
macnet_pre_start "${interface}" 1>/dev/null
|
| 21 |
|
| 22 |
# Map wireless ESSID variables to interface variables
|
| 23 |
if [[ -n ${wireless_module} ]]; then
|
| 24 |
if wireless_check_extensions "${interface}" ; then
|
| 25 |
essidnet_pre_start "${interface}" 1>/dev/null
|
| 26 |
fi
|
| 27 |
fi
|
| 28 |
|
| 29 |
# Add any search paths if we have any defined
|
| 30 |
ifvar=$( bash_variable "${interface}" )
|
| 31 |
eval d=\" \$\{dhcp_${ifvar}\} \"
|
| 32 |
[[ ${d} == " " ]] && d=" ${dhcp} "
|
| 33 |
|
| 34 |
if [[ ${d} != *" nodns "* ]]; then
|
| 35 |
eval search=\"\$\{dns_search_path_${ifvar}\}\"
|
| 36 |
if [[ -n ${search} ]]; then
|
| 37 |
resolv="${statedir}/${interface}/resolv.conf"
|
| 38 |
tmp="${revolv}.$$"
|
| 39 |
egrep -v "^[ \t]*(search|domain)[ \t]*" "${resolv}" > "${tmp}"
|
| 40 |
echo "search ${search}" >> "${tmp}"
|
| 41 |
mv "${tmp}" "${resolv}"
|
| 42 |
fi
|
| 43 |
fi
|
| 44 |
fi
|
| 45 |
|
| 46 |
. /lib/rcscripts/net.modules.d/helpers.d/dhcp-state
|