From owner-svn-ports-all@FreeBSD.ORG Mon Apr 7 10:45:24 2014 Return-Path: Delivered-To: svn-ports-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6111D401; Mon, 7 Apr 2014 10:45:24 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4E1A89FF; Mon, 7 Apr 2014 10:45:24 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s37AjOo8087942; Mon, 7 Apr 2014 10:45:24 GMT (envelope-from bapt@svn.freebsd.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s37AjN2X087940; Mon, 7 Apr 2014 10:45:23 GMT (envelope-from bapt@svn.freebsd.org) Message-Id: <201404071045.s37AjN2X087940@svn.freebsd.org> From: Baptiste Daroussin Date: Mon, 7 Apr 2014 10:45:23 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r350456 - in head/devel/fossil: . files X-SVN-Group: ports-head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-all@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the ports tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Apr 2014 10:45:24 -0000 Author: bapt Date: Mon Apr 7 10:45:23 2014 New Revision: 350456 URL: http://svnweb.freebsd.org/changeset/ports/350456 QAT: https://qat.redports.org/buildarchive/r350456/ Log: Add a rc script to server fossil repositories Added: head/devel/fossil/files/ head/devel/fossil/files/fossil.in (contents, props changed) Modified: head/devel/fossil/Makefile Modified: head/devel/fossil/Makefile ============================================================================== --- head/devel/fossil/Makefile Mon Apr 7 10:35:14 2014 (r350455) +++ head/devel/fossil/Makefile Mon Apr 7 10:45:23 2014 (r350456) @@ -3,6 +3,7 @@ PORTNAME= fossil PORTVERSION= 1.28 DISTVERSION= 20140127173344 +PORTREVISION= 1 PORTEPOCH= 2 CATEGORIES= devel www MASTER_SITES= http://www.fossil-scm.org/download/ @@ -18,6 +19,8 @@ PLIST_FILES= bin/fossil HAS_CONFIGURE= yes CONFIGURE_ARGS= --prefix=${PREFIX} +USE_RC_SUBR= fossil + OPTIONS_DEFINE= JSON STATIC JSON_DESC= JSON API support Added: head/devel/fossil/files/fossil.in ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/devel/fossil/files/fossil.in Mon Apr 7 10:45:23 2014 (r350456) @@ -0,0 +1,90 @@ +#!/bin/sh + +# $FreeBSD$ +# +# fossil startup script +# +# PROVIDE: fossil +# REQUIRE: LOGIN +# KEYWORD: shutdown +# +# Add the following to /etc/rc.conf[.local] to enable this service +# +# fossil_enable="YES" +# +# You can fine tune others variables too: +# fossil_port="8080" +# fossil_directory="/nonexistent" +# fossil_baseurl="" +# fossil_proto="http" +# fossil_listenall="" +# fossil_files="" # comma separated globing patterns of files to serve +# fossil_notfound="" # URI to redirect to in case of 404 +# Use fossil_user to run fossil as user + +. /etc/rc.subr + +name="fossil" +rcvar=fossil_enable +load_rc_config $name +pidprefix="/var/run/fossil/fossil" +pidfile="${pidprefix}.pid" + +procname="%%PREFIX%%/bin/fossil" +command="/usr/sbin/daemon" +start_precmd="fossil_precmd" +stop_postcmd="fossil_postcmd" + +fossil_enable=${fossil_enable:-"NO"} +fossil_user=${fossil_user:-"nobody"} +fossil_port=${fossil_port:-"8080"} +fossil_proto=${fossil_proto:-"http"} +fossil_directory=${fossil_directory:-"/nonexistent"} + +case "${fossil_proto}" in +http);; +scgi) fossil_args="--scgi" ;; +*) + echo "unsupported protocol: ${fossil_proto}, only scgi and http are supported" >&2 + + exit 1 + ;; +esac + +[ -n "${fossil_baseurl}" ] && fossil_args="${fossil_args} --baseurl ${fossil_baseurl}" +[ -z "${fossil_listenall}" ] && fossil_args="${fossil_args} --localhost" +[ -n "${fossil_files}" ] && fossil_args="${fossil_args} --files '${fossil_files}'" +[ -n "${fossil_notfound}" ] && fossil_args="${fossil_args} --notfound \"${fossil_notfound}\"" + +command_args="-f -p ${pidfile} ${procname} server -P ${fossil_port} ${fossil_args} ${fossil_directory}" + +fossil_setfib() +{ + if command -v check_namevarlist > /dev/null 2>&1; then + check_namevarlist fib && return 0 + fi + + ${SYSCTL} net.fibs >/dev/null 2>&1 || return 0 + + fossil_fib=${fossil_fib:-"NONE"} + case "$fossil_fib" in + [Nn][Oo][Nn][Ee]) + ;; + *) + command="setfib -F ${fossil_fib} ${command}" + ;; + esac +} + +fossil_precmd() +{ + fossil_setfib + install -d -o root -g wheel -m 1777 /var/run/fossil +} + +fossil_postcmd() +{ + rm -rf /var/run/fossil +} + +run_rc_command "$1"