/[baselayout]/trunk/net/dhcpcd.sh
Gentoo

Contents of /trunk/net/dhcpcd.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2654 - (show annotations) (download) (as text)
Wed Apr 25 12:39:31 2007 UTC (7 years, 2 months ago) by uberlord
File MIME type: text/x-sh
File size: 1522 byte(s)
Now that dhcpcd-3 is stable on all arches, use it with start-stop-daemon.
1 # Copyright 2004-2007 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 dhcpcd_depend() {
5 after interface
6 program start /sbin/dhcpcd
7 provide dhcp
8
9 # We prefer dhcpcd over the others
10 after dhclient pump udhcpc
11 }
12
13 _config_vars="$_config_vars dhcp dhcpcd"
14
15 dhcpcd_start() {
16 local args= opt= opts= pidfile="/var/run/dhcpcd-${IFACE}.pid"
17
18 eval args=\$dhcpcd_${IFVAR}
19
20 # Get our options
21 eval opts=\$dhcp_${IFVAR}
22 [ -z "${opts}" ] && opts=${dhcp}
23
24 # Map some generic options to dhcpcd
25 for opt in ${opts} ; do
26 case "${opt}" in
27 nodns) args="${args} -R" ;;
28 nontp) args="${args} -N" ;;
29 nonis) args="${args} -Y" ;;
30 nogateway) args="${args} -G" ;;
31 nosendhost) args="${args} -h ''";
32 esac
33 done
34
35 # Add our route metric
36 [ "${metric:-0}" != "0" ] && args="${args} -m ${metric}"
37
38 # Bring up DHCP for this interface
39 ebegin "Running dhcpcd"
40
41 eval start-stop-daemon --start --exec /sbin/dhcpcd \
42 --pidfile /var/run/"dhcpcd-${IFACE}.pid" \
43 -- "${args}" "${IFACE}"
44 eend $? || return 1
45
46 _show_address
47 return 0
48 }
49
50 dhcpcd_stop() {
51 local pidfile="/var/run/dhcpcd-${IFACE}.pid" opts=
52 [ ! -f "${pidfile}" ] && return 0
53
54 # Get our options
55 if [ -x /sbin/dhcpcd ] ; then
56 eval opts=\$dhcp_${IFVAR}
57 [ -z "${opts}" ] && opts=${dhcp}
58 fi
59
60 ebegin "Stopping dhcpcd on ${IFACE}"
61 case " ${opts} " in
62 *" release "*) dhcpcd -k "${IFACE}" ;;
63 *)
64 start-stop-daemon --stop --quiet \
65 --exec /sbin/dhcpcd --pidfile "${pidfile}"
66 ;;
67 esac
68 eend $?
69 }
70
71 # vim: set ts=4 :

  ViewVC Help
Powered by ViewVC 1.1.20