arch-pkgs/bind-adblock/PKGBUILD

54 lines
1.1 KiB
Bash
Raw Permalink Normal View History

# Maintainer: George Rawlinson <george@rawlinson.net.nz>
2023-08-26 08:51:09 +00:00
pkgname=bind-adblock
2023-08-26 08:51:09 +00:00
pkgver=1
pkgrel=1
2023-08-26 08:51:09 +00:00
pkgdesc='Fetch various blocklists and generate a BIND RPZ zonefile'
arch=('any')
2023-08-26 08:51:09 +00:00
url='https://github.com/Trellmor/bind-adblock'
license=('MIT')
2023-08-26 08:51:09 +00:00
depends=('bind')
makedepends=(
'git'
'python-requests'
'python-dnspython'
'python-yaml'
'python-validators'
)
backup=('var/named/adblock.rpz')
2023-08-26 08:51:09 +00:00
install="$pkgname.install"
_commit='c621ce83e89dea5d7c1a19d0d802d6406d406ca5'
source=("$pkgname::git+$url#commit=$_commit")
b2sums=('SKIP')
pkgver() {
2023-08-26 08:51:09 +00:00
date +%y%m%d%H%M
}
_zonefile=adblock.rpz
_origin=adblock.rpz
build() {
2023-08-26 08:51:09 +00:00
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() {
2023-08-26 08:51:09 +00:00
cd "$pkgname"
# ensure directory permissions follow upstream (770)
install -vdm770 "$pkgdir/var/named"
2023-08-26 08:51:09 +00:00
# zonefile
install -vDm644 "$_zonefile-$pkgver" "$pkgdir/var/named/$_zonefile"
2023-08-26 08:51:09 +00:00
# license
install -vDm644 LICENSE -t "$pkgdir/usr/share/licenses/$pkgname"
}