freebsd-ports/net/dhcpcd-devel/files/dhcpcd.in
Ben Woods 120e0ba402 net/dhcpcd-devel: Add new port - development verion of net/dhcpcd
This is an experimental version for testing purposes.

Notably this new development version includes privilege separation;
operations which do not require root are run as the user _dhcp.
2019-11-30 02:37:58 +00:00

43 lines
741 B
Bash

#!/bin/sh
# PROVIDE: dhclient dhcpcd
# KEYWORD: nojail
#
. /etc/rc.subr
. /etc/network.subr
name="dhcpcd"
ifn="$2"
command="%%PREFIX%%/sbin/dhcpcd"
command_args="$ifn"
if [ -n "$ifn" ]; then
specific="$(get_if_var $ifn dhcpcd_flags_IF)"
if [ -z "$flags" -a -n "$specific" ]; then
rc_flags="$specific"
fi
pidfile="/var/run/dhcpcd/dhcpcd-$ifn.pid"
else
pidfile="$($command -P $rc_flags)"
: ${dhcpcd_enable:=NO}
rcvar=dhcpcd_enable
fi
start_precmd="dhcpcd_precmd"
dhcpcd_precmd()
{
# dhcpcd may need local binaries
export PATH=${PATH}:/usr/local/sbin:/usr/local/bin
}
load_rc_config $name
load_rc_config network
if [ -n "$ifn" ]; then
if ! dhcpif $ifn; then
err 1 "$ifn is not enabled for DHCP"
fi
fi
run_rc_command "$1"