diff options
Diffstat (limited to 'net/isc-dhcp40-server/files')
-rw-r--r-- | net/isc-dhcp40-server/files/isc-dhcpd.sh.sample | 69 | ||||
-rw-r--r-- | net/isc-dhcp40-server/files/isc-dhcrelay.sh.sample | 78 | ||||
-rw-r--r-- | net/isc-dhcp40-server/files/patch-freebsd | 8 | ||||
-rw-r--r-- | net/isc-dhcp40-server/files/patch-site.conf | 2 | ||||
-rw-r--r-- | net/isc-dhcp40-server/files/rc.isc-dhcpd.conf.sample | 7 | ||||
-rw-r--r-- | net/isc-dhcp40-server/files/rc.isc-dhcrelay.conf.sample | 8 |
6 files changed, 155 insertions, 17 deletions
diff --git a/net/isc-dhcp40-server/files/isc-dhcpd.sh.sample b/net/isc-dhcp40-server/files/isc-dhcpd.sh.sample index bd9f10dbc3fd..17472ab3bb71 100644 --- a/net/isc-dhcp40-server/files/isc-dhcpd.sh.sample +++ b/net/isc-dhcp40-server/files/isc-dhcpd.sh.sample @@ -1,32 +1,77 @@ #! /bin/sh - +# # $FreeBSD$ +# +# Start or stop isc-dhcpd. +# + +rc_file=${0##*/} +rc_arg=$1 + +# override these variables in ${PREFIX}/etc/rc.isc-dhcpd.conf +dhcpd_options= # command option(s) +dhcpd_ifaces= # ethernet interface(s) + +if ! PREFIX=$(expr $0 : "\(/.*\)/etc/rc\.d/${rc_file}\$"); then + echo "${rc_file}: Cannot determine PREFIX." >&2 + echo "Please use the complete pathname." >&2 + exit 64 +fi -OPTIONS="" -IFACES="" +rcconf_dir=${PREFIX}/etc +rcconf_file=rc.${rc_file%.sh}.conf +rcconf_path=${rcconf_dir}/${rcconf_file} -if ! PREFIX=$(expr $0 : "\(/.*\)/etc/rc\.d/$(basename $0)\$"); then - echo "$0: Cannot determine the PREFIX" >&2 - exit 1 +if [ -f ${rcconf_path} ]; then + . ${rcconf_path} fi -case "$1" in +program_dir=${PREFIX}/sbin +program_file=dhcpd +program_path=${program_dir}/${program_file} + +config_dir=${PREFIX}/etc +config_file=${program_file}.conf +config_path=${config_dir}/${config_file} + +pid_dir=/var/run +pid_file=${program_file}.pid +pid_path=${pid_dir}/${pid_file} + +syslog_facility=daemon.err + +case "$rc_arg" in start) - ${PREFIX}/sbin/dhcpd $OPTIONS $IFACES > /dev/null 2>&1 - echo -n ' dhcpd' + if [ ! -x ${program_path} ]; then + logger -sp ${syslog_facility} -t ${program_file} \ + "unable to start: ${program_path} is missing." + exit 72 + fi + if [ ! -f ${config_path} ]; then + logger -sp ${syslog_facility} -t ${program_file} \ + "unable to start: ${config_path} is missing." + exit 72 + fi + ${program_path} ${dhcpd_options} ${dhcpd_ifaces} && + echo -n " ${program_file}" ;; stop) - killall dhcpd + if [ -r ${pid_path} ]; then + kill $(cat ${pid_path}) 2> /dev/null + else + killall ${program_file} 2> /dev/null + fi ;; restart) $0 stop $0 start ;; status) - ps -auxww | egrep '(conserver|console)' | egrep -v "($0|egrep)" + ps -auxww | egrep ${program_file} | egrep -v "($0|egrep)" ;; *) - echo "usage: ${0##*/} {start|stop|restart|status}" >&2 + echo "usage: ${rc_file} {start|stop|restart|status}" >&2 + exit 64 ;; esac diff --git a/net/isc-dhcp40-server/files/isc-dhcrelay.sh.sample b/net/isc-dhcp40-server/files/isc-dhcrelay.sh.sample new file mode 100644 index 000000000000..de5f111d133c --- /dev/null +++ b/net/isc-dhcp40-server/files/isc-dhcrelay.sh.sample @@ -0,0 +1,78 @@ +#! /bin/sh +# +# $FreeBSD$ +# +# Start or stop isc-dhcrelay. +# + +rc_file=${0##*/} +rc_arg=$1 + +# override these variables in ${PREFIX}/etc/rc.isc-dhcrelay.conf +dhcrelay_options= # command option(s) +dhcrelay_ifaces= # ethernet interface(s) +dhcrelay_servers= # dhcpd server(s) + +if ! PREFIX=$(expr $0 : "\(/.*\)/etc/rc\.d/${rc_file}\$"); then + echo "${rc_file}: Cannot determine PREFIX." >&2 + echo "Please use the complete pathname." >&2 + exit 64 +fi + +rcconf_dir=${PREFIX}/etc +rcconf_file=rc.${rc_file%.sh}.conf +rcconf_path=${rcconf_dir}/${rcconf_file} + +if [ -f ${rcconf_path} ]; then + . ${rcconf_path} +fi + +program_dir=${PREFIX}/sbin +program_file=dhcrelay +program_path=${program_dir}/${program_file} + +pid_dir=/var/run +pid_file=${program_file}.pid +pid_path=${pid_dir}/${pid_file} + +syslog_facility=daemon.err + +case "$rc_arg" in +start) + if [ ! -x ${program_path} ]; then + logger -sp ${syslog_facility} -t ${program_file} \ + "unable to start: ${program_path} is missing." + exit 72 + fi + if [ -z "${dhcrelay_servers}" ]; then + logger -sp ${syslog_facility} -t ${program_file} \ + "unable to start: no dhcpd server(s) configured." + exit 64 + fi + ifaces= + for iface in ${dhcrelay_ifaces}; do + ifaces="$ifaces -i $iface" + done + ${program_path} ${dhcrelay_options} ${ifaces} ${dhcrelay_servers} && + echo -n " ${program_file}" + ;; +stop) + if [ -r ${pid_path} ]; then + kill $(cat ${pid_path}) 2> /dev/null + else + killall ${program_file} 2> /dev/null + fi + ;; +restart) + $0 stop + $0 start + ;; +status) + ps -auxww | egrep ${program_file} | egrep -v "($0|egrep)" + ;; +*) + echo "usage: ${rc_file} {start|stop|restart|status}" >&2 + ;; +esac + +exit 0 diff --git a/net/isc-dhcp40-server/files/patch-freebsd b/net/isc-dhcp40-server/files/patch-freebsd index 62fe0a127a40..287cea9a545b 100644 --- a/net/isc-dhcp40-server/files/patch-freebsd +++ b/net/isc-dhcp40-server/files/patch-freebsd @@ -6,8 +6,8 @@ exit_status=$1 - if [ -f /etc/dhclient-exit-hooks ]; then - . /etc/dhclient-exit-hooks -+ if [ -f !!PREFIX!!/etc/dhclient-exit-hooks ]; then -+ . !!PREFIX!!/etc/dhclient-exit-hooks ++ if [ -f %%PREFIX%%/etc/dhclient-exit-hooks ]; then ++ . %%PREFIX%%/etc/dhclient-exit-hooks fi # probably should do something with exit status of the local script exit $exit_status @@ -15,10 +15,10 @@ # Invoke the local dhcp client enter hooks, if they exist. -if [ -f /etc/dhclient-enter-hooks ]; then -+if [ -f !!PREFIX!!/etc/dhclient-enter-hooks ]; then ++if [ -f %%PREFIX%%/etc/dhclient-enter-hooks ]; then exit_status=0 - . /etc/dhclient-enter-hooks -+ . !!PREFIX!!/etc/dhclient-enter-hooks ++ . %%PREFIX%%/etc/dhclient-enter-hooks # allow the local script to abort processing of this state # local script must set exit_status variable to nonzero. if [ $exit_status -ne 0 ]; then diff --git a/net/isc-dhcp40-server/files/patch-site.conf b/net/isc-dhcp40-server/files/patch-site.conf index 5c14e470dcbc..65f79b6a7550 100644 --- a/net/isc-dhcp40-server/files/patch-site.conf +++ b/net/isc-dhcp40-server/files/patch-site.conf @@ -35,4 +35,4 @@ +CFLAGS += -D_PATH_DHCLIENT_CONF=\"$(ETC)/dhclient.conf\" +CFLAGS += -D_PATH_DHCLIENT_SCRIPT=\"$(CLIENTBINDIR)/dhclient-script\" +CFLAGS += -D_PATH_DHCLIENT_DB=\"$(VARDB)/dhclient.leases\" -+CFLAGS += -D_PATH_DHCLIENT_PID=\"$(VARDB)/dhclient.pid\" ++CFLAGS += -D_PATH_DHCLIENT_PID=\"$(VARRUN)/dhclient.pid\" diff --git a/net/isc-dhcp40-server/files/rc.isc-dhcpd.conf.sample b/net/isc-dhcp40-server/files/rc.isc-dhcpd.conf.sample new file mode 100644 index 000000000000..edfe4bd7dc50 --- /dev/null +++ b/net/isc-dhcp40-server/files/rc.isc-dhcpd.conf.sample @@ -0,0 +1,7 @@ +# $FreeBSD$ +# +# isc-dhcpd startup configuration file. +# + +dhcpd_options= # command option(s) +dhcpd_ifaces= # ethernet interface(s) diff --git a/net/isc-dhcp40-server/files/rc.isc-dhcrelay.conf.sample b/net/isc-dhcp40-server/files/rc.isc-dhcrelay.conf.sample new file mode 100644 index 000000000000..b647c62f6137 --- /dev/null +++ b/net/isc-dhcp40-server/files/rc.isc-dhcrelay.conf.sample @@ -0,0 +1,8 @@ +# $FreeBSD$ +# +# isc-dhcrelay startup configuration file. +# + +dhcrelay_options= # command option(s) +dhcrelay_ifaces= # ethernet interface(s) +dhcrelay_servers= # dhcpd server(s) |