Index: GIDs =================================================================== --- GIDs +++ GIDs @@ -790,7 +790,7 @@ domoticz:*:847: graylog:*:848: chronyd:*:849: -# free: 850 +qbittorrent:*:850: # free: 851 # free: 852 _geodns:*:853: Index: UIDs =================================================================== --- UIDs +++ UIDs @@ -796,7 +796,7 @@ domoticz:*:847:847::0:0:domoticz user:/nonexistent:/usr/sbin/nologin graylog:*:848:848::0:0:Graylog user:/nonexistent:/usr/sbin/nologin chronyd:*:849:849::0:0:chronyd user:/nonexistent:/usr/sbin/nologin -# free: 850 +qbittorrent:*:850:850::0:0:qBittorrent Daemon User:/usr/local/etc/qbittorrent/home:/usr/sbin/nologin # free: 851 # free: 852 _geodns:*:853:853::0:0:GeoDNS User:/var/empty:/usr/sbin/nologin Index: net-p2p/qbittorrent/Makefile =================================================================== --- net-p2p/qbittorrent/Makefile +++ net-p2p/qbittorrent/Makefile @@ -3,6 +3,7 @@ PORTNAME= qbittorrent DISTVERSION= 4.1.5 +PORTREVISION= 2 CATEGORIES= net-p2p ipv6 MASTER_SITES= SF/${PORTNAME}/${PORTNAME}/${PORTNAME}-${PORTVERSION} @@ -39,6 +40,9 @@ CONFIGURE_ARGS+= --disable-gui PLIST_FILES= bin/qbittorrent${SUFFIX} \ man/man1/qbittorrent${SUFFIX}.1.gz +USERS= qbittorrent +GROUPS= qbittorrent +USE_RC_SUBR= qbittorrent .endif OPTIONS_DEFINE= DBUS DEBUG DOCS Index: net-p2p/qbittorrent/files/qbittorrent.in =================================================================== --- /dev/null +++ net-p2p/qbittorrent/files/qbittorrent.in @@ -0,0 +1,60 @@ +#!/bin/sh +# +# $FreeBSD$ +# +# PROVIDE: qbittorrent +# REQUIRE: DAEMON +# KEYWORD: shutdown +# +# Add the following lines to /etc/rc.conf to enable this service: +# +# qbittorrent_enable: Set to NO by default. Set it to YES to enable it. +# qbittorrent_conf_dir: Directory where qbittorrent configuration +# data is stored. +# Default: /usr/local/etc/qbittorrent/home +# qbittorrent_download_dir: Directory to store downloaded data. +# Default: /usr/local/etc/qbittorrent/home/Downloads +# qbittorrent_user: The user account transmission daemon runs as what +# you want it to be. It uses 'qbittorrent' user by +# default. +# qbittorrent_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=qbittorrent +rcvar=qbittorrent_enable + +load_rc_config $name + +: ${qbittorrent_enable:=NO} +: ${qbittorrent_conf_dir=%%PREFIX%%/etc/qbittorrent/home} +: ${qbittorrent_download_dir=%%PREFIX%%/etc/qbittorrent/home/Downloads} +: ${qbittorrent_user:=qbittorrent} +qbittorrent_group=${qbittorrent_group:-$qbittorrent_user} +: ${qbittorrent_chown:=yes} + +command="%%PREFIX%%/bin/qbittorrent-nox" +command_args="--daemon" +extra_commands=reload +start_precmd=qbittorrent_prestart + +qbittorrent_flags=" \ + ${qbittorrent_conf_dir:+--profile=${qbittorrent_conf_dir}} \ + ${qbittorrent_download_dir:+--save-path=${qbittorrent_download_dir}} \ + ${qbittorrent_flags}" + +qbittorrent_prestart() +{ + if checkyesno qbittorrent_chown; then + mkdir -p $qbittorrent_conf_dir $qbittorrent_download_dir + chown $qbittorrent_user:$qbittorrent_group $qbittorrent_download_dir + chown -R $qbittorrent_user:$qbittorrent_group $qbittorrent_conf_dir + chgrp $qbittorrent_group $qbittorrent_conf_dir + chmod 750 $qbittorrent_conf_dir + fi +} + +run_rc_command $1