Lines 2-7
Link Here
|
2 |
# Distributed under the terms of the GNU General Public License v2 |
2 |
# Distributed under the terms of the GNU General Public License v2 |
3 |
|
3 |
|
4 |
# Contributed by Roy Marples (uberlord@gentoo.org) |
4 |
# Contributed by Roy Marples (uberlord@gentoo.org) |
|
|
5 |
# Modified by Jeremy W. Murphy for compatibility with dhcpcd-5 |
5 |
|
6 |
|
6 |
# void dhcpcd_depend(void) |
7 |
# void dhcpcd_depend(void) |
7 |
# |
8 |
# |
Lines 28-33
Link Here
|
28 |
return 1 |
29 |
return 1 |
29 |
} |
30 |
} |
30 |
|
31 |
|
|
|
32 |
# Returns: 0 (not installed) or major version number. |
33 |
dhcpcd_version() { |
34 |
local -i VERSION=0 |
35 |
# Use /var/db/pkg? |
36 |
if [ -d /var/db/pkg/net-misc ]; then |
37 |
local FN=$(ls -d /var/db/pkg/net-misc/dhcpcd-[0-9]*) |
38 |
if [ $FN ]; then |
39 |
VERSION=${FN:28:1} |
40 |
fi |
41 |
fi |
42 |
return $VERSION |
43 |
} |
31 |
# bool dhcpcd_stop(char *iface) |
44 |
# bool dhcpcd_stop(char *iface) |
32 |
# |
45 |
# |
33 |
# Stop DHCP on an interface by calling dhcpcd -z $iface |
46 |
# Stop DHCP on an interface by calling dhcpcd -z $iface |
Lines 69-79
Link Here
|
69 |
opts="dhcpcd_${ifvar}" |
82 |
opts="dhcpcd_${ifvar}" |
70 |
opts="${dhcpcd} ${!opts}" |
83 |
opts="${dhcpcd} ${!opts}" |
71 |
|
84 |
|
|
|
85 |
# Get the version |
86 |
dhcpcd_version |
87 |
declare -i VERSION=$? |
88 |
|
72 |
# Map some generic options to dhcpcd |
89 |
# Map some generic options to dhcpcd |
73 |
d="dhcp_${ifvar}" |
90 |
d="dhcp_${ifvar}" |
74 |
d=" ${!d} " |
91 |
d=" ${!d} " |
75 |
[[ ${d} == " " ]] && d=" ${dhcp} " |
92 |
[[ ${d} == " " ]] && d=" ${dhcp} " |
76 |
[[ ${d} == *" nodns "* ]] && opts="${opts} -R" |
93 |
[[ $VERSION == 4 && ${d} == *" nodns "* && ${d} == *" compat "* ]] && opts="${opts} -R" |
77 |
[[ ${d} == *" nontp "* ]] && opts="${opts} -N" |
94 |
[[ ${d} == *" nontp "* ]] && opts="${opts} -N" |
78 |
[[ ${d} == *" nonis "* ]] && opts="${opts} -Y" |
95 |
[[ ${d} == *" nonis "* ]] && opts="${opts} -Y" |
79 |
[[ ${d} == *" nogateway "* ]] && opts="${opts} -G" |
96 |
[[ ${d} == *" nogateway "* ]] && opts="${opts} -G" |