summaryrefslogtreecommitdiff
path: root/devel/viewvc/files/viewvc.in
diff options
context:
space:
mode:
authorAntoine Brodin <antoine@FreeBSD.org>2021-01-01 10:11:34 +0000
committerAntoine Brodin <antoine@FreeBSD.org>2021-01-01 10:11:34 +0000
commit26b4c8f71f91d22e081b27814782686edde0c90a (patch)
tree1c321c39372c25d8634e75b5c8e08edc676b296d /devel/viewvc/files/viewvc.in
parentNew port: math/py-optuna: A hyperparameter optimization framework (diff)
Revert r559792 to unbreak INDEX and bulk -a
It seems a lot of reverse dependencies were missed With hat: portmgr
Notes
Notes: svn path=/head/; revision=559822
Diffstat (limited to 'devel/viewvc/files/viewvc.in')
-rw-r--r--devel/viewvc/files/viewvc.in70
1 files changed, 70 insertions, 0 deletions
diff --git a/devel/viewvc/files/viewvc.in b/devel/viewvc/files/viewvc.in
new file mode 100644
index 000000000000..064ff67ab917
--- /dev/null
+++ b/devel/viewvc/files/viewvc.in
@@ -0,0 +1,70 @@
+#!/bin/sh
+
+# $FreeBSD$
+#
+# PROVIDE: viewvc
+# REQUIRE: LOGIN
+# KEYWORD: shutdown
+#
+# Add the following line(s) to /etc/rc.conf to enable ViewVC:
+#
+# viewvc_enable="YES"
+# # optional
+# viewvc_flags="-h localhost -p PORT"
+# viewvc_user="www"
+#
+# To get available parameters and the default values, use the
+# command %%PREFIX%%/viewvc/bin/standalone.py --help
+# for more info.
+#
+# Note:
+# If you choose a listen port less then 1024 then you have
+# to use a privileged user.
+# If the user www cannot access your cvs/svn repository,
+# adjust the parameter viewvc_user and it should work.
+#
+# INFO:
+# ViewVC default tcp port: 49152
+# see http://viewvc.tigris.org/issues/show_bug.cgi?id=234
+
+. /etc/rc.subr
+
+name=viewvc
+rcvar=viewvc_enable
+load_rc_config $name
+
+# Set defaults
+viewvc_enable=${viewvc_enable:-"NO"}
+viewvc_flags=${viewvc_flags:-"-p 49152"}
+viewvc_user=${viewvc_user:-"www"}
+
+pidfile=/var/run/viewvc.pid
+command=%%PYTHON_CMD%%
+standalone=%%PREFIX%%/viewvc/bin/standalone.py
+
+start_precmd=viewvc_precmd
+start_cmd=viewvc_start
+stop_postcmd=viewvc_cleanup
+
+viewvc_precmd()
+{
+ # with param -d we get another pid so prevent this
+ %%ECHO%% "${viewvc_flags}" | %%EGREP%% -q "(^\-d| \-d)" 2>&1 > /dev/null
+ if [ $? -eq 0 ]; then
+ %%ECHO%% "Please remove parameter -d from viewvc_flags"
+ %%ECHO%%
+ return 1
+ fi
+}
+
+viewvc_start() {
+ echo "Starting viewvc."
+ %%TOUCH%% ${pidfile} && %%CHOWN%% ${viewvc_user} ${pidfile}
+ /usr/sbin/daemon -cf -p ${pidfile} -u ${viewvc_user} ${standalone} ${viewvc_flags}
+}
+
+viewvc_cleanup() {
+ [ -f ${pidfile} ] && %%RM%% ${pidfile}
+}
+
+run_rc_command "$1"