Changeset View
Changeset View
Standalone View
Standalone View
libexec/rc/rc.d/dhcpcd
- This file was added.
#!/bin/sh | |||||
# | |||||
# $FreeBSD$ | |||||
# | |||||
# PROVIDE: dhcpcd | |||||
# REQUIRE: mountcritlocal cleanvar | |||||
driesm: I'm wondering how we tackle the rc script when both dhcpcd exists in base and in ports (and… | |||||
# KEYWORD: nojailvnet | |||||
# BEFORE: NETWORKING netif | |||||
. /etc/rc.subr | |||||
. /etc/network.subr | |||||
name="dhcpcd" | |||||
desc="DHCP/IPv4LL/IPv6RS/DHCPv6 client" | |||||
Not Done Inline ActionsDitto driesm: Ditto | |||||
rcvar= | |||||
command="/sbin/$name" | |||||
extra_commands="reload" | |||||
load_rc_config $name | |||||
load_rc_config network | |||||
ifn="$2" | |||||
if [ -z "$ifn" ]; then | |||||
rcvar=`set_rcvar` # running in master mode | |||||
else | |||||
# Interface-specific flags (see rc.subr for $flags setting) | |||||
_if_args="$(get_if_var $ifn dhcpcd_flags_IF)" | |||||
if [ -z "$flags" -a -n "$_if_args" ]; then | |||||
rc_flags=$_if_args | |||||
fi | |||||
background_dhclient=$(get_if_var $ifn background_dhclient_IF $background_dhclient) | |||||
# Determine whether to enable DHCPv4 and/or DHCPv6 | |||||
if dhcpif $ifn ipv4 && dhcpif $ifn ipv6; then | |||||
command_args="$ifn" | |||||
elif dhcpif $ifn ipv4; then | |||||
command_args="-4 $ifn" | |||||
elif dhcpif $ifn ipv6; then | |||||
command_args="-6 $ifn" | |||||
else | |||||
err 1 "$ifn is not enabled for DHCP (IPv4/IPv6)" | |||||
fi | |||||
fi | |||||
if checkyesno background_dhclient; then | |||||
rc_flags="${rc_flags} -b" | |||||
fi | |||||
# Work out what pidfile dhcpcd will use based on flags | |||||
if [ -n "$flags" ]; then | |||||
_flags=$flags | |||||
elif [ -n "$_if_args" ]; then | |||||
_flags=$_if_args | |||||
else | |||||
eval _flags=\$${name}_flags | |||||
fi | |||||
pidfile=$($command -P $_flags $command_args 2>/dev/null) | |||||
: ${pidfile:=/var/run/$name.pid} | |||||
unset _flags _if_args | |||||
run_rc_command "$@" |
I'm wondering how we tackle the rc script when both dhcpcd exists in base and in ports (and both are installed).
I know for unbound, we made it "local_unbound" for the in-base version, and "unbound" for the port version.
I'm asking this as what happens when dhcpcd is installed from ports and is present in the base system with the same rc identifier, probably will be started twice with one dhcpcd_enable line?