On 01/06/2011 21:16, Freddie Cash wrote:
The OpenVPN port does a pretty good job of this. Default rc.d script
is just openvpn. But you can create manual symlinks to it using
openvpn_somename, and it checks rc.conf for openvpn_somename_enable.
Having to manually create the symlink is kind of needed in the openvpn
setup and can lead to left-over files on port removal, but wouldn't be
needed for dhcpd.
Might want to look through the openvpn rc script for ideas.
Yeah, I'm actually kind of embarrassed that I didn't mention that
explicitly, since I was working with openvpn the other day. :) The
script can be simplified with the attached patch. The eval's are a
necessary evil without some other mechanism for setting the defaults.
The patch also removes the default empty variable assignments which are
never necessary or desirable.
hth,
Doug
--
Nothin' ever doesn't change, but nothin' changes much.
-- OK Go
Breadth of IT experience, and depth of knowledge in the DNS.
Yours for the right price. :) http://SupersetSolutions.com/
Index: openvpn.sh.in
===================================================================
RCS file: /home/pcvs/ports/security/openvpn/files/openvpn.sh.in,v
retrieving revision 1.14
diff -u -r1.14 openvpn.sh.in
--- openvpn.sh.in 4 Aug 2010 19:53:56 -0000 1.14
+++ openvpn.sh.in 7 Jan 2011 20:25:58 -0000
@@ -31,7 +31,7 @@
# -----------------------------------------------------------------------------
#
# This script supports running multiple instances of openvpn.
-# To run additional instance link this script to something like
+# To run additional instances link this script to something like
# % ln -s openvpn openvpn_foo
# and define additional openvpn_foo_* variables in one of
# /etc/rc.conf, /etc/rc.conf.local or /etc/rc.conf.d/openvpn_foo
@@ -63,25 +63,13 @@
. /etc/rc.subr
-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=$(basename "$_file" .sh)
- ;;
-*)
- name=$(basename "$0" .sh)
- ;;
-esac
+name="${0%%*/}"
rcvar=$(set_rcvar)
openvpn_precmd()
{
for i in $interfaces ; do
- # FreeBSD <= 5.4 does not know kldstat's -m option
- # FreeBSD >= 6.0 does not add debug.* sysctl information
- # in the default build - we check both to keep things simple
if ! sysctl debug.if_${i}_debug >/dev/null 2>&1 \
&& ! kldstat -m if_${i} >/dev/null 2>&1 ; then
if ! kldload if_${i} ; then
@@ -123,8 +111,6 @@
load_rc_config ${name}
eval ": \${${name}_enable:=\"NO\"}"
-eval ": \${${name}_flags:=\"\"}"
-eval ": \${${name}_if:=\"\"}"
eval ": \${${name}_configfile:=\"%%PREFIX%%/etc/openvpn/${name}.conf\"}"
eval ": \${${name}_dir:=\"%%PREFIX%%/etc/openvpn\"}"
_______________________________________________
freebsd-ports@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to "freebsd-ports-unsubscr...@freebsd.org"