summaryrefslogtreecommitdiff
path: root/nonsystemd/transmission-openrc
diff options
context:
space:
mode:
Diffstat (limited to 'nonsystemd/transmission-openrc')
-rw-r--r--nonsystemd/transmission-openrc/PKGBUILD26
-rw-r--r--nonsystemd/transmission-openrc/transmission.confd19
-rw-r--r--nonsystemd/transmission-openrc/transmission.initd49
3 files changed, 94 insertions, 0 deletions
diff --git a/nonsystemd/transmission-openrc/PKGBUILD b/nonsystemd/transmission-openrc/PKGBUILD
new file mode 100644
index 000000000..823f82624
--- /dev/null
+++ b/nonsystemd/transmission-openrc/PKGBUILD
@@ -0,0 +1,26 @@
+# Maintainer: David P. <megver83@parabola.nu>
+# Maintainer (Artix): Nathan Owens <ndowens@artixlinux.org>
+
+pkgname=transmission-openrc
+pkgver=20210505
+pkgrel=2
+pkgdesc="OpenRC transmission init"
+arch=('any')
+url="https://gitea.artixlinux.org/artixlinux/packages-openrc"
+license=('GPL2')
+groups=('openrc-world')
+provides=('init-transmission')
+conflicts=('init-transmission')
+backup=("etc/conf.d/transmission")
+source=("transmission".{confd,initd})
+sha256sums=('a2d38989afc96788efa1dccf5dcfeb81278f8093e2c2a8c4129c9826aeaafd89'
+ '9b435a7af81bf2904941ef1f165ec9621a4ba4a5d6aa6b823b36a11750ec89c8')
+b2sums=('52cd64646a30ab09926c406022c819f75deb182b04006082d9aa49c91c129f31dd9c9e49456ddb23d746b87c7e157cb859eb09ef9dcd0a798d097469fcb5beba'
+ '34ebb53495aa4339832fbf75f3ff515e15bd93329d0b6d88172589c9024b3b9a16a1c2436dabebb700687ca8d0f7115cd198a665bc51e7ca0b965bc2c929b999')
+
+package() {
+ depends=('openrc' 'transmission-cli')
+ install -Dm755 "$srcdir"/transmission.initd "$pkgdir"/etc/init.d/transmission
+ install -Dm644 "$srcdir"/transmission.confd "$pkgdir"/etc/conf.d/transmission
+}
+
diff --git a/nonsystemd/transmission-openrc/transmission.confd b/nonsystemd/transmission-openrc/transmission.confd
new file mode 100644
index 000000000..0151d08df
--- /dev/null
+++ b/nonsystemd/transmission-openrc/transmission.confd
@@ -0,0 +1,19 @@
+# This is the transmission-daemon configuration file. For other options and
+# better explanation, take a look at transmission-daemon manual page Note: it's
+# better to configure some settings (like username/password) in
+# /var/lib/transmission/config/settings.json to avoid other users see it with `ps`
+
+# Parameters to pass to transmission-daemon
+# TRANSMISSION_OPTIONS=""
+
+# Run daemon as another user (username or username:groupname)
+# If you change this setting, chown -R /var/lib/transmission/config <and download directory, check web settings>
+#runas_user=transmission
+
+# Location of logfile (should be writeable for runas_user user)
+# Set logfile=syslog to use syslog for logging
+#logfile=/var/log/transmission/transmission.log
+#
+
+# Download location
+#download_dir=
diff --git a/nonsystemd/transmission-openrc/transmission.initd b/nonsystemd/transmission-openrc/transmission.initd
new file mode 100644
index 000000000..44b311ee1
--- /dev/null
+++ b/nonsystemd/transmission-openrc/transmission.initd
@@ -0,0 +1,49 @@
+#!/usr/bin/openrc-run
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+command="/usr/bin/transmission-daemon"
+extra_started_commands="reload"
+description="Transmission is a fast, easy and free bittorrent client"
+description_start="Start transmission-daemon server and web interface"
+description_stop="Stop transmission-daemon server and web interface"
+description_reload="Reload transmission-daemon settings"
+
+rundir=${rundir:-/run/transmission}
+pidfile=${pidfile:-${rundir}/transmission.pid}
+config_dir=${config_dir:-/var/lib/transmission/config}
+download_dir=${download_dir:-/var/lib/transmission/downloads}
+logfile=${logfile:-/var/log/transmission/transmission.log}
+runas_user=${runas_user:-transmission:transmission}
+
+retry="TERM/45/QUIT/15"
+
+start_pre() {
+ command_args="--config-dir ${config_dir} --pid-file ${pidfile}"
+ command_user="${runas_user}"
+
+ # Call mkdir -p in case parent dirs are missing
+ mkdir -p "${rundir}" "${config_dir}" "${download_dir}"
+
+ # Call checkpath to fixup permissions
+ checkpath -d -o "${runas_user}" "${rundir}" "${config_dir}" "${download_dir}" || return
+
+ if [ ! -e "${config_dir}/settings.json" ]; then
+ # Only set download dir if settings don't exist
+ # https://bugs.gentoo.org/576640
+ command_args="${command_args} --download-dir ${download_dir}"
+ fi
+
+ if [ "${logfile}" != syslog ]; then
+ checkpath -d -o "${runas_user}" /var/log/transmission || return
+ command_args="${command_args} --logfile ${logfile}"
+ fi
+
+ command_args="${command_args} ${TRANSMISSION_OPTIONS}"
+}
+
+reload() {
+ ebegin "Reloading ${RC_SVCNAME}"
+ start-stop-daemon --signal HUP --exec "${command}" --pidfile "${pidfile}"
+ eend $?
+}