diff options
author | Dan Theisen <djt@hxx.in> | 2019-09-10 08:15:52 +0000 |
---|---|---|
committer | Dan Theisen <djt@hxx.in> | 2019-09-10 09:32:51 +0000 |
commit | 2c05a88e2092278475b862b96d04d5d67cee4ea3 (patch) | |
tree | 6eff4683946278ca29269956c1db1b81b348df1b | |
parent | f9ba226858a27bb322bad90ad988971f9afa8314 (diff) | |
download | packages-2c05a88e2092278475b862b96d04d5d67cee4ea3.tar.gz packages-2c05a88e2092278475b862b96d04d5d67cee4ea3.tar.bz2 packages-2c05a88e2092278475b862b96d04d5d67cee4ea3.tar.xz packages-2c05a88e2092278475b862b96d04d5d67cee4ea3.zip |
user/transmission: new package
-rw-r--r-- | user/transmission/APKBUILD | 109 | ||||
-rw-r--r-- | user/transmission/transmission-daemon.confd | 14 | ||||
-rw-r--r-- | user/transmission/transmission-daemon.initd | 73 | ||||
-rw-r--r-- | user/transmission/transmission-daemon.post-upgrade | 10 | ||||
-rw-r--r-- | user/transmission/transmission-daemon.pre-install | 6 | ||||
-rw-r--r-- | user/transmission/transmission.post-install | 12 |
6 files changed, 224 insertions, 0 deletions
diff --git a/user/transmission/APKBUILD b/user/transmission/APKBUILD new file mode 100644 index 000000000..d7eb95544 --- /dev/null +++ b/user/transmission/APKBUILD @@ -0,0 +1,109 @@ +# Contributor: Carlo Landmeter <clandmeter@gmail.com> +# Maintainer: Dan Theisen <djt@hxx.in> +pkgname=transmission +pkgver=2.94 +pkgrel=0 +pkgdesc="Lightweight GTK BitTorrent client" +url="https://transmissionbt.com/" +arch="all" +license="GPL-2.0+ AND MIT" +depends="" +makedepends="bsd-compat-headers curl-dev dbus-glib-dev gtk+3.0-dev intltool + libevent-dev libnotify-dev openssl-dev qt5-qtbase-dev" +install="transmission.post-install transmission-daemon.pre-install transmission-daemon.post-upgrade" +pkgusers="transmission" +pkggroups="transmission" +source="https://github.com/transmission/$pkgname-releases/raw/master/$pkgname-$pkgver.tar.xz + transmission-daemon.initd + transmission-daemon.confd + " +subpackages="$pkgname-qt $pkgname-gtk $pkgname-cli $pkgname-daemon $pkgname-doc $pkgname-lang" + +build() { + ./configure \ + --build=$CBUILD \ + --host=$CHOST \ + --prefix=/usr \ + --sysconfdir=/etc \ + --mandir=/usr/share/man \ + --infodir=/usr/share/info \ + --localstatedir=/var \ + --enable-utp \ + --with-inotify \ + --enable-cli + make + + # build for Qt + cd qt + qmake qtr.pro + make + +} + +check() { + msg "Checking for Transmission Core and GTK" + make check + + # check for Qt - this historically has no tests + msg "Checking for Transmission Qt" + cd qt + make check +} + +package() { + make DESTDIR="$pkgdir" install + + # install for Qt + cd "$builddir"/qt + make INSTALL_ROOT="$pkgdir/usr" install +} + +qt() { + pkgdesc="Lightweight BitTorrent client (Qt GUI interface)" + depends="$pkgname=$pkgver-r$pkgrel" + + mkdir -p "$subpkgdir"/usr/bin + mv "$pkgdir"/usr/bin/transmission-qt "$subpkgdir"/usr/bin +} + +gtk() { + pkgdesc="Lightweight BitTorrent client (Qt GUI interface)" + depends="$pkgname=$pkgver-r$pkgrel" + + mkdir -p "$subpkgdir"/usr/bin + mv "$pkgdir"/usr/bin/transmission-gtk "$subpkgdir"/usr/bin +} + +daemon() { + pkgdesc="Lightweight BitTorrent client (daemon and Web interface)" + + install -d "$subpkgdir"/usr/share \ + "$subpkgdir"/usr/bin + install -d -o transmission -g transmission \ + "$subpkgdir"/var/lib/transmission \ + "$subpkgdir"/var/log/transmission + mv "$pkgdir"/usr/bin/transmission-daemon \ + "$subpkgdir"/usr/bin/ + mv "$pkgdir"/usr/share/transmission \ + "$subpkgdir"/usr/share/ + install -D -m755 "$srcdir"/transmission-daemon.initd \ + "$subpkgdir"/etc/init.d/transmission-daemon + install -D -m644 "$srcdir"/transmission-daemon.confd \ + "$subpkgdir"/etc/conf.d/transmission-daemon +} + +cli() { + pkgdesc="Lightweight BitTorrent client (CLI and remote)" + + install -d "$subpkgdir"/usr/bin + mv "$pkgdir"/usr/bin/transmission-cli \ + "$pkgdir"/usr/bin/transmission-create \ + "$pkgdir"/usr/bin/transmission-edit \ + "$pkgdir"/usr/bin/transmission-show \ + "$pkgdir"/usr/bin/transmission-remote \ + "$subpkgdir"/usr/bin/ +} + +sha512sums="ee411743940f2897aa0bbc351ce79f11d860075d2e9e399d60301eae8cfc453e20426ef553fc62ee43019a07c052d512f5d7972cc4411fb57b1312c2c1558da7 transmission-2.94.tar.xz +d31275fba7eb322510f9667e66a186d626889a6e3143be2923aae87b9c35c5cf0c508639f1cb8c1b88b1e465bc082d80bb1101385ebde736a34d4eeeae0f6e15 transmission-daemon.initd +a3b9ac2b7bbe30e33060c8b6a693dc7072d3c6ac44f92ddd567969d8f57a0bfc1a561e781ae167703ccb4b2fd5b0e6d8f8a66c5ba14fe01d8d89a501d4501474 transmission-daemon.confd" diff --git a/user/transmission/transmission-daemon.confd b/user/transmission/transmission-daemon.confd new file mode 100644 index 000000000..fcf37c791 --- /dev/null +++ b/user/transmission/transmission-daemon.confd @@ -0,0 +1,14 @@ +# 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/transmission/config/settings.json to avoid other users see it with `ps` + +TRANSMISSION_OPTIONS="--encryption-preferred" + +# Run daemon as another user (username or username:groupname) +# If you change this setting, chown -R /var/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 diff --git a/user/transmission/transmission-daemon.initd b/user/transmission/transmission-daemon.initd new file mode 100644 index 000000000..0c9e36644 --- /dev/null +++ b/user/transmission/transmission-daemon.initd @@ -0,0 +1,73 @@ +#!/sbin/openrc-run +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-p2p/transmission/files/transmission-daemon.initd.8,v 1.2 2011/12/04 10:35:07 swegener Exp $ + +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:-/var/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} + +SSD_OPTIONS="" + +# compatibility for upgraders +TRANSMISSION_OPTIONS=${TRANSMISSION_OPTIONS:-$TD_OPTS} + +depend() { + need net + after firewall +} + +check_config() { + if [ ! -d "${rundir}" ]; then + mkdir "${rundir}" + if [ -n "${runas_user}" ]; then + chown -R ${runas_user} "${rundir}" + fi + fi + + # In case no config directory option passed use default + if ! $(echo ${TRANSMISSION_OPTIONS} | grep -q -e '\B-g' -e '\B--config-dir'); then + TRANSMISSION_OPTIONS="${TRANSMISSION_OPTIONS} --config-dir ${config_dir}" + # put download dir location on first run (and take it from config later) + if [ ! -f ${config_dir}/settings.json ]; then + TRANSMISSION_OPTIONS="${TRANSMISSION_OPTIONS} --download-dir ${download_dir}" + fi + fi + + if [ -n "${runas_user}" ]; then + SSD_OPTIONS="${SSD_OPTIONS} --user ${runas_user}" + fi +} + +start() { + check_config + + ebegin "Starting transmission daemon" + start-stop-daemon --start --quiet --pidfile ${pidfile} ${SSD_OPTIONS} \ + --exec /usr/bin/transmission-daemon -- --pid-file ${pidfile} \ + $(test ${logfile} != "syslog" && echo --logfile ${logfile}) \ + ${TRANSMISSION_OPTIONS} + eend $? +} + +stop() { + ebegin "Stopping transmission daemon" + start-stop-daemon --stop --quiet --retry TERM/45/QUIT/15 --pidfile ${pidfile} + eend $? +} + +reload() { + ebegin "Reloading transmission configuration" + start-stop-daemon --signal HUP --pidfile ${pidfile} + eend $? +} + diff --git a/user/transmission/transmission-daemon.post-upgrade b/user/transmission/transmission-daemon.post-upgrade new file mode 100644 index 000000000..e0aaa8e02 --- /dev/null +++ b/user/transmission/transmission-daemon.post-upgrade @@ -0,0 +1,10 @@ +#!/bin/sh + +dir=/var/lib/transmission + +# rename config and create compat symlink +if [ -e "$dir"/.config ] && ! [ -e "$dir"/config ]; then + mv "$dir"/.config "$dir"/config + ln -s config "$dir"/.config +fi + diff --git a/user/transmission/transmission-daemon.pre-install b/user/transmission/transmission-daemon.pre-install new file mode 100644 index 000000000..2e26d48d7 --- /dev/null +++ b/user/transmission/transmission-daemon.pre-install @@ -0,0 +1,6 @@ +#!/bin/sh + +addgroup -S transmission 2>/dev/null +adduser -S -D -h /var/lib/transmission -s /sbin/nologin -G transmission -g transmission transmission 2>/dev/null + +exit 0 diff --git a/user/transmission/transmission.post-install b/user/transmission/transmission.post-install new file mode 100644 index 000000000..6002c7430 --- /dev/null +++ b/user/transmission/transmission.post-install @@ -0,0 +1,12 @@ +#!/bin/sh + +pkgname=transmission + +if ! apk list $pkgname-qt $pkgname-gtk $pkgname-daemon | grep "[installed]"; then + echo "############################################################################" + echo "# WARNING: It doesn't look like you installed a GUI or Daemon! #" + echo "# transmission is just a shared package with assets. To install a GUI, you #" + echo "# can install either transmission-qt or transmission-gtk. To install the #" + echo "# daemon please install transmission-daemon. #" + echo "############################################################################" +fi |