aboutsummaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorWesley Shields <wxs@FreeBSD.org>2011-02-14 02:21:27 +0000
committerWesley Shields <wxs@FreeBSD.org>2011-02-14 02:21:27 +0000
commitc6d65e84f29a6952091c9792818a0e8d2577b33f (patch)
tree5e0db74fd0e73a151ffd7f98aa9cbcd3b4a63288 /net
parenta0ea37c2d8b5851dd7058703e26638c36a2b720c (diff)
downloadports-c6d65e84f29a6952091c9792818a0e8d2577b33f.tar.gz
ports-c6d65e84f29a6952091c9792818a0e8d2577b33f.zip
Notes
Diffstat (limited to 'net')
-rw-r--r--net/isc-dhcp41-server/Makefile14
-rw-r--r--net/isc-dhcp41-server/files/isc-dhcpd.in196
-rw-r--r--net/isc-dhcp41-server/pkg-plist5
3 files changed, 120 insertions, 95 deletions
diff --git a/net/isc-dhcp41-server/Makefile b/net/isc-dhcp41-server/Makefile
index bed943b09073..921ab20a625f 100644
--- a/net/isc-dhcp41-server/Makefile
+++ b/net/isc-dhcp41-server/Makefile
@@ -20,7 +20,7 @@ MAINTAINER= wxs@FreeBSD.org
COMMENT?= The ISC Dynamic Host Configuration Protocol server
PATCHLEVEL= P1
-PORTREVISION_SERVER= 1
+PORTREVISION_SERVER= 2
PORTREVISION_CLIENT= 0
PORTREVISION_RELAY= 0
@@ -70,7 +70,7 @@ MAN8= dhcpd.8
MAN1= omshell.1
MAN3= dhcpctl.3 omapi.3
CFLAGS+= -fPIC
-CONF_FILE= dhcpd.conf
+CONF_FILE= dhcpd.conf dhcpd6.conf
.else
MAN8= dhcrelay.8
.endif
@@ -152,6 +152,8 @@ do-install:
${MAKE} -C ${WRKSRC}/includes install
${MAKE} -C ${WRKSRC}/common install
${INSTALL_DATA} ${WRKSRC}/dhcpctl/dhcpctl.h ${PREFIX}/include
+ ${INSTALL_DATA} ${WRKSRC}/doc/examples/dhcpd-dhcpv6.conf \
+ ${PREFIX}/etc/dhcpd6.conf.sample
.endif
.if defined(WITH_DHCP_LDAP)
@${MKDIR} ${SCHEMA_DIR}
@@ -166,12 +168,16 @@ do-install:
post-install:
.if defined(CONF_FILE)
- if [ ! -f ${PREFIX}/etc/${CONF_FILE} ]; then \
- ${CP} -p ${PREFIX}/etc/${CONF_FILE}.sample ${PREFIX}/etc/${CONF_FILE} ; \
+.for FILE in ${CONF_FILE}
+ if [ ! -f ${PREFIX}/etc/${FILE} ]; then \
+ ${CP} -p ${PREFIX}/etc/${FILE}.sample ${PREFIX}/etc/${FILE} ; \
fi
+.endfor
.endif
.if ${SUBSYS} == client
${INSTALL_SCRIPT} ${WRKSRC}/client/scripts/freebsd ${PREFIX}/sbin/dhclient-script
+.elif ${SUBSYS} == server
+ @${LN} -sf isc-dhcpd ${PREFIX}/etc/rc.d/isc-dhcpd6
.endif
@${SED} ${PKGMESSAGE_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \
${MSG_FILE} > ${PKGMESSAGE}
diff --git a/net/isc-dhcp41-server/files/isc-dhcpd.in b/net/isc-dhcp41-server/files/isc-dhcpd.in
index a0011bd5c1e4..0cb9fbb22b8f 100644
--- a/net/isc-dhcp41-server/files/isc-dhcpd.in
+++ b/net/isc-dhcp41-server/files/isc-dhcpd.in
@@ -14,25 +14,36 @@
. /etc/rc.subr
-name=dhcpd
+case $0 in
+/etc/rc*)
+ # during boot (shutdown) $0 is /etc/rc (/etc/rc.shutdown),
+ # so get the name of the script from $_file
+ name=$_file
+ ;;
+*)
+ name=$0
+ ;;
+esac
+
+name=${name##*/isc-}
paranoia=%%PARANOIA%% # compiled in paranoia?
load_rc_config ${name}
# override these variables in /etc/rc.conf
-dhcpd_enable=${dhcpd_enable:-"NO"}
+eval ": \${${name}_enable:=\"NO\"}"
# dhcpd_flags="" # -q -early_chroot # command option(s)
# dhcpd_ifaces="" # ethernet interface(s)
-dhcpd_conf=${dhcpd_conf:-%%PREFIX%%/etc/${name}.conf} # configuration file
-dhcpd_withumask=${dhcpd_withumask:-022} # file creation mask
+eval ": \${${name}_conf:=%%PREFIX%%/etc/${name}.conf}" # configuration file
+eval ": \${${name}_withumask:=022}" # file creation mask
-dhcpd_chuser_enable=${dhcpd_chuser_enable:-"%%PARANOIA%%"} # runs w/o privileges?
-dhcpd_withuser=${dhcpd_withuser:-${name}} # user name to run as
-dhcpd_withgroup=${dhcpd_withgroup:-${name}} # group name to run as
+eval ": \${${name}_chuser_enable:=\"%%PARANOIA%%\"}" # runs w/o privileges?
+eval ": \${${name}_withuser:=dhcpd}" # user name to run as
+eval ": \${${name}_withgroup:=dhcpd}" # group name to run as
-dhcpd_chroot_enable=${dhcpd_chroot_enable:-"NO"} # runs chrooted?
-dhcpd_devfs_enable=${dhcpd_devfs_enable:-"YES"} # devfs if available?
-dhcpd_rootdir=${dhcpd_rootdir:-/var/db/${name}} # directory to run in
+eval ": \${${name}_chroot_enable:=\"NO\"}" # runs chrooted?
+eval ": \${${name}_devfs_enable:=\"YES\"}" # devfs if available?
+eval ": \${${name}_rootdir:=/var/db/${name}}" # directory to run in
# dhcpd_includedir="" # directory for included config files
safe_run () # rc command [args...]
@@ -86,8 +97,8 @@ safe_chmog () # entry...
{
local _entry _user _group _usergroup _rc
- _user=${dhcpd_withuser}
- _group=${dhcpd_withgroup}
+ eval "_user=\${${name}_withuser}"
+ eval "_group=\${${name}_withgroup}"
_rc=0
if [ -n "${_user}" -o -n "${_group}" ]; then
@@ -219,7 +230,7 @@ mounted () # dir...
local _rc
_rc=1
- if checkyesno dhcpd_devfs_enable; then
+ if checkyesno ${name}_devfs_enable; then
mount -t devfs | awk '
BEGIN { n = ARGC; ARGC = 2 }
{ for (i = 2; i != n; i++) if ($3 == ARGV[i]) exit 1 }
@@ -236,7 +247,7 @@ safe_mount () # dir
_dir=$1
_rc=0
- if checkyesno dhcpd_devfs_enable &&
+ if checkyesno ${name}_devfs_enable &&
! mounted ${_dir} &&
! safe_run ${_rc} mount -t devfs devfs ${_dir}; then
err 1 "unable to mount ${_dir}"
@@ -252,7 +263,7 @@ safe_umount () # dir
_dir=$1
_rc=0
- if checkyesno dhcpd_devfs_enable &&
+ if checkyesno ${name}_devfs_enable &&
mounted ${_dir} &&
! safe_run ${_rc} umount ${_dir}; then
warn "unable to unmount ${_dir}"
@@ -264,15 +275,15 @@ safe_umount () # dir
check_chuser ()
{
if checkyesno paranoia; then
- if checkyesno dhcpd_chuser_enable &&
- [ -z "${dhcpd_withuser}" -a -z "${dhcpd_withgroup}" ]; then
- err 1 "one of dhcpd_withuser and dhcpd_withgroup" \
- "must be set if dhcpd_chuser_enable is enabled"
+ if checkyesno ${name}_chuser_enable &&
+ eval "[ -z \"\${${name}_withuser}\" -a -z \"\${${name}_withgroup}\" ]"; then
+ err 1 "one of ${name}_withuser and ${name}_withgroup" \
+ "must be set if ${name}_chuser_enable is enabled"
fi
else
- if checkyesno dhcpd_chuser_enable; then
- warn "dhcpd_chuser_enable disabled -- not compiled in"
- dhcpd_chuser_enable=NO
+ if checkyesno ${name}_chuser_enable; then
+ warn "${name}_chuser_enable disabled -- not compiled in"
+ eval "${name}_chuser_enable=NO"
fi
fi
}
@@ -280,82 +291,82 @@ check_chuser ()
check_chroot ()
{
if checkyesno paranoia; then
- if checkyesno dhcpd_chroot_enable; then
- if [ -z "${dhcpd_rootdir}" ]; then
- err 1 "dhcpd_rootdir must be set" \
- "if dhcpd_chroot_enable is enabled"
+ if checkyesno ${name}_chroot_enable; then
+ if eval "[ -z \"\${${name}_rootdir}\" ]"; then
+ err 1 "${name}_rootdir must be set" \
+ "if ${name}_chroot_enable is enabled"
fi
if test `uname -r | cut -c 1` -le 6; then
- if checkyesno dhcpd_devfs_enable &&
+ if checkyesno ${name}_devfs_enable &&
! ( type mount_devfs ) > /dev/null 2>&1;
then
- warn "dhcpd_devfs_enable disabled" \
+ warn "${name}_devfs_enable disabled" \
"-- not available"
- dhcpd_devfs_enable=NO
+ eval "${name}_devfs_enable=NO"
fi
fi
else
- dhcpd_devfs_enable=NO
+ eval "${name}_devfs_enable=NO"
fi
else
- if checkyesno dhcpd_chroot_enable; then
- warn "dhcpd_chroot_enable disabled -- not compiled in"
- dhcpd_chroot_enable=NO
+ if checkyesno ${name}_chroot_enable; then
+ warn "${name}_chroot_enable disabled -- not compiled in"
+ eval "${name}_chroot_enable=NO"
fi
- dhcpd_devfs_enable=NO
+ eval "${name}_devfs_enable=NO"
fi
}
rcvar_chuser ()
{
- if checkyesno paranoia && checkyesno dhcpd_chuser_enable; then
- dhcpd_piddir=${__dhcpd_piddir}/${name}
- dhcpd_leasesdir=${__dhcpd_leasesdir}/${name}
+ if checkyesno paranoia && checkyesno ${name}_chuser_enable; then
+ eval "${name}_piddir=\${__dhcpd_piddir}/\${name}"
+ eval "${name}_leasesdir=\${__dhcpd_leasesdir}/\${name}"
else
- dhcpd_withuser= dhcpd_withgroup=
+ eval unset "${name}_withuser= ${name}_withgroup="
fi
}
rcvar_chroot ()
{
- if ! checkyesno paranoia || ! checkyesno dhcpd_chroot_enable; then
- dhcpd_rootdir=
- elif checkyesno paranoia && checkyesno dhcpd_chroot_enable; then
- dhcpd_devdir=${__dhcpd_devdir}
- dhcpd_etcdir=${__dhcpd_etcdir}
+ if ! checkyesno paranoia || ! checkyesno ${name}_chroot_enable; then
+ eval "${name}_rootdir="
+ elif checkyesno paranoia && checkyesno ${name}_chroot_enable; then
+ eval "${name}_devdir=\${__dhcpd_devdir}"
+ eval "${name}_etcdir=\${__dhcpd_etcdir}"
fi
}
rcvar_pidnleases ()
{
- if ! checkyesno dhcpd_chuser_enable; then
- dhcpd_piddir=${__dhcpd_piddir}
- dhcpd_leasesdir=${__dhcpd_leasesdir}
+ if ! checkyesno ${name}_chuser_enable; then
+ eval "${name}_piddir=\${__dhcpd_piddir}"
+ eval "${name}_leasesdir=\${__dhcpd_leasesdir}"
fi
- dhcpd_pidfile=${dhcpd_piddir}/${name}.pid
- dhcpd_leasesfile=${dhcpd_leasesdir}/${name}.leases
- dhcpd_conffile=${dhcpd_conf} # for convenience only
- dhcpd_confdir=$(dirname ${dhcpd_conffile})
+ eval "${name}_pidfile=\${${name}_piddir}/\${name}.pid"
+ eval "${name}_leasesfile=\${${name}_leasesdir}/\${name}.leases"
+ eval "${name}_conffile=\${${name}_conf}" # for convenience only
+ eval "${name}_confdir=\$(dirname \${${name}_conffile})"
}
rcvar_rooted ()
{
- _dhcpd_rootdir=${dhcpd_rootdir}
- _dhcpd_devdir=${dhcpd_rootdir}${dhcpd_devdir}
- _dhcpd_etcdir=${dhcpd_rootdir}${dhcpd_etcdir}
- _dhcpd_confdir=${dhcpd_rootdir}${dhcpd_confdir}
- _dhcpd_includedir=${dhcpd_rootdir}${dhcpd_includedir}
- _dhcpd_piddir=${dhcpd_rootdir}${dhcpd_piddir}
- _dhcpd_leasesdir=${dhcpd_rootdir}${dhcpd_leasesdir}
- _dhcpd_conffile=${dhcpd_rootdir}${dhcpd_conffile}
- _dhcpd_pidfile=${dhcpd_rootdir}${dhcpd_pidfile}
- _dhcpd_leasesfile=${dhcpd_rootdir}${dhcpd_leasesfile}
+ eval "_dhcpd_rootdir=\${${name}_rootdir}"
+ eval "_dhcpd_devdir=\${${name}_rootdir}\${${name}_devdir}"
+ eval "_dhcpd_etcdir=\${${name}_rootdir}\${${name}_etcdir}"
+ eval "_dhcpd_confdir=\${${name}_rootdir}\${${name}_confdir}"
+ eval "_dhcpd_includedir=\${${name}_rootdir}\${${name}_includedir}"
+ eval "_dhcpd_piddir=\${${name}_rootdir}\${${name}_piddir}"
+ eval "_dhcpd_leasesdir=\${${name}_rootdir}\${${name}_leasesdir}"
+ eval "_dhcpd_conffile=\${${name}_rootdir}\${${name}_conffile}"
+ eval "_dhcpd_pidfile=\${${name}_rootdir}\${${name}_pidfile}"
+ eval "_dhcpd_leasesfile=\${${name}_rootdir}\${${name}_leasesfile}"
}
setup_umask ()
{
- if [ -n "${dhcpd_withumask}" ]; then
- umask ${dhcpd_withumask}
+ if eval "[ -n \"\${${name}_withumask}\" ]"; then
+ eval "umask \${${name}_withumask}"
fi
}
@@ -368,27 +379,27 @@ setup_chroot ()
_ltime=localtime
_rconf=resolv.conf
- if checkyesno paranoia && checkyesno dhcpd_chroot_enable; then
+ if checkyesno paranoia && checkyesno ${name}_chroot_enable; then
if ! mounted ${_dhcpd_devdir}; then
safe_mkdir ${_dhcpd_devdir}/_
# XXX /_ hack! so, .../dev is root owned.
fi
safe_mkdir ${_dhcpd_rootdir} ${_dhcpd_etcdir}/_ ${_dhcpd_confdir}
# XXX /_ hack! so, .../etc is root owned.
- if checkyesno dhcpd_devfs_enable; then
+ if checkyesno ${name}_devfs_enable; then
safe_mount ${_dhcpd_devdir}
else
- safe_copy ${dhcpd_devdir} ${_dhcpd_devdir}
+ eval "safe_copy \${${name}_devdir} \${_dhcpd_devdir}"
fi
- safe_copy ${dhcpd_conffile} ${_dhcpd_conffile}
- safe_copy ${dhcpd_etcdir}/$_hconf ${_dhcpd_etcdir}/$_hconf
- safe_copy ${dhcpd_etcdir}/$_hosts ${_dhcpd_etcdir}/$_hosts
- safe_copy ${dhcpd_etcdir}/$_ltime ${_dhcpd_etcdir}/$_ltime
- safe_copy ${dhcpd_etcdir}/$_rconf ${_dhcpd_etcdir}/$_rconf
+ eval "safe_copy \${${name}_conffile} \${_dhcpd_conffile}"
+ eval "safe_copy \${${name}_etcdir}/\$_hconf \${_dhcpd_etcdir}/\$_hconf"
+ eval "safe_copy \${${name}_etcdir}/\$_hosts \${_dhcpd_etcdir}/\$_hosts"
+ eval "safe_copy \${${name}_etcdir}/\$_ltime \${_dhcpd_etcdir}/\$_ltime"
+ eval "safe_copy \${${name}_etcdir}/\$_rconf \${_dhcpd_etcdir}/\$_rconf"
# copy dhcpd_includedir if defined and available
- if [ -d "${dhcpd_includedir}" ]; then
+ if eval "[ -d \"\${${name}_includedir}\" ]"; then
safe_mkdir ${_dhcpd_includedir}
- safe_copy ${dhcpd_includedir} ${_dhcpd_includedir}
+ eval "safe_copy \${${name}_includedir} \${_dhcpd_includedir}"
fi
fi
}
@@ -396,7 +407,7 @@ setup_chroot ()
setup_chuser ()
{
if checkyesno paranoia && {
- checkyesno dhcpd_chuser_enable || checkyesno dhcpd_chroot_enable
+ checkyesno ${name}_chuser_enable || checkyesno ${name}_chroot_enable
}; then
safe_mkdir ${_dhcpd_piddir} ${_dhcpd_leasesdir}
fi
@@ -409,30 +420,33 @@ setup_leases ()
setup_flags ()
{
- if [ -n "${dhcpd_conf}" ]; then
- rc_flags="${rc_flags} -cf ${dhcpd_conf}"
+ if [ "${name}" = "dhcpd6" ]; then
+ rc_flags="${rc_flags} -6"
fi
- if [ -n "${dhcpd_leasesfile}" ]; then
- rc_flags="${rc_flags} -lf ${dhcpd_leasesfile}"
+ if eval "[ -n \"\${${name}_conf}\" ]"; then
+ eval "rc_flags=\"\${rc_flags} -cf \${${name}_conf}\""
fi
- if [ -n "${dhcpd_pidfile}" ]; then
- rc_flags="${rc_flags} -pf ${dhcpd_pidfile}"
+ if eval "[ -n \"\${${name}_leasesfile}\" ]"; then
+ eval "rc_flags=\"\${rc_flags} -lf \${${name}_leasesfile}\""
fi
- if [ -n "${dhcpd_withuser}" ]; then
- rc_flags="${rc_flags} -user ${dhcpd_withuser}"
+ if eval "[ -n \"\${${name}_pidfile}\" ]"; then
+ eval "rc_flags=\"\${rc_flags} -pf \${${name}_pidfile}\""
fi
- if [ -n "${dhcpd_withgroup}" ]; then
- rc_flags="${rc_flags} -group ${dhcpd_withgroup}"
+ if eval "[ -n \"\${dhcpd_withuser}\" ]"; then
+ eval "rc_flags=\"\${rc_flags} -user \${${name}_withuser}\""
fi
- if [ -n "${dhcpd_rootdir}" ]; then
- rc_flags="${rc_flags} -chroot ${dhcpd_rootdir}"
+ if eval "[ -n \"\${${name}_withgroup}\" ]"; then
+ eval "rc_flags=\"\${rc_flags} -group \${${name}_withgroup}\""
fi
- rc_flags="${rc_flags} ${dhcpd_ifaces}"
+ if eval "[ -n \"\${${name}_rootdir}\" ]"; then
+ eval "rc_flags=\"\${rc_flags} -chroot \${${name}_rootdir}\""
+ fi
+ eval "rc_flags=\"\${rc_flags} \${${name}_ifaces}\""
}
cleanup_chroot ()
{
- if checkyesno paranoia && checkyesno dhcpd_chroot_enable; then
+ if checkyesno paranoia && checkyesno ${name}_chroot_enable; then
safe_umount ${_dhcpd_devdir}
fi
}
@@ -499,11 +513,11 @@ __dhcpd_leasesdir=/var/db # leases file directory
dhcpd_check
dhcpd_rcvar
-command=%%PREFIX%%/sbin/${name}
+command=%%PREFIX%%/sbin/dhcpd
pidfile=${_dhcpd_pidfile}
-required_files=${dhcpd_conf}
-start_precmd=${name}_precmd
-stop_postcmd=${name}_postcmd
+eval "required_files=\${${name}_conf}"
+start_precmd=dhcpd_precmd
+stop_postcmd=dhcpd_postcmd
restart_precmd="dhcpd_checkconfig"
uninstall_cmd=dhcpd_uninstall
extra_commands="uninstall"
diff --git a/net/isc-dhcp41-server/pkg-plist b/net/isc-dhcp41-server/pkg-plist
index c4f0a0a1a04f..cf370863aa94 100644
--- a/net/isc-dhcp41-server/pkg-plist
+++ b/net/isc-dhcp41-server/pkg-plist
@@ -1,8 +1,13 @@
@comment $FreeBSD$
@unexec %D/etc/rc.d/isc-dhcpd forcestop 2>/dev/null || true
+@unexec %D/etc/rc.d/isc-dhcpd6 forcestop 2>/dev/null || true
@unexec if cmp -s %D/etc/dhcpd.conf.sample %D/etc/dhcpd.conf; then rm -f %D/etc/dhcpd.conf; fi
etc/dhcpd.conf.sample
@exec if [ ! -f %D/etc/dhcpd.conf ] ; then cp -p %D/%F %B/dhcpd.conf; fi
+@unexec if cmp -s %D/etc/dhcpd6.conf.sample %D/etc/dhcpd6.conf; then rm -f %D/etc/dhcpd6.conf; fi
+etc/dhcpd6.conf.sample
+@exec if [ ! -f %D/etc/dhcpd6.conf ] ; then cp -p %D/%F %B/dhcpd6.conf; fi
+etc/rc.d/isc-dhcpd6
sbin/dhcpd
bin/omshell
%%LDAP%%bin/dhcpd-conf-to-ldap