freebsd-ports/net/rsync/files/rsyncd.in
Emanuel Haupt 8852cc1260 Allow specifying config path in rc.conf
PR:		191601
Submitted by:	daniel@blodan.se
2014-09-10 09:36:24 +00:00

46 lines
988 B
Bash

#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: %%NAME%%
# REQUIRE: LOGIN
# BEFORE: securelevel
# KEYWORD: shutdown
# Add the following lines to /etc/rc.conf to enable `%%NAME%%':
#
# %%NAME%%_enable="YES"
# %%NAME%%_flags="<set as needed>"
#
# See rsync(1) for %%NAME%%_flags
#
. /etc/rc.subr
name="%%NAME%%"
rcvar=%%NAME%%_enable
command="%%PREFIX%%/bin/rsync"
start_precmd="%%NAME%%_precmd"
pidfile="/var/run/$name.pid"
# read configuration and set defaults
load_rc_config "$name"
: ${%%NAME%%_enable="NO"}
: ${%%NAME%%_configfile:=%%ETCDIR%%/$name.conf}
required_files="${%%NAME%%_configfile}"
command_args="--daemon --config ${%%NAME%%_configfile}"
%%NAME%%_precmd()
{
if [ -f "%%PREFIX%%/etc/$name.conf" ] && [ ! -L "%%PREFIX%%/etc/$name.conf" ]; then
echo "Found %%PREFIX%%/etc/$name.conf in old location. Migrating to %%ETCDIR%%/$name.conf."
mv %%PREFIX%%/etc/$name.conf %%ETCDIR%%/$name.conf
ln -s %%ETCDIR%%/$name.conf %%PREFIX%%/etc/$name.conf
fi
}
run_rc_command "$1"