| 1 |
# Copyright 2004-2007 Gentoo Foundation
|
| 2 |
# Distributed under the terms of the GNU General Public License v2
|
| 3 |
|
| 4 |
pump_depend() {
|
| 5 |
program /sbin/pump
|
| 6 |
after interface
|
| 7 |
provide dhcp
|
| 8 |
}
|
| 9 |
|
| 10 |
_config_vars="$_config_vars dhcp pump"
|
| 11 |
|
| 12 |
pump_start() {
|
| 13 |
local args= opt= opts=
|
| 14 |
|
| 15 |
# Get our options
|
| 16 |
eval opts=\$dhcp_${IFVAR}
|
| 17 |
[ -z "${opts}" ] && opts=${dhcp}
|
| 18 |
|
| 19 |
# Map some generic options to dhcpcd
|
| 20 |
for opt in ${opts} ; do
|
| 21 |
case "${opt}" in
|
| 22 |
nodns) args="${args} --no-dns" ;;
|
| 23 |
nontp) args="${args} --no-ntp" ;;
|
| 24 |
nogateway) args="${args} --no-gateway" ;;
|
| 25 |
esac
|
| 26 |
done
|
| 27 |
|
| 28 |
# Add our route metric
|
| 29 |
[ "${metric:-0}" != "0" ] && args="${args} --route-metric ${metric}"
|
| 30 |
|
| 31 |
args="${args} --win-client-ident"
|
| 32 |
args="${args} --keep-up --interface ${IFACE}"
|
| 33 |
|
| 34 |
ebegin "Running pump"
|
| 35 |
eval pump "${args}"
|
| 36 |
eend $? || return 1
|
| 37 |
|
| 38 |
_show_address
|
| 39 |
return 0
|
| 40 |
}
|
| 41 |
|
| 42 |
pump_stop() {
|
| 43 |
# We check for a pump process first as querying for status
|
| 44 |
# causes pump to spawn a process
|
| 45 |
start-stop-daemon --quiet --test --stop --exec /sbin/pump || return 0
|
| 46 |
|
| 47 |
# Check that pump is running on the interface
|
| 48 |
if ! pump --status --interface "${IFACE}" >/dev/null 2>/dev/null ; then
|
| 49 |
return 0
|
| 50 |
fi
|
| 51 |
|
| 52 |
# Pump always releases the lease
|
| 53 |
ebegin "Stopping pump on ${IFACE}"
|
| 54 |
pump --release --interface "${IFACE}"
|
| 55 |
eend $? "Failed to stop pump"
|
| 56 |
}
|
| 57 |
|
| 58 |
# vim: set ts=4 :
|