arch-pkgs/rutorrent/PKGBUILD

84 lines
2.2 KiB
Bash

# Maintainer: George Rawlinson <george@rawlinson.net.nz>
pkgname=rutorrent
pkgver=4.0
pkgrel=1
pkgdesc='Yet another web front-end for rTorrent'
arch=('any')
url='https://github.com/Novik/ruTorrent'
license=('GPL')
depends=(
'php-fpm'
'php-geoip'
'curl'
'gzip'
'coreutils'
)
makedepends=('git' 'perl')
backup=(
'etc/rutorrent/config.php'
'etc/rutorrent/plugins.ini'
'etc/rutorrent/access.ini'
)
options=('emptydirs' '!strip')
_commit='06222a00375bdd0f1f1b5b58bda29e7025316428'
source=(
"$pkgname::git+$url#commit=$_commit"
'tmpfiles.conf'
'config.patch'
)
b2sums=('SKIP'
'f762fe34e415632f4a458f83ab305a7c5fe231c04ed3cce7b3a7ab99e00aa4a767bab8212edcff80b954d974cf347919b36052dcea5caf0504fb79b745456349'
'4b71911de4b9f75d7d3d3e5d0e5fbc611c218a8e77f9fa3af969d6f0f9d5491418d3cb0b8d0720f2c6c37a4bd87f9db7c875aa9d0caf17ab99dd8f224805215b')
pkgver() {
cd "$pkgname"
git describe --tags | sed -e 's/^v//' -e 's/-stable$//'
}
prepare() {
cd "$pkgname"
# move config & log location
patch -p1 -i "$srcdir/config.patch"
# move config/settings to /var/lib/rutorrent
rm -rf share
# delete git files
find . -type f -name ".git*" -delete
# delete POSIX-incompatible files
cd plugins/tracklabels/labels
find . -print0 | perl -MFile::Path=remove_tree -n0e 'chomp; remove_tree($_, {verbose=>1}) if /[[:^ascii:][:cntrl:]]/'
}
package() {
cd "$pkgname"
# create directories
install -vd "$pkgdir/usr/share/$pkgname/conf" "$pkgdir/etc/$pkgname"
# copy files over
cp -r . "$pkgdir/usr/share/$pkgname"
# link config files to /etc/$pkgname
for conf in config.php plugins.ini access.ini; do
mv "conf/$conf" "$pkgdir/etc/$pkgname"
ln -sf "/etc/$pkgname/$conf" "$pkgdir/usr/share/$pkgname/conf/$conf"
done
# license & documentation
install -Dm644 -t "$pkgdir/usr/share/licenses/$pkgname" LICENSE.md
install -Dm644 -t "$pkgdir/usr/share/doc/$pkgname" README.md htaccess-example
# remove unnecessary files
rm -rf "$pkgdir/usr/share/$pkgname/"{LICENSE.md,README.md,htaccess-example,.git,.github,tests}
# systemd integration
install -Dm644 "$srcdir/tmpfiles.conf" "$pkgdir/usr/lib/tmpfiles.d/$pkgname.conf"
# change ownership
chown -R http:http "$pkgdir/usr/share/$pkgname"
}