diff options
author | Donald Webster | 2018-03-19 12:29:39 -0700 |
---|---|---|
committer | Donald Webster | 2018-03-19 14:03:56 -0700 |
commit | 93905ad059fec5af68cf0444955b36dbdc03260b (patch) | |
tree | c07fa81425a0c2235abd225d50640eef91b1ca5d | |
parent | 304c9b84df16c681cff2fac7dea88f8c05605127 (diff) | |
download | aur-93905ad059fec5af68cf0444955b36dbdc03260b.tar.gz |
Move to tmpfiles, sysusers and to /var/lib and /usr/lib.
-rw-r--r-- | .SRCINFO | 33 | ||||
-rw-r--r-- | .gitignore | 5 | ||||
-rw-r--r-- | PKGBUILD | 67 | ||||
-rw-r--r-- | headphones-system.service | 6 | ||||
-rw-r--r-- | headphones-user.service | 2 | ||||
-rw-r--r-- | headphones.install | 52 | ||||
-rw-r--r-- | headphones.sysusers | 1 | ||||
-rw-r--r-- | headphones.tmpfile | 1 | ||||
-rw-r--r-- | headphones.tmpfiles | 3 |
9 files changed, 98 insertions, 72 deletions
@@ -1,27 +1,34 @@ 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 + pkgdesc = Music downloader for usenet and torrents. + pkgver = 0.5.18.r159.gda9287d7 + pkgrel = 2 url = https://github.com/rembo10/headphones install = headphones.install arch = any license = GPL3 + makedepends = git depends = python2 - optdepends = sabnzbd: NZB downloader - optdepends = python2-notify: desktop notifications - optdepends = unrar: automatic decompression - optdepends = git: pull new versions from git + optdepends = sabnzbd: usenet downloader + optdepends = nzbget: usenet downloader + optdepends = transmission-cli: torrent downloader (CLI and daemon) + optdepends = transmission-gtk: torrent downloader (GTK+) + optdepends = transmission-qt: torrent downloader (Qt) + optdepends = deluge: torrent downloader + optdepends = rtorrent: torrent downloader + optdepends = jackett: torrent indexer proxy + provides = headphones conflicts = headphones - replaces = headphones options = !strip - source = git://github.com/rembo10/headphones.git + source = git+https://github.com/rembo10/headphones.git source = headphones-system.service source = headphones-user.service - source = headphones.tmpfile + source = headphones.sysusers + source = headphones.tmpfiles sha256sums = SKIP - sha256sums = 14f00904135940e00a6af5742116d950be07248a578c2562373413155f768d01 - sha256sums = 22d2a8da5cc8da149ddac086e52c0e30b51671644e039d435f853cf383f15317 - sha256sums = b8f7030f570e7707eb9c0f41c382e37d54244e7885c795a9f31788efdd45914e + sha256sums = 60ef2bc4c0bc1d23d4fe43202759cb24d9f456bd00cb8841ee11b2c4cbce917e + sha256sums = 9b753f7c3a7f81db01e814b2edb6b44a8c7b1e755c70a394082ca5fce5e2c5d7 + sha256sums = 348abc0627d63762a97655b5893c306e5b923857be5d0b876e9df5fea7ef9ed9 + sha256sums = f1e537c6853c3d641ec2266283b726a8fa5ed8f78c4325d295e66bb4d4868585 pkgname = headphones-git diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000000..83253be3003a --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +/headphones/ +/*.xz +/*.log +/src/ +/pkg/ @@ -2,48 +2,53 @@ # 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." +pkgname=headphones-git +pkgver=0.5.18.r159.gda9287d7 +pkgrel=2 +pkgdesc="Music downloader for usenet and torrents." arch=('any') -_url="github.com/rembo10/${_name}" -url="https://${_url}" +url="https://github.com/rembo10/headphones" 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}") +optdepends=('sabnzbd: usenet downloader' + 'nzbget: usenet downloader' + 'transmission-cli: torrent downloader (CLI and daemon)' + 'transmission-gtk: torrent downloader (GTK+)' + 'transmission-qt: torrent downloader (Qt)' + 'deluge: torrent downloader' + 'rtorrent: torrent downloader' + 'jackett: torrent indexer proxy') +makedepends=('git') +provides=('headphones') +conflicts=('headphones') options=('!strip') -install="${_name}.install" -source=("git://${_url}.git" - "${_name}-system.service" - "${_name}-user.service" - "${_name}.tmpfile") +install='headphones.install' +source=('git+https://github.com/rembo10/headphones.git' + 'headphones-system.service' + 'headphones-user.service' + 'headphones.sysusers' + 'headphones.tmpfiles') + sha256sums=('SKIP' - '14f00904135940e00a6af5742116d950be07248a578c2562373413155f768d01' - '22d2a8da5cc8da149ddac086e52c0e30b51671644e039d435f853cf383f15317' - 'b8f7030f570e7707eb9c0f41c382e37d54244e7885c795a9f31788efdd45914e') + '60ef2bc4c0bc1d23d4fe43202759cb24d9f456bd00cb8841ee11b2c4cbce917e' + '9b753f7c3a7f81db01e814b2edb6b44a8c7b1e755c70a394082ca5fce5e2c5d7' + '348abc0627d63762a97655b5893c306e5b923857be5d0b876e9df5fea7ef9ed9' + 'f1e537c6853c3d641ec2266283b726a8fa5ed8f78c4325d295e66bb4d4868585') pkgver() { - cd "$srcdir"/${_name} - git describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g;s/^v//' + cd "${srcdir}/headphones" + 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" + install -d -m 755 "${pkgdir}/usr/lib/headphones" + cp -a "${srcdir}/headphones"/* "${pkgdir}/usr/lib/headphones" + rm -rf "${pkgdir}/usr/lib/headphones/.git" - find "$pkgdir" -type d -name '.git' -exec rm -r '{}' + + install -D -m 644 headphones-system.service "${pkgdir}/usr/lib/systemd/system/headphones.service" + install -D -m 644 headphones-user.service "${pkgdir}/usr/lib/systemd/user/headphones.service" + install -D -m 644 headphones.sysusers "${pkgdir}/usr/lib/sysusers.d/headphones.conf" + install -D -m 644 headphones.tmpfiles "${pkgdir}/usr/lib/tmpfiles.d/headphones.conf" } # vim: set ts=2 sw=2 ft=sh noet: diff --git a/headphones-system.service b/headphones-system.service index e0c8766c7a80..e4d0d5138021 100644 --- a/headphones-system.service +++ b/headphones-system.service @@ -4,9 +4,9 @@ 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 +Group=headphones +Type=simple +ExecStart=/usr/bin/python2 /usr/lib/headphones/Headphones.py --nolaunch --config /var/lib/headphones/config.ini --datadir /var/lib/headphones [Install] WantedBy=multi-user.target diff --git a/headphones-user.service b/headphones-user.service index b49fc6ea575a..a14e028d6535 100644 --- a/headphones-user.service +++ b/headphones-user.service @@ -2,7 +2,7 @@ Description=Headphones Daemon [Service] -ExecStart=/usr/bin/env python2 /opt/headphones/Headphones.py --quiet --config %h/.headphones/config.ini --datadir %h/.headphones +ExecStart=/usr/bin/python2 /usr/lib/headphones/Headphones.py --config %h/.headphones/config.ini --datadir %h/.headphones [Install] WantedBy=default.target diff --git a/headphones.install b/headphones.install index 312d6c245c0c..2dfb8347452d 100644 --- a/headphones.install +++ b/headphones.install @@ -1,29 +1,35 @@ -_NAME=headphones +post_upgrade() { + if (( $(vercmp "0.5.18.r159.gda9287d7-2" "$2") > 0 )); then + if [[ -f /opt/headphones/config.ini && ! -f /var/lib/headphones/config.ini ]]; then + cp -a /opt/headphones/config.ini /var/lib/headphones/ + echo "Copied config.ini from /opt/headphones/ -> /var/lib/headphones/" + fi -post_install() { - getent passwd ${_NAME} > /dev/null || useradd -d /opt/${_NAME} -s /bin/false -r ${_NAME} > /dev/null - chown -R ${_NAME}. /opt/${_NAME} + if [[ -f /opt/headphones/headphones.db && ! -f /var/lib/headphones/headphones.db ]]; then + cp -a /opt/headphones/headphones.db /var/lib/headphones/ + echo "Copied headphones.db from /opt/headphones/ -> /var/lib/headphones/" + fi - # 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 + if [[ -d /opt/headphones/logs && ! -d /var/lib/headphones/logs ]]; then + cp -a /opt/headphones/logs /var/lib/headphones/ + echo "Copied logs from /opt/headphones/ -> /var/lib/headphones/" + 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 "" -} + if [[ -d /opt/headphones/cache && ! -d /var/lib/headphones/cache ]]; then + cp -a /opt/headphones/cache /var/lib/headphones/ + echo "Copied cache from /opt/headphones/ -> /var/lib/headphones/" + fi + fi -post_upgrade() { - post_install -} + if [[ "$( getent passwd headphones | cut -d: -f6 )" != "/var/lib/headphones" ]]; then + usermod -d /var/lib/headphones headphones + if [[ $? -ne 0 ]]; then + echo "Could not change headphones users home directory." + echo "Run: sudo systemctl stop headphones ; sudo usermod -d /var/lib/headphones headphones ; sudo systemctl start headphones" + fi + fi -post_remove() { - echo "Some files have not been removed because they are created by ${_NAME} itself, e.g. the music database." - userdel -f ${_NAME} + if [[ -d /opt/lazylibrarian ]]; then + echo "Remove /opt/lazylibrarian if everything is working correctly from /var/lib/lazylibrarian now." + fi } diff --git a/headphones.sysusers b/headphones.sysusers new file mode 100644 index 000000000000..f585d41f3a07 --- /dev/null +++ b/headphones.sysusers @@ -0,0 +1 @@ +u headphones - "Headphones Server" /var/lib/headphones diff --git a/headphones.tmpfile b/headphones.tmpfile deleted file mode 100644 index d5194efaa143..000000000000 --- a/headphones.tmpfile +++ /dev/null @@ -1 +0,0 @@ -d /run/headphones 0775 headphones headphones diff --git a/headphones.tmpfiles b/headphones.tmpfiles new file mode 100644 index 000000000000..b39de0dcab17 --- /dev/null +++ b/headphones.tmpfiles @@ -0,0 +1,3 @@ +d /var/lib/headphones 0755 headphones headphones +Z /var/lib/headphones - headphones headphones +Z /usr/lib/headphones - headphones headphones |