aboutsummaryrefslogtreecommitdiff
path: root/net/ucarp
diff options
context:
space:
mode:
authorPav Lucistnik <pav@FreeBSD.org>2006-12-09 14:12:00 +0000
committerPav Lucistnik <pav@FreeBSD.org>2006-12-09 14:12:00 +0000
commitd241b07ec3d7688f7ad671cae7654c4db3c4000b (patch)
tree07cd87dce97ab8cfd794c5b80f67be68dda10758 /net/ucarp
parent82643329cbd97259ae4b269888b78bc645301a10 (diff)
downloadports-d241b07ec3d7688f7ad671cae7654c4db3c4000b.tar.gz
ports-d241b07ec3d7688f7ad671cae7654c4db3c4000b.zip
- Add a startup script
PR: ports/105601 Submitted by: Nicolas Szalay <nico@rottenbytes.info> Approved by: maintainer timeout (3 weeks)
Notes
Notes: svn path=/head/; revision=179302
Diffstat (limited to 'net/ucarp')
-rw-r--r--net/ucarp/Makefile3
-rw-r--r--net/ucarp/files/ucarp.in103
2 files changed, 106 insertions, 0 deletions
diff --git a/net/ucarp/Makefile b/net/ucarp/Makefile
index 68df83bbf956..03b9acde7899 100644
--- a/net/ucarp/Makefile
+++ b/net/ucarp/Makefile
@@ -7,6 +7,7 @@
PORTNAME= ucarp
PORTVERSION= 1.2
+PORTREVISION= 1
CATEGORIES= net
MASTER_SITES= ftp://ftp.ucarp.org/pub/ucarp/
@@ -18,6 +19,8 @@ CONFIGURE_ARGS= --disable-nls
USE_BZIP2= yes
GNU_CONFIGURE= yes
+USE_RC_SUBR= ucarp
+
PLIST_FILES= sbin/ucarp
.include <bsd.port.mk>
diff --git a/net/ucarp/files/ucarp.in b/net/ucarp/files/ucarp.in
new file mode 100644
index 000000000000..8dc2f7a8cb5b
--- /dev/null
+++ b/net/ucarp/files/ucarp.in
@@ -0,0 +1,103 @@
+#!/bin/sh
+#
+# Init script : ucarp for FreeBSD
+# By Nico <nico@rottenbytes.info>
+#
+# PROVIDE: ucarp
+# REQUIRE: DAEMON
+# KEYWORD: shutdown
+#
+# Add the following lines to /etc/rc.conf to enable & configure ucarp:
+#
+# ucarp_enable (bool): Set it to "YES" to enable ucarp
+# Default is "NO".
+# ucarp_if: Set interface to use for ucarp checks
+# Default is "eth0"
+# ucarp_src: Set source (real) IP address of that host
+# ucarp_vhid: Set virtual IP identifier (1-255)
+# Default is "1"
+# ucarp_pass: Set password
+# Default is "dumbp4ss"
+# ucarp_preempt (bool): Set it to "YES" to become a master as soon as possible
+# Default is "NO"
+# ucarp_addr: Set virtual shared IP address
+# ucarp_advbase: Set advertisement frequency (seconds)
+# ucarp_advskew: Set advertisement skew (0-255)
+# ucarp_upscript: Run <file> to become a master
+# ucarp_downscript: Run <file> to become a backup
+# ucarp_deadratio: Set ratio to consider a host as dead
+# ucarp_shutdown (bool): Set it to "YES" to call shutdown script at exit
+# Default is "YES"
+# ucarp_facility: Set syslog facility
+# Default is "daemon"
+
+. %%RC_SUBR%%
+
+name="ucarp"
+rcvar=`set_rcvar`
+
+load_rc_config $name
+
+: ${ucarp_enable="NO"}
+: ${ucarp_if="eth0"}
+: ${ucarp_vhid="1"}
+: ${ucarp_pass="dumbp4ss"}
+: ${ucarp_preempt="NO"}
+: ${ucarp_shutdown="YES"}
+: ${ucarp_facility="daemon"}
+
+command=%%PREFIX%%/sbin/ucarp
+command_args="-i ${ucarp_if} -v ${ucarp_vhid} -p ${ucarp_pass} -f ${ucarp_facility} -B "
+start_precmd="build_command_args"
+
+build_command_args()
+{
+ if [ ${ucarp_preempt} = "YES" ]
+ then
+ command_args=${command_args}"-P "
+ fi
+
+ if [ ${ucarp_shutdown} = "YES" ]
+ then
+ command_args=${command_args}"-z "
+ fi
+
+ # Mandatory arguments
+ if [ -z ${ucarp_src} ]
+ then
+ echo "source address is not set ! please set it"
+ exit 1
+ fi
+
+ if [ -z ${ucarp_addr} ]
+ then
+ echo "virtual address is not set ! please set it"
+ exit 1
+ fi
+
+ command_args=${command_args}"-s ${ucarp_src} -a ${ucarp_addr} "
+
+ # Optional args
+ if ! [ -z ${ucarp_upscript} ]
+ then
+ command_args=${command_args}"-u ${ucarp_upscript} "
+ fi
+ if ! [ -z ${ucarp_downscript} ]
+ then
+ command_args=${command_args}"-d ${ucarp_downscript} "
+ fi
+ if ! [ -z ${ucarp_deadratio} ]
+ then
+ command_args=${command_args}"-r ${ucarp_deadratio} "
+ fi
+ if ! [ -z ${ucarp_advbase} ]
+ then
+ command_args=${command_args}"-b ${ucarp_advbase} "
+ fi
+ if ! [ -z ${ucarp_advskew} ]
+ then
+ command_args=${command_args}"-k ${ucarp_advskew} "
+ fi
+}
+
+run_rc_command "$1"