From 7bf0500224ffb83e5776a2495bb245873885477d Mon Sep 17 00:00:00 2001 From: shige Date: Fri, 20 Apr 2001 18:31:53 +0000 Subject: Add a sample startup script for dhcpd. --- net/isc-dhcp2/Makefile | 5 ++++ net/isc-dhcp2/files/isc-dhcpd.sh.sample | 48 +++++++++++++++++++++++++++++++++ net/isc-dhcp2/pkg-plist | 1 + 3 files changed, 54 insertions(+) create mode 100644 net/isc-dhcp2/files/isc-dhcpd.sh.sample (limited to 'net') diff --git a/net/isc-dhcp2/Makefile b/net/isc-dhcp2/Makefile index 8b7c0854b157..f314562620c5 100644 --- a/net/isc-dhcp2/Makefile +++ b/net/isc-dhcp2/Makefile @@ -16,6 +16,9 @@ MAINTAINER= jseger@FreeBSD.org HAS_CONFIGURE= yes +STARTUP_SCRIPT= isc-dhcpd.sh.sample +PLIST_SUB= STARTUP_SCRIPT=${STARTUP_SCRIPT} + MAN5= dhcp-options.5 dhcpd.conf.5 dhcpd.leases.5 MAN8= dhcpd.8 dhcrelay.8 @@ -29,5 +32,7 @@ post-install: strip ${PREFIX}/sbin/${file}; \ fi .endfor + ${INSTALL_SCRIPT} ${FILESDIR}/${STARTUP_SCRIPT} \ + ${PREFIX}/etc/rc.d/${STARTUP_SCRIPT} .include diff --git a/net/isc-dhcp2/files/isc-dhcpd.sh.sample b/net/isc-dhcp2/files/isc-dhcpd.sh.sample new file mode 100644 index 000000000000..2c047ce00bcb --- /dev/null +++ b/net/isc-dhcp2/files/isc-dhcpd.sh.sample @@ -0,0 +1,48 @@ +#!/bin/sh +# $FreeBSD$ +# startup scripts for ISC DHCPD. + +if ! PREFIX=$(expr $0 : "\(/.*\)/etc/rc\.d/$(basename $0)\$"); then + echo "$0: Cannot determine the PREFIX" >&2 + exit 1 +fi + +# If there is a global system configuration file, suck it in. +if [ -r /etc/defaults/rc.conf ]; then + . /etc/defaults/rc.conf + source_rc_confs +elif [ -r /etc/rc.conf ]; then + . /etc/rc.conf +fi + +isc_dhcpd_enable=${isc_dhcpd_enable:-YES} +isc_dhcpd_program=${isc_dhcpd_program:-${PREFIX}/sbin/dhcpd} +isc_dhcpd_flags=${isc_dhcpd_flags:-'-q'} +isc_dhcpd_pidfile=${isc_dhcpd_pidfile:-/var/run/dhcpd.pid} + +case $1 in +start) + case "${isc_dhcpd_enable}" in + [Yy][Ee][Ss]) + if [ -f ${isc_dhcpd_program} ]; then + echo -n " isc-dhcpd" + ${isc_dhcpd_program} ${isc_dhcpd_flags} + fi + ;; + esac + ;; +stop) + if [ -f ${isc_dhcpd_pidfile} ]; then + PID=`cat ${isc_dhcpd_pidfile}` + kill -KILL $PID + fi + ;; +retstart) + $0 stop && $0 start; + ;; +*) + echo "usage: $0 {start|stop|restart}" 1>&2 + ;; +esac + +exit 0; diff --git a/net/isc-dhcp2/pkg-plist b/net/isc-dhcp2/pkg-plist index 576a2be0296d..901e978ad1f2 100644 --- a/net/isc-dhcp2/pkg-plist +++ b/net/isc-dhcp2/pkg-plist @@ -1,4 +1,5 @@ sbin/dhcpd sbin/dhcrelay +etc/rc.d/%%STARTUP_SCRIPT%% @exec touch /var/db/dhcpd.leases @exec touch %D/etc/dhclient.conf -- cgit