Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 262097 | Differences between
and this patch

Collapse All | Expand All

(-)dhcpcd.sh.orig (-21 / +46 lines)
Lines 60-101 dhcpcd_stop() { Link Here
60
#
60
#
61
# Returns 0 (true) when a DHCP address is obtained, otherwise 1
61
# Returns 0 (true) when a DHCP address is obtained, otherwise 1
62
dhcpcd_start() {
62
dhcpcd_start() {
63
	local iface="$1" opts= pidfile="/var/run/dhcpcd-$1.pid"
63
	local iface="$1" new= args= pidfile="/var/run/dhcpcd-$1.pid"
64
	local ifvar=$(bash_variable "${iface}") metric= d=
64
	local ifvar=$(bash_variable "${iface}") metric= d=
65
65
66
	interface_exists "${iface}" true || return 1
66
	interface_exists "${iface}" true || return 1
67
67
68
 	eval args=\$dhcpcd_${IFVAR}
69
	[ -z "${args}" ] && args=${dhcpcd}
70
68
	# Get our options
71
	# Get our options
69
	opts="dhcpcd_${ifvar}"
72
    eval opts=\$dhcp_${IFVAR}
70
	opts="${dhcpcd} ${!opts}"
73
    [ -z "${opts}" ] && opts=${dhcp}
74
75
	case "$(dhcpcd --version)" in
76
			"dhcpcd "[123]*) new=false;;
77
			*) new=true;;
78
	esac
71
79
72
	# Map some generic options to dhcpcd
80
	# Map some generic options to dhcpcd
73
	d="dhcp_${ifvar}"
81
	for opt in ${opts}; do
74
	d=" ${!d} "
82
		case "${opt}" in
75
	[[ ${d} == "  " ]] && d=" ${dhcp} "
83
			nodns)
76
	[[ ${d} == *" nodns "* ]] && opts="${opts} -R"
84
				if ${new}; then
77
	[[ ${d} == *" nontp "* ]] && opts="${opts} -N"
85
					args="${args} -C resolv.conf"
78
	[[ ${d} == *" nonis "* ]] && opts="${opts} -Y"
86
				else
79
	[[ ${d} == *" nogateway "* ]] && opts="${opts} -G"
87
					args="${args} -R"
80
	if [[ ${d} == *" nosendhost "* ]] ; then
88
				fi
81
		opts="${opts} -h ''"
89
				;;
82
	else
90
			nontp)
83
		# We transmit the hostname by default
91
				if ${new}; then
84
		if [[ " ${opts} " != *" -h "* ]]; then
92
					args="${args} -C ntp.conf"
85
			local hname=$(hostname)
93
				else
86
			[[ -n ${hname} && ${hname} != "(none)" && ${hname} != "localhost" ]] \
94
					args="${args} -N"
87
				&& opts="-h \"${hname}\" ${opts}"
95
				fi
88
		fi
96
				;;
97
			nonis)
98
				if ${new}; then
99
					args="${args} -C yp.conf"
100
				else
101
					args="${args} -Y"
102
				fi
103
				;;
104
			nogateway) args="${args} -G";;
105
			nosendhost) args="${args} -h ''";
106
		esac
107
	done
108
109
	# We transmit the hostname by default
110
	if [[ " ${args} " != *" -h "* ]]; then
111
		local hname=$(hostname)
112
		[[ -n ${hname} && ${hname} != "(none)" && ${hname} != "localhost" ]] \
113
			&& args="-h \"${hname}\" ${args}"
89
	fi
114
	fi
90
115
91
	# Add our route metric
116
	# Add our route metric
92
	metric="metric_${ifvar}"
117
	metric="metric_${ifvar}"
93
	[[ -n ${!metric} && ${!metric} != "0" ]] && opts="${opts} -m ${!metric}"
118
	[[ -n ${!metric} && ${!metric} != "0" ]] && args="${args} -m ${!metric}"
94
119
95
	# Bring up DHCP for this interface (or alias)
120
	# Bring up DHCP for this interface (or alias)
96
	ebegin "Running dhcpcd"
121
	ebegin "Running dhcpcd"
97
122
98
	eval /sbin/dhcpcd "${opts}" "${iface}"
123
	eval /sbin/dhcpcd "${args}" "${iface}"
99
	eend $? || return 1
124
	eend $? || return 1
100
125
101
	# DHCP succeeded, show address retrieved
126
	# DHCP succeeded, show address retrieved

Return to bug 262097