pkgsrc-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: pkgsrc/net/transmission



Module Name:    pkgsrc
Committed By:   nia
Date:           Thu Jan  5 15:55:38 UTC 2023

Modified Files:
        pkgsrc/net/transmission: Makefile
Added Files:
        pkgsrc/net/transmission/files: transmission.sh

Log Message:
transmission: Add a rc script to automatically run transmission as a
dedicated user out of the box. Reviewed by wiz.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 pkgsrc/net/transmission/Makefile
cvs rdiff -u -r0 -r1.1 pkgsrc/net/transmission/files/transmission.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/net/transmission/Makefile
diff -u pkgsrc/net/transmission/Makefile:1.31 pkgsrc/net/transmission/Makefile:1.32
--- pkgsrc/net/transmission/Makefile:1.31       Wed Oct 26 10:31:52 2022
+++ pkgsrc/net/transmission/Makefile    Thu Jan  5 15:55:38 2023
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.31 2022/10/26 10:31:52 wiz Exp $
+# $NetBSD: Makefile,v 1.32 2023/01/05 15:55:38 nia Exp $
 
 CONFLICTS+=    Transmission-[0-9]*
 
@@ -8,6 +8,30 @@ pre-configure:
 CONFIGURE_ARGS+=       --disable-mac
 CONFIGURE_ARGS+=       --without-gtk
 
-PKGREVISION= 4
+PKGREVISION=   5
+
+RCD_SCRIPTS=           transmission
+
+BUILD_DEFS+=           VARBASE
+
+.include "../../mk/bsd.prefs.mk"
+
+TRANSMISSION_USER?=    transmission
+TRANSMISSION_GROUP?=   transmission
+
+FILES_SUBST+=          TRANSMISSION_USER=${TRANSMISSION_USER}
+FILES_SUBST+=          TRANSMISSION_GROUP=${TRANSMISSION_GROUP}
+
+PKG_USERS_VARS+=       TRANSMISSION_USER
+PKG_GROUPS_VARS+=      TRANSMISSION_GROUP
+
+PKG_GROUPS=            ${TRANSMISSION_GROUP}
+PKG_USERS=             ${TRANSMISSION_USER}:${TRANSMISSION_GROUP}
+
+OWN_DIRS_PERMS+=       ${PKG_SYSCONFDIR}/transmission \
+                       ${TRANSMISSION_USER} ${TRANSMISSION_GROUP} 0755
+OWN_DIRS_PERMS+=       ${VARBASE}/log/transmission \
+                       ${TRANSMISSION_USER} ${TRANSMISSION_GROUP} 0755
+
 .include "../../net/transmission/Makefile.common"
 .include "../../mk/bsd.pkg.mk"

Added files:

Index: pkgsrc/net/transmission/files/transmission.sh
diff -u /dev/null pkgsrc/net/transmission/files/transmission.sh:1.1
--- /dev/null   Thu Jan  5 15:55:38 2023
+++ pkgsrc/net/transmission/files/transmission.sh       Thu Jan  5 15:55:38 2023
@@ -0,0 +1,53 @@
+#!@RCD_SCRIPTS_SHELL@
+#
+# PROVIDE: transmission
+# REQUIRE: DAEMON
+# KEYWORD: shutdown
+#
+
+if [ -f /etc/rc.subr ]
+then
+       . /etc/rc.subr
+fi
+
+name="transmission"
+rcvar=${name}
+pidfile="@VARBASE@/run/transmission/pid"
+transmission_file_path="@VARBASE@/db/transmission"
+command="@PREFIX@/bin/transmission-daemon"
+command_args="--pid-file ${pidfile}"
+command_args="${command_args} --logfile @VARBASE@/log/transmission/log"
+command_args="${command_args} --config-dir @PKG_SYSCONFDIR@/transmission"
+command_args="${command_args} --download-dir ${transmission_file_path}/complete"
+command_args="${command_args} --incomplete-dir ${transmission_file_path}/incomplete"
+command_args="${command_args} --watch-dir ${transmission_file_path}/torrents"
+start_precmd="transmission_precmd"
+transmission_user="@TRANSMISSION_USER@"
+transmission_group="@TRANSMISSION_GROUP@"
+
+transmission_precmd()
+{
+       if [ ! -d "@VARBASE@/run/transmission" ]; then
+               mkdir -p -m 755 "@VARBASE@/run/transmission"
+               chown @TRANSMISSION_USER@:@TRANSMISSION_GROUP@ \
+                       "@VARBASE@/run/transmission"
+       fi
+       if [ ! -d "${transmission_file_path}/complete" ]; then
+               mkdir -p -m 755 "${transmission_file_path}/complete"
+               chown @TRANSMISSION_USER@:@TRANSMISSION_GROUP@ \
+                       "${transmission_file_path}/complete"
+       fi
+       if [ ! -d "${transmission_file_path}/incomplete" ]; then
+               mkdir -p -m 755 "${transmission_file_path}/incomplete"
+               chown @TRANSMISSION_USER@:@TRANSMISSION_GROUP@ \
+                       "${transmission_file_path}/incomplete"
+       fi
+       if [ ! -d "${transmission_file_path}/torrents" ]; then
+               mkdir -p -m 755 "${transmission_file_path}/torrents"
+               chown @TRANSMISSION_USER@:@TRANSMISSION_GROUP@ \
+                       "${transmission_file_path}/torrents"
+       fi
+}
+
+load_rc_config $name
+run_rc_command "$1"



Home | Main Index | Thread Index | Old Index