diff options
-rw-r--r-- | .SRCINFO | 27 | ||||
-rw-r--r-- | PKGBUILD | 49 | ||||
-rw-r--r-- | headphones-system.service | 12 | ||||
-rw-r--r-- | headphones-user.service | 8 | ||||
-rw-r--r-- | headphones.install | 29 | ||||
-rw-r--r-- | headphones.tmpfile | 1 |
6 files changed, 126 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..c5e001154ea9 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,27 @@ +pkgbase = headphones-git + pkgdesc = Headphones is an automated music downloader for NZB and Torrent, written in Python. It supports SABnzbd, NZBget, Transmission, µTorrent and Blackhole. + pkgver = 0.5.18.r88.g8e1cd31 + pkgrel = 1 + url = https://github.com/rembo10/headphones + install = headphones.install + arch = any + license = GPL3 + depends = python2 + optdepends = sabnzbd: NZB downloader + optdepends = python2-notify: desktop notifications + optdepends = unrar: automatic decompression + optdepends = git: pull new versions from git + conflicts = headphones + replaces = headphones + options = !strip + source = git://github.com/rembo10/headphones.git + source = headphones-system.service + source = headphones-user.service + source = headphones.tmpfile + sha256sums = SKIP + sha256sums = 14f00904135940e00a6af5742116d950be07248a578c2562373413155f768d01 + sha256sums = 22d2a8da5cc8da149ddac086e52c0e30b51671644e039d435f853cf383f15317 + sha256sums = b8f7030f570e7707eb9c0f41c382e37d54244e7885c795a9f31788efdd45914e + +pkgname = headphones-git + diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..f3f5a8f0ceb9 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,49 @@ +# Maintainer: Anthony Ruhier <anthony.ruhier@gmail.com> +# Many thanks to Justin Dray, maintainer of sickrage, for his PKGBUILD used as +# a base for this one. + +_name=headphones +pkgname=${_name}-git +pkgver=0.5.18.r88.g8e1cd31 +pkgrel=1 +pkgdesc="Headphones is an automated music downloader for NZB and Torrent, written in Python. It supports SABnzbd, NZBget, Transmission, µTorrent and Blackhole." +arch=('any') +_url="github.com/rembo10/${_name}" +url="https://${_url}" +license=('GPL3') +depends=('python2') +optdepends=('sabnzbd: NZB downloader' + 'python2-notify: desktop notifications' + 'unrar: automatic decompression' + 'git: pull new versions from git') +conflicts=("${_name}") +replaces=("${_name}") +options=('!strip') +install="${_name}.install" +source=("git://${_url}.git" + "${_name}-system.service" + "${_name}-user.service" + "${_name}.tmpfile") +sha256sums=('SKIP' + '14f00904135940e00a6af5742116d950be07248a578c2562373413155f768d01' + '22d2a8da5cc8da149ddac086e52c0e30b51671644e039d435f853cf383f15317' + 'b8f7030f570e7707eb9c0f41c382e37d54244e7885c795a9f31788efdd45914e') + +pkgver() { + cd "$srcdir"/${_name} + git describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g;s/^v//' +} + +package() { + mkdir -p "${pkgdir}/opt/${_name}" + chmod 775 "${pkgdir}/opt/${_name}" + cp -r ${_name}/* "$pkgdir/opt/${_name}" + + install -D -m644 ${_name}-system.service "$pkgdir/usr/lib/systemd/system/${_name}.service" + install -D -m644 ${_name}-user.service "$pkgdir/usr/lib/systemd/user/${_name}.service" + install -D -m644 ${_name}.tmpfile "$pkgdir/usr/lib/tmpfiles.d/${_name}.conf" + + find "$pkgdir" -type d -name '.git' -exec rm -r '{}' + +} + +# vim: set ts=2 sw=2 ft=sh noet: diff --git a/headphones-system.service b/headphones-system.service new file mode 100644 index 000000000000..e0c8766c7a80 --- /dev/null +++ b/headphones-system.service @@ -0,0 +1,12 @@ +[Unit] +Description=Headphones Daemon +After=network.target + +[Service] +User=headphones +Type=forking +PIDFile=/run/headphones/headphones.pid +ExecStart=/usr/bin/env python2 /opt/headphones/Headphones.py -q --daemon --nolaunch --pidfile=/run/headphones/headphones.pid --config /opt/headphones/config.ini --datadir /opt/headphones + +[Install] +WantedBy=multi-user.target diff --git a/headphones-user.service b/headphones-user.service new file mode 100644 index 000000000000..b49fc6ea575a --- /dev/null +++ b/headphones-user.service @@ -0,0 +1,8 @@ +[Unit] +Description=Headphones Daemon + +[Service] +ExecStart=/usr/bin/env python2 /opt/headphones/Headphones.py --quiet --config %h/.headphones/config.ini --datadir %h/.headphones + +[Install] +WantedBy=default.target diff --git a/headphones.install b/headphones.install new file mode 100644 index 000000000000..312d6c245c0c --- /dev/null +++ b/headphones.install @@ -0,0 +1,29 @@ +_NAME=headphones + +post_install() { + getent passwd ${_NAME} > /dev/null || useradd -d /opt/${_NAME} -s /bin/false -r ${_NAME} > /dev/null + chown -R ${_NAME}. /opt/${_NAME} + + # Create a directory in /run if it does not exist + if [ ! -d /run/${_NAME} ]; then + mkdir /run/${_NAME} + chown ${_NAME}. /run/${_NAME} + chmod 775 /run/${_NAME} + fi + + echo "" + echo "To fill the configuration file (/opt/headphones/config.ini), do:" + echo " systemctl start headphones; systemctl stop headphones" + echo "" + echo "It should dump the initial configuration that you can now modify." + echo "" +} + +post_upgrade() { + post_install +} + +post_remove() { + echo "Some files have not been removed because they are created by ${_NAME} itself, e.g. the music database." + userdel -f ${_NAME} +} diff --git a/headphones.tmpfile b/headphones.tmpfile new file mode 100644 index 000000000000..d5194efaa143 --- /dev/null +++ b/headphones.tmpfile @@ -0,0 +1 @@ +d /run/headphones 0775 headphones headphones |