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

Contents of /trunk/net/dhclient.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2647 - (show annotations) (download) (as text)
Mon Apr 23 16:43:52 2007 UTC (7 years, 4 months ago) by uberlord
File MIME type: text/x-sh
File size: 1775 byte(s)
Remove debug stuff
1 # Copyright 2004-2007 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 dhclient_depend() {
5 after interface
6 program start /sbin/dhclient
7 provide dhcp
8 }
9
10 _config_vars="$_config_vars dhcp dhcpcd"
11
12 dhclient_start() {
13 local args= opt= opts= pidfile="/var/run/dhclient-${IFACE}.pid"
14 local sendhost=true dconf=
15
16 # Get our options
17 eval opts=\$dhcp_${IFVAR}
18 [ -z "${opts}" ] && opts=${dhcp}
19
20 # Map some generic options to dhcpcd
21 for opt in ${opts} ; do
22 case "${opt}" in
23 nodns) args="${args} -e PEER_DNS=no" ;;
24 nontp) args="${args} -e PEER_NTP=no" ;;
25 nogateway) args="${args} -e PEER_ROUTERS=no" ;;
26 nosendhost) sendhost=false ;;
27 esac
28 done
29
30 # Add our route metric
31 [ "${metric:-0}" != "0" ] && args="${args} -e IF_METRIC=${metric}"
32
33 if ${sendhost} ; then
34 local hname="$(hostname)"
35 if [ "${hname}" != "(none)" -a "${hname}" != "localhost" ]; then
36 dhconf="${dhconf} interface \"${IFACE}\" {"
37 dhconf="${dhconf} send host-name \"${hname}\";"
38 dhconf="${dhconf}}"
39 fi
40 fi
41
42 # Bring up DHCP for this interface
43 ebegin "Running dhclient"
44 echo "${dhconf}" | start-stop-daemon --start --exec /sbin/dhclient \
45 --pidfile "${pidfile}" -- ${args} -q -1 -pf "${pidfile}" "${IFACE}"
46 eend $? || return 1
47
48 _show_address
49 return 0
50 }
51
52 dhclient_stop() {
53 local pidfile="/var/run/dhclient-${IFACE}.pid" opts=
54 [ ! -f "${pidfile}" ] && return 0
55
56 # Get our options
57 if [ -x /sbin/dhclient ] ; then
58 eval opts=\$dhcp_${IFVAR}
59 [ -z "${opts}" ] && opts=${dhcp}
60 fi
61
62 ebegin "Stopping dhclient on ${IFACE}"
63 case " ${opts} " in
64 *" release "*) dhclient -q -r -pf "${pidfile}" "${IFACE}" ;;
65 *)
66 start-stop-daemon --stop --quiet \
67 --exec /sbin/dhclient --pidfile "${pidfile}"
68 ;;
69 esac
70 eend $?
71 }
72
73 # vim: set ts=4 :

  ViewVC Help
Powered by ViewVC 1.1.20