arch-pkgs/bind-adblock/PKGBUILD

53 lines
1.1 KiB
Bash

# Maintainer: George Rawlinson <george@rawlinson.net.nz>
pkgname=bind-adblock
pkgver=1
pkgrel=1
pkgdesc='Fetch various blocklists and generate a BIND RPZ zonefile'
arch=('any')
url='https://github.com/Trellmor/bind-adblock'
license=('MIT')
depends=('bind')
makedepends=(
'git'
'python-requests'
'python-dnspython'
'python-yaml'
'python-validators'
)
backup=('var/named/adblock.rpz')
install="$pkgname.install"
_commit='c621ce83e89dea5d7c1a19d0d802d6406d406ca5'
source=("$pkgname::git+$url#commit=$_commit")
b2sums=('SKIP')
pkgver() {
date +%y%m%d%H%M
}
_zonefile=adblock.rpz
_origin=adblock.rpz
build() {
cd "$pkgname"
# instead of packaging the script, build zonefile & update regularly
python update-zonefile.py \
--no-bind \
"$_zonefile-$pkgver" \
"$_origin"
sed -i "1 s/ 1 / ${pkgver} /" "$_zonefile-$pkgver"
}
package() {
cd "$pkgname"
# ensure directory permissions follow upstream (770)
install -vdm770 "$pkgdir/var/named"
# zonefile
install -vDm644 "$_zonefile-$pkgver" "$pkgdir/var/named/$_zonefile"
# license
install -vDm644 LICENSE -t "$pkgdir/usr/share/licenses/$pkgname"
}