arch-pkgs/bind-adblock/PKGBUILD

57 lines
2 KiB
Text
Raw Normal View History

# Maintainer: George Rawlinson <george@rawlinson.net.nz>
pkgname=bind-adblock
pkgver=2009021459
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>=9.8')
makedepends=(python-requests python-dnspython)
backup=('var/named/adblock.rpz')
install=$pkgname.install
# Commit IDs of latest Git commit
_long=7bc3d5b3cd87eb5af11e1b531842eef550df23a7
_short="${_long:0:6}"
source=("$_short-update-zonefile.py::https://raw.githubusercontent.com/Trellmor/bind-adblock/$_long/update-zonefile.py"
"$_short-LICENSE::https://raw.githubusercontent.com/Trellmor/bind-adblock/$_long/LICENSE"
"$_short-blocklist.txt::https://raw.githubusercontent.com/Trellmor/bind-adblock/$_long/blocklist.txt")
sha512sums=('a83a727021abae5a2b28843d3111177b2e4ef025db462710012cd642b0c445e449b359a3082bb09c925e9f73ca0535ef739bdd1464783aa433b923aeeb6bd53c'
'19c76446db8f97aece5045aeb0e0303d152522383d1d543bb42fcc37dd8d50013030946293047b115f2c3ee0d238f8b1ec6b6dd1b5327d2ff95dded5edd83787'
'c7a4b2254d9ac5888a7f02649fa97c1f0540bfcd968366f3a64d8a575576d715a05128fc7d8aa6015ec0e1cbf973c1019f9af76b0fb668478efd9806803f2d2f')
pkgver() {
date +%y%m%d%H%M
}
prepare() {
mkdir -p "$pkgname"
cp "$_short-update-zonefile.py" "$pkgname/update-zonefile.py"
cp "$_short-blocklist.txt" "$pkgname/blocklist.txt"
}
_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() {
# ensure directory permissions follow upstream (770)
install -dm770 "$pkgdir/var/named"
# package zonefile
install -Dm644 "$srcdir/$pkgname/$_zonefile-$pkgver" "$pkgdir/var/named/$_zonefile"
# package license
install -Dm644 "$srcdir/$_short-LICENSE" "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}