Add pi-hole

This commit is contained in:
moparisthebest
2018-08-13 09:35:19 -04:00
parent 5c0c413371
commit e9b5ca36a7
20 changed files with 825 additions and 0 deletions

71
src/pi-hole-ftl/PKGBUILD Normal file
View File

@@ -0,0 +1,71 @@
# Maintainer: max.bra <max dot bra dot gtalk at gmail dot com>
pkgname=pi-hole-ftl
_pkgname=FTL
pkgver=3.0
pkgrel=2
arch=('i686' 'x86_64' 'arm' 'armv6h' 'armv7h' 'aarch64')
pkgdesc="The Pi-hole FTL engine"
url="https://github.com/pi-hole/FTL"
license=('EUPL-1.1')
depends=()
makedepends=('sqlite')
install=$pkgname.install
backup=('etc/pihole/pihole-FTL.conf')
source=("https://github.com/pi-hole/FTL/archive/v$pkgver.tar.gz"
"$pkgname.tmpfile"
"$pkgname.service"
"$pkgname.conf"
"$pkgname.sysuser"
)
md5sums=('45fd33e4498b2ab9403d96e1251abb8c'
'ca844c23699ba64777571253bc7ccb21'
'0f65203b2585fb83e02826091d220386'
'2d6ae93eea48a09ce5bc5bf62e081dd4'
'68e78907dc2a0c89421d02377e76d353')
prepare() {
_ssc="/tmp/sedcontrol"
cd "$srcdir"/"$_pkgname"-"$pkgver"
# git descriptions setup
sed -i "s|^GIT_BRANCH := .*$|GIT_BRANCH := master|w $_ssc" "$srcdir"/$_pkgname-$pkgver/Makefile
if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: git descriptions setup 1" && return 1 ; fi
sed -i "s|^GIT_VERSION := .*$|GIT_VERSION := v$pkgver|w $_ssc" "$srcdir"/$_pkgname-$pkgver/Makefile
if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: git descriptions setup 2" && return 1 ; fi
sed -i "s|^GIT_DATE := .*$|GIT_DATE := $(date -I)|w $_ssc" "$srcdir"/$_pkgname-$pkgver/Makefile
if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: git descriptions setup 3" && return 1 ; fi
sed -i "s|^GIT_TAG := .*$|GIT_TAG := v$pkgver|w $_ssc" "$srcdir"/$_pkgname-$pkgver/Makefile
if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: git descriptions setup 4" && return 1 ; fi
# setting up logs paths
sed -i "s|/var/log/pihole-FTL.log|/run/log/pihole-ftl/pihole-FTL.log|w $_ssc" "$srcdir"/$_pkgname-$pkgver/memory.c
if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: setting up logs paths 1" && return 1 ; fi
sed -i "s|/var/run/pihole-FTL|/run/pihole-ftl/pihole-FTL|w $_ssc" "$srcdir"/$_pkgname-$pkgver/memory.c
if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: setting up logs paths 2" && return 1 ; fi
sed -i "s|/var/log/pihole.log|/run/log/pihole/pihole.log|w $_ssc" "$srcdir"/$_pkgname-$pkgver/memory.c
if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: setting up logs paths 3" && return 1 ; fi
sed -i "s|/var/run/pihole/|/run/pihole-ftl/|w $_ssc" "$srcdir"/$_pkgname-$pkgver/memory.c
if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: setting up logs paths 4" && return 1 ; fi
}
build() {
cd $_pkgname-$pkgver
make
}
package() {
cd "$srcdir"
install -Dm755 "$_pkgname"-$pkgver/pihole-FTL "${pkgdir}"/usr/bin/pihole-FTL
install -Dm644 "$pkgname.tmpfile" "$pkgdir"/usr/lib/tmpfiles.d/$pkgname.conf
install -Dm644 "$pkgname.sysuser" "$pkgdir"/usr/lib/sysusers.d/$pkgname.conf
install -dm755 "$pkgdir"/etc/pihole
install -Dm644 "$pkgname.conf" "$pkgdir"/etc/pihole/pihole-FTL.conf
install -Dm644 "$pkgname.service" "$pkgdir"/usr/lib/systemd/system/$pkgname.service
install -dm755 "$pkgdir/usr/lib/systemd/system/multi-user.target.wants"
ln -s ../$pkgname.service "$pkgdir/usr/lib/systemd/system/multi-user.target.wants/$pkgname.service"
}

View File

@@ -0,0 +1,9 @@
SOCKET_LISTENING=localonly
TIMEFRAME=rolling24h
QUERY_DISPLAY=yes
AAAA_QUERY_ANALYSIS=yes
MAXDBDAYS=365
RESOLVE_IPV6=yes
RESOLVE_IPV4=yes
DBINTERVAL=1.0
DBFILE=/etc/pihole/pihole-FTL.db

View File

@@ -0,0 +1,12 @@
post_install() {
echo -e "\e[1;33m==>\e[0m Possible configurations in \e[1;31m/etc/pihole/pihole-FTL.conf\e[0m file"
echo -e "\e[1;33m==>\e[0m Please read the instructions on the project page: \e[1;36mhttps://github.com/pi-hole/FTL#ftls-config-file\e[0m"
}
post_upgrade() {
post_install $1
}
post_remove() {
userdel -f pihole
}

View File

@@ -0,0 +1,12 @@
[Unit]
Description=Pi-hole FTL engine
[Service]
User=pihole
Group=pihole
PIDFile=/run/pihole-ftl/pihole-FTL.pid
ExecStart=/usr/bin/pihole-FTL no-daemon
Restart=on-failure
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1 @@
u pihole - "pihole daemon" /

View File

@@ -0,0 +1,5 @@
d /run/log/pihole-ftl 0755 pihole pihole - -
f /run/log/pihole-ftl/pihole-FTL.log 0644 pihole pihole - -
d /run/pihole-ftl 0755 pihole pihole - -
f /run/pihole-ftl/pihole-FTL.pid 0644 pihole pihole - -
f /run/pihole-ftl/pihole-FTL.port 0644 pihole pihole - -