#!/bin/sh # # $FreeBSD: head/net-p2p/btsync/files/btsync.in 373424 2014-11-25 18:12:17Z crees $ # # PROVIDE: %%PORTNAME%% # REQUIRE: LOGIN # KEYWORD: shutdown # # Add the following lines to /etc/rc.conf.local or /etc/rc.conf # to enable this service: # # %%PORTNAME%%_enable (bool): Set to NO by default. # Set it to YES to enable it. # %%PORTNAME%%_user: The user account %%PORTNAME%% daemon runs as # what you want it to be. It uses '%%USER%%' # user by default. Do not sets it as empty or it # will run as root. # %%PORTNAME%%_group: The group account %%PORTNAME%% daemon runs as # what you want it to be. It uses '%%GROUP%%' # group by default. Do not sets it as empty or it # will run as wheel. . /etc/rc.subr name="%%PORTNAME%%" rcvar="${name}_enable" load_rc_config $name : ${%%PORTNAME%%_enable:="NO"} : ${%%PORTNAME%%_user:="%%USER%%"} : ${%%PORTNAME%%_group:="%%GROUP%%"} pidfile="/var/run/%%PORTNAME%%/%%PORTNAME%%.pid" command="%%PREFIX%%/bin/btsync" command_args="--config %%PREFIX%%/etc/%%PORTNAME%%.conf" start_precmd=%%PORTNAME%%_prestart %%PORTNAME%%_prestart() { if [ ! -d ${pidfile%/*} ]; then install -d -o $%%PORTNAME%%_user -g $%%PORTNAME%%_group ${pidfile%/*} fi } run_rc_command "$1"