mirror of
https://git.FreeBSD.org/ports.git
synced 2024-12-26 05:02:18 +00:00
725b2295fc
PR: ports/195341 Submitted by: joshruehlig@gmail.com
81 lines
2.7 KiB
Bash
81 lines
2.7 KiB
Bash
#!/bin/sh
|
|
#
|
|
# $FreeBSD$
|
|
#
|
|
# PROVIDE: transmission
|
|
# REQUIRE: DAEMON
|
|
# KEYWORD: shutdown
|
|
#
|
|
# Add the following lines to /etc/rc.conf to enable this service:
|
|
#
|
|
# transmission_enable: Set to NO by default. Set it to YES to enable it.
|
|
# transmission_watch_dir: Directory for torrent files to download
|
|
# automatically. Off by default unless you add
|
|
# a path.
|
|
# transmission_conf_dir: Directory where transmission configuration
|
|
# data is stored.
|
|
# Default: %%PREFIX%%/etc/transmission/home
|
|
# transmission_download_dir: Directory to store downloaded data.
|
|
# Default: %%PREFIX%%/etc/transmission/home/Downloads
|
|
# transmission_user: The user account transmission daemon runs as what
|
|
# you want it to be. It uses 'transmission' user by
|
|
# default.
|
|
# transmission_web_home: Use alternative directory for the web interface
|
|
# files, such as javascript, html and graphics.
|
|
# transmission_chown: By default, transmission checks and fixes the
|
|
# permissions for its home directory. If this
|
|
# causes problems, set this variable to no.
|
|
#
|
|
|
|
. /etc/rc.subr
|
|
|
|
name=transmission
|
|
rcvar=transmission_enable
|
|
|
|
load_rc_config $name
|
|
|
|
: ${transmission_enable:=NO}
|
|
: ${transmission_conf_dir=%%PREFIX%%/etc/transmission/home}
|
|
: ${transmission_download_dir=%%PREFIX%%/etc/transmission/home/Downloads}
|
|
: ${transmission_user:=transmission}
|
|
transmission_group=${transmission_group:-$transmission_user}
|
|
: ${transmission_chown:=yes}
|
|
|
|
command=%%PREFIX%%/bin/transmission-daemon
|
|
pidfile=/var/run/transmission/daemon.pid
|
|
extra_commands=reload
|
|
start_precmd=transmission_prestart
|
|
|
|
transmission_flags=" \
|
|
${transmission_watch_dir:+-c ${transmission_watch_dir}} \
|
|
${transmission_conf_dir:+-g ${transmission_conf_dir}} \
|
|
${transmission_download_dir:+-w ${transmission_download_dir}} \
|
|
${pidfile:+-x $pidfile} \
|
|
${transmission_flags}"
|
|
|
|
transmission_prestart()
|
|
{
|
|
install -d -o $transmission_user ${pidfile%/*}
|
|
if checkyesno transmission_chown; then
|
|
mkdir -p $transmission_conf_dir $transmission_download_dir
|
|
chown $transmission_user:$transmission_group $transmission_download_dir
|
|
chown -R $transmission_user:$transmission_group $transmission_conf_dir
|
|
chgrp $transmission_group $transmission_conf_dir
|
|
chmod 750 $transmission_conf_dir
|
|
fi
|
|
if [ -n "$transmission_web_home" ]; then
|
|
TRANSMISSION_WEB_HOME=$transmission_web_home
|
|
export TRANSMISSION_WEB_HOME
|
|
fi
|
|
}
|
|
|
|
# Unfortunately there was a typo in a previous version, which may have
|
|
# left some people with /var/run/transmission/damon.pid . Deal with
|
|
# this for a few months at least, until everyone will have restarted
|
|
# transmission
|
|
if [ ! -f $pidfile -a -f /var/run/transmission/damon.pid ]; then
|
|
pidfile=/var/run/transmission/damon.pid
|
|
fi
|
|
|
|
run_rc_command $1
|