Lines 62-91
dhcpcd_stop() {
Link Here
|
62 |
dhcpcd_start() { |
62 |
dhcpcd_start() { |
63 |
local iface="$1" opts= pidfile="/var/run/dhcpcd-$1.pid" |
63 |
local iface="$1" opts= pidfile="/var/run/dhcpcd-$1.pid" |
64 |
local ifvar=$(bash_variable "${iface}") metric= d= |
64 |
local ifvar=$(bash_variable "${iface}") metric= d= |
|
|
65 |
local new= |
66 |
local dhcpopts= |
65 |
|
67 |
|
66 |
interface_exists "${iface}" true || return 1 |
68 |
interface_exists "${iface}" true || return 1 |
67 |
|
69 |
|
68 |
# Get our options |
70 |
# Get our options |
69 |
opts="dhcpcd_${ifvar}" |
71 |
eval opts=\$dhcp_${ifvar} |
70 |
opts="${dhcpcd} ${!opts}" |
72 |
opts="${dhcpcd} ${!opts}" |
71 |
|
73 |
|
|
|
74 |
[ -z "${opts}" ] && opts=${dhcp} |
75 |
|
76 |
case "$(dhcpcd --version)" in |
77 |
"dhcpcd "[123]*) new=false;; |
78 |
*) new=true;; |
79 |
esac |
80 |
|
72 |
# Map some generic options to dhcpcd |
81 |
# Map some generic options to dhcpcd |
73 |
d="dhcp_${ifvar}" |
82 |
eval dhcpopts=\$dhcp_${ifvar} |
74 |
d=" ${!d} " |
83 |
[ -z "${dhcpopts}" ] && dhcpopts=${dhcp} |
75 |
[[ ${d} == " " ]] && d=" ${dhcp} " |
84 |
|
76 |
[[ ${d} == *" nodns "* ]] && opts="${opts} -R" |
85 |
for opt in ${dhcpopts}; do |
77 |
[[ ${d} == *" nontp "* ]] && opts="${opts} -N" |
86 |
case "${opt}" in |
78 |
[[ ${d} == *" nonis "* ]] && opts="${opts} -Y" |
87 |
nodns) |
79 |
[[ ${d} == *" nogateway "* ]] && opts="${opts} -G" |
88 |
if ${new}; then |
80 |
if [[ ${d} == *" nosendhost "* ]] ; then |
89 |
opts="${opts} -C resolv.conf" |
81 |
opts="${opts} -h ''" |
90 |
else |
82 |
else |
91 |
opts="${opts} -R" |
83 |
# We transmit the hostname by default |
92 |
fi |
84 |
if [[ " ${opts} " != *" -h "* ]]; then |
93 |
;; |
85 |
local hname=$(hostname) |
94 |
nontp) |
86 |
[[ -n ${hname} && ${hname} != "(none)" && ${hname} != "localhost" ]] \ |
95 |
if ${new}; then |
87 |
&& opts="-h \"${hname}\" ${opts}" |
96 |
opts="${opts} -C ntp.conf" |
88 |
fi |
97 |
else |
|
|
98 |
opts="${opts} -N" |
99 |
fi |
100 |
;; |
101 |
nonis) |
102 |
if ${new}; then |
103 |
opts="${opts} -C yp.conf" |
104 |
else |
105 |
opts="${opts} -Y" |
106 |
fi |
107 |
;; |
108 |
nogateway) opts="${opts} -G";; |
109 |
nosendhost) opts="${opts} -h ''"; |
110 |
esac |
111 |
done |
112 |
|
113 |
# We transmit the hostname by default |
114 |
if [[ " ${opts} " != *" -h "* ]]; then |
115 |
local hname=$(hostname) |
116 |
[[ -n ${hname} && ${hname} != "(none)" && ${hname} != "localhost" ]] \ |
117 |
&& opts="-h \"${hname}\" ${opts}" |
89 |
fi |
118 |
fi |
90 |
|
119 |
|
91 |
# Add our route metric |
120 |
# Add our route metric |