mirror of
https://github.com/moparisthebest/arch-ppa
synced 2024-11-28 03:22:17 -05:00
Add pi-hole
This commit is contained in:
parent
5c0c413371
commit
e9b5ca36a7
71
src/pi-hole-ftl/PKGBUILD
Normal file
71
src/pi-hole-ftl/PKGBUILD
Normal 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"
|
||||||
|
}
|
9
src/pi-hole-ftl/pi-hole-ftl.conf
Normal file
9
src/pi-hole-ftl/pi-hole-ftl.conf
Normal 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
|
12
src/pi-hole-ftl/pi-hole-ftl.install
Normal file
12
src/pi-hole-ftl/pi-hole-ftl.install
Normal 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
|
||||||
|
}
|
12
src/pi-hole-ftl/pi-hole-ftl.service
Normal file
12
src/pi-hole-ftl/pi-hole-ftl.service
Normal 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
|
1
src/pi-hole-ftl/pi-hole-ftl.sysuser
Normal file
1
src/pi-hole-ftl/pi-hole-ftl.sysuser
Normal file
@ -0,0 +1 @@
|
|||||||
|
u pihole - "pihole daemon" /
|
5
src/pi-hole-ftl/pi-hole-ftl.tmpfile
Normal file
5
src/pi-hole-ftl/pi-hole-ftl.tmpfile
Normal 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 - -
|
319
src/pi-hole-server/PKGBUILD
Normal file
319
src/pi-hole-server/PKGBUILD
Normal file
@ -0,0 +1,319 @@
|
|||||||
|
# Maintainer: max.bra <max dot bra dot gtalk at gmail dot com>
|
||||||
|
# Maintainer: graysky <graysky AT archlinux DOT us>
|
||||||
|
|
||||||
|
pkgname=pi-hole-server
|
||||||
|
_pkgname=pi-hole
|
||||||
|
pkgver=3.3.1
|
||||||
|
pkgrel=1
|
||||||
|
_wwwpkgname=AdminLTE
|
||||||
|
_wwwpkgver=3.3
|
||||||
|
pkgdesc='The Pi-hole is an advertising-aware DNS/Web server. Arch adaptation for lan wide DNS server.'
|
||||||
|
arch=('any')
|
||||||
|
license=('EUPL-1.1')
|
||||||
|
url="https://github.com/pi-hole/pi-hole"
|
||||||
|
depends=('dnsmasq' 'bc' 'perl' 'net-tools' 'iproute2' 'logrotate' 'pi-hole-ftl')
|
||||||
|
optdepends=(
|
||||||
|
'lighttpd: a secure, fast, compliant and very flexible web-server'
|
||||||
|
'php-cgi: CGI and FCGI SAPI for PHP needed only for lighttpd'
|
||||||
|
'nginx-mainline: lightweight http server'
|
||||||
|
'php-fpm: FastCGI process manager for php needed for nginx'
|
||||||
|
)
|
||||||
|
conflicts=('pi-hole-standalone')
|
||||||
|
install=$pkgname.install
|
||||||
|
backup=('etc/pihole/whitelist.txt' 'etc/pihole/blacklist.txt'
|
||||||
|
'etc/dnsmasq.d/01-pihole.conf')
|
||||||
|
|
||||||
|
source=(pihole-$pkgver.tar.gz::https://github.com/$_pkgname/$_pkgname/archive/v$pkgver.tar.gz
|
||||||
|
admin-$_wwwpkgver.tar.gz::https://github.com/$_pkgname/$_wwwpkgname/archive/v$_wwwpkgver.tar.gz
|
||||||
|
dnsmasq.main
|
||||||
|
dnsmasq.include
|
||||||
|
lighttpd.pi-hole.conf
|
||||||
|
nginx.pi-hole.conf
|
||||||
|
$_pkgname.tmpfile
|
||||||
|
$_pkgname-gravity.service
|
||||||
|
$_pkgname-gravity.timer
|
||||||
|
$_pkgname-logtruncate.service
|
||||||
|
$_pkgname-logtruncate.timer
|
||||||
|
mimic_setupVars.conf.sh
|
||||||
|
version.patch
|
||||||
|
piholeDebug.sh
|
||||||
|
)
|
||||||
|
|
||||||
|
md5sums=('ea4f64bdf88620f59a1b01c19253e4e3'
|
||||||
|
'23368537fa576480e45f625b5e1a7cd7'
|
||||||
|
'3f1aeea43af0b192edb36b9e5484ff87'
|
||||||
|
'ad008fac3c7351aa0d5205079b3dfb18'
|
||||||
|
'a3518f54241ef2e67c17c7b144cb6a93'
|
||||||
|
'b63fcf29c29796023a2677bcf2b369a7'
|
||||||
|
'990b8abd0bfbba23a7ce82c59f2e3d64'
|
||||||
|
'047f13d4ac97877f724f87b002aaee63'
|
||||||
|
'd42a864f88299998f8233c0bc0dd093d'
|
||||||
|
'20c5b0c6b4e23e55b25ab6c28dda709d'
|
||||||
|
'291d3c95e445fe65caf40c3605efd186'
|
||||||
|
'c227ffa88ddebc34cb715b73640cd845'
|
||||||
|
'93fe5e50cf3fcb08b24cf29b0cace85b'
|
||||||
|
'd7b69ae51db0e8ac8e27f20a234eed85')
|
||||||
|
|
||||||
|
prepare() {
|
||||||
|
_ssc="/tmp/sedcontrol"
|
||||||
|
|
||||||
|
# the return of service management
|
||||||
|
sed -i "s|service dnsmasq \${svcOption}|systemctl \${svcOption} dnsmasq|w $_ssc" "$srcdir"/$_pkgname-$pkgver/pihole
|
||||||
|
if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: the return of service management" && return 1 ; fi
|
||||||
|
|
||||||
|
# setting up and securing pihole wrapper script
|
||||||
|
#sed -n "/debugFunc() {/w $_ssc" "$srcdir"/$_pkgname-$pkgver/pihole
|
||||||
|
#if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: setting up and securing pihole wrapper script 1" && return 1 ; fi
|
||||||
|
#sed -i '/debugFunc() {/,+16d' "$srcdir"/$_pkgname-$pkgver/pihole
|
||||||
|
|
||||||
|
sed -n "/updatePiholeFunc() {/w $_ssc" "$srcdir"/$_pkgname-$pkgver/pihole
|
||||||
|
if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: setting up and securing pihole wrapper script 2" && return 1 ; fi
|
||||||
|
sed -i '/updatePiholeFunc() {/,+4d' "$srcdir"/$_pkgname-$pkgver/pihole
|
||||||
|
|
||||||
|
sed -n "/reconfigurePiholeFunc() {/w $_ssc" "$srcdir"/$_pkgname-$pkgver/pihole
|
||||||
|
if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: setting up and securing pihole wrapper script 3" && return 1 ; fi
|
||||||
|
sed -i '/reconfigurePiholeFunc() {/,+4d' "$srcdir"/$_pkgname-$pkgver/pihole
|
||||||
|
|
||||||
|
sed -n "/uninstallFunc() {/w $_ssc" "$srcdir"/$_pkgname-$pkgver/pihole
|
||||||
|
if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: setting up and securing pihole wrapper script 4" && return 1 ; fi
|
||||||
|
sed -i '/uninstallFunc() {/,+4d' "$srcdir"/$_pkgname-$pkgver/pihole
|
||||||
|
|
||||||
|
sed -n "/piholeCheckoutFunc() {/w $_ssc" "$srcdir"/$_pkgname-$pkgver/pihole
|
||||||
|
if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: setting up and securing pihole wrapper script 5" && return 1 ; fi
|
||||||
|
sed -i '/piholeCheckoutFunc() {/,+20d' "$srcdir"/$_pkgname-$pkgver/pihole
|
||||||
|
|
||||||
|
sed -n "/tricorderFunc() {/w $_ssc" "$srcdir"/$_pkgname-$pkgver/pihole
|
||||||
|
if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: setting up and securing pihole wrapper script 6" && return 1 ; fi
|
||||||
|
sed -i '/tricorderFunc() {/,+29d' "$srcdir"/$_pkgname-$pkgver/pihole
|
||||||
|
|
||||||
|
sed -n "/\"\-[r,up]/w $_ssc" "$srcdir"/$_pkgname-$pkgver/pihole
|
||||||
|
if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: setting up and securing pihole wrapper script 7" && return 1 ; fi
|
||||||
|
sed -i '/\"\-[r,up]/d' "$srcdir"/$_pkgname-$pkgver/pihole
|
||||||
|
|
||||||
|
#sed -n "/^ \-d/w $_ssc" "$srcdir"/$_pkgname-$pkgver/pihole
|
||||||
|
#if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: setting up and securing pihole wrapper script 8" && return 1 ; fi
|
||||||
|
#sed -i '/^ \-d/,+2d' "$srcdir"/$_pkgname-$pkgver/pihole
|
||||||
|
|
||||||
|
sed -n "/^ \-up/w $_ssc" "$srcdir"/$_pkgname-$pkgver/pihole
|
||||||
|
if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: setting up and securing pihole wrapper script 9" && return 1 ; fi
|
||||||
|
sed -i '/^ \-up/d' "$srcdir"/$_pkgname-$pkgver/pihole
|
||||||
|
|
||||||
|
sed -n "/^ \-r/w $_ssc" "$srcdir"/$_pkgname-$pkgver/pihole
|
||||||
|
if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: setting up and securing pihole wrapper script 10" && return 1 ; fi
|
||||||
|
sed -i '/^ \-r/d' "$srcdir"/$_pkgname-$pkgver/pihole
|
||||||
|
|
||||||
|
sed -n "/uninstall/w $_ssc" "$srcdir"/$_pkgname-$pkgver/pihole
|
||||||
|
if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: setting up and securing pihole wrapper script 11" && return 1 ; fi
|
||||||
|
sed -i '/uninstall/d' "$srcdir"/$_pkgname-$pkgver/pihole
|
||||||
|
|
||||||
|
sed -i "s|^ checkout.*$|\";|w $_ssc" "$srcdir"/$_pkgname-$pkgver/pihole
|
||||||
|
if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: setting up and securing pihole wrapper script 12" && return 1 ; fi
|
||||||
|
|
||||||
|
sed -n "/checkout/w $_ssc" "$srcdir"/$_pkgname-$pkgver/pihole
|
||||||
|
if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: setting up and securing pihole wrapper script 13" && return 1 ; fi
|
||||||
|
sed -i '/checkout/d' "$srcdir"/$_pkgname-$pkgver/pihole
|
||||||
|
|
||||||
|
sed -n "/tricorder/w $_ssc" "$srcdir"/$_pkgname-$pkgver/pihole
|
||||||
|
if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: setting up and securing pihole wrapper script 14" && return 1 ; fi
|
||||||
|
sed -i '/tricorder/d' "$srcdir"/$_pkgname-$pkgver/pihole
|
||||||
|
|
||||||
|
# -----------------
|
||||||
|
|
||||||
|
# setup gravity.sh
|
||||||
|
sed -i "s|/usr/local/bin/|/usr/bin/|w $_ssc" "$srcdir"/$_pkgname-$pkgver/gravity.sh
|
||||||
|
if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: setup gravity.sh 1" && return 1 ; fi
|
||||||
|
sed -i "s|/etc/\.|/etc/|w $_ssc" "$srcdir"/$_pkgname-$pkgver/gravity.sh
|
||||||
|
if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: setup gravity.sh 2" && return 1 ; fi
|
||||||
|
|
||||||
|
# -----------------
|
||||||
|
|
||||||
|
# setting up and securing webpage.sh script
|
||||||
|
sed -i "s|/usr/local/bin/|/usr/bin/|w $_ssc" "$srcdir"/$_pkgname-$pkgver/advanced/Scripts/webpage.sh
|
||||||
|
if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: setting up and securing webpage.sh script 1" && return 1 ; fi
|
||||||
|
|
||||||
|
# -----------------
|
||||||
|
|
||||||
|
# change log location to pihole script
|
||||||
|
sed -i "s|/var/log/pihole.log|/run/log/pihole/pihole.log|w $_ssc" "$srcdir"/$_pkgname-$pkgver/pihole
|
||||||
|
if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: change log location to pihole script" && return 1 ; fi
|
||||||
|
|
||||||
|
# -----------------
|
||||||
|
|
||||||
|
# change log location to piholeLogFlush.sh
|
||||||
|
sed -n "/\/var\/log\/pihole.log/w $_ssc" "$srcdir"/$_pkgname-$pkgver/advanced/Scripts/piholeLogFlush.sh
|
||||||
|
if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: change log location to piholeLogFlush.sh" && return 1 ; fi
|
||||||
|
sed -i "s|/var/log/pihole.log|/run/log/pihole/pihole.log|g" "$srcdir"/$_pkgname-$pkgver/advanced/Scripts/piholeLogFlush.sh
|
||||||
|
|
||||||
|
# -----------------
|
||||||
|
|
||||||
|
# change log and bin location to logrotate
|
||||||
|
sed -i "s|/var/log/pihole.log|/run/log/pihole/pihole.log|w $_ssc" "$srcdir"/$_pkgname-$pkgver/advanced/logrotate
|
||||||
|
if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: change log and bin location to logrotate 1" && return 1 ; fi
|
||||||
|
sed -i "s|/var/log/pihole-FTL.log|/run/log/pihole-ftl/pihole-FTL.log|w $_ssc" "$srcdir"/$_pkgname-$pkgver/advanced/logrotate
|
||||||
|
if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: change log and bin location to logrotate 2" && return 1 ; fi
|
||||||
|
sed -i "s|/usr/sbin|/usr/bin|w $_ssc" "$srcdir"/$_pkgname-$pkgver/advanced/Scripts/piholeLogFlush.sh
|
||||||
|
if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: change log and bin location to logrotate 3" && return 1 ; fi
|
||||||
|
|
||||||
|
# -----------------
|
||||||
|
|
||||||
|
# change FTL port file location to chronometer.sh
|
||||||
|
sed -i "s|/var/run/pihole-FTL.port|/run/pihole-ftl/pihole-FTL.port|w $_ssc" "$srcdir"/$_pkgname-$pkgver/advanced/Scripts/chronometer.sh
|
||||||
|
if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: change FTL port file location to chronometer.sh" && return 1 ; fi
|
||||||
|
|
||||||
|
# -----------------
|
||||||
|
|
||||||
|
# no debug for us, right now
|
||||||
|
sed -n "/\-\- Generate debug log \-\-/w $_ssc" "$srcdir"/$_wwwpkgname-$_wwwpkgver/scripts/pi-hole/php/header.php
|
||||||
|
if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: no debug for us, right now 1" && return 1 ; fi
|
||||||
|
sed -i '/\-\- Generate debug log \-\-/,+5d' "$srcdir"/$_wwwpkgname-$_wwwpkgver/scripts/pi-hole/php/header.php
|
||||||
|
|
||||||
|
# -----------------
|
||||||
|
|
||||||
|
# change log location in admin php interface
|
||||||
|
sed -i "s|/var/log/pihole.log|/run/log/pihole/pihole.log|w $_ssc" "$srcdir"/$_wwwpkgname-$_wwwpkgver/scripts/pi-hole/php/data.php
|
||||||
|
if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: change log location in admin php interface 1" && return 1 ; fi
|
||||||
|
|
||||||
|
sed -i "s|/var/run/pihole-FTL.port|/run/pihole-ftl/pihole-FTL.port|w $_ssc" "$srcdir"/$_wwwpkgname-$_wwwpkgver/scripts/pi-hole/php/FTL.php
|
||||||
|
if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: change log location in admin php interface 2" && return 1 ; fi
|
||||||
|
sed -i "s|/var/log/pihole-FTL.log|/run/log/pihole-ftl/pihole-FTL.log|w $_ssc" "$srcdir"/$_wwwpkgname-$_wwwpkgver/scripts/pi-hole/php/tailLog.php
|
||||||
|
if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: change log location in admin php interface 3" && return 1 ; fi
|
||||||
|
sed -i "s|/var/log/pihole.log|/run/log/pihole/pihole.log|w $_ssc" "$srcdir"/$_wwwpkgname-$_wwwpkgver/scripts/pi-hole/php/tailLog.php
|
||||||
|
if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: change log location in admin php interface 4" && return 1 ; fi
|
||||||
|
|
||||||
|
# -----------------
|
||||||
|
|
||||||
|
# since we don't directly install from git...
|
||||||
|
# sed -n "/\$core_branch =.*$/w $_ssc" "$srcdir"/$_wwwpkgname-$_wwwpkgver/scripts/pi-hole/php/update_checker.php
|
||||||
|
# if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: since we don't directly install from git... 1" && return 1 ; fi
|
||||||
|
# sed -i 's/\$core_branch =.*$/\$core_branch = "master";/' "$srcdir"/$_wwwpkgname-$_wwwpkgver/scripts/pi-hole/php/update_checker.php
|
||||||
|
# sed -n "/\$web_branch =.*$/w $_ssc" "$srcdir"/$_wwwpkgname-$_wwwpkgver/scripts/pi-hole/php/update_checker.php
|
||||||
|
# if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: since we don't directly install from git... 2" && return 1 ; fi
|
||||||
|
# sed -i 's/\$web_branch =.*$/\$web_branch = "master";/' "$srcdir"/$_wwwpkgname-$_wwwpkgver/scripts/pi-hole/php/update_checker.php
|
||||||
|
|
||||||
|
sed -n "/\$core_current =.*$/w $_ssc" "$srcdir"/$_wwwpkgname-$_wwwpkgver/scripts/pi-hole/php/update_checker.php
|
||||||
|
if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: since we don't directly install from git... 3" && return 1 ; fi
|
||||||
|
sed -i 's/\$core_current =.*$/\$core_current = "'"$pkgver"'";/' "$srcdir"/$_wwwpkgname-$_wwwpkgver/scripts/pi-hole/php/update_checker.php
|
||||||
|
sed -n "/\$web_current =.*$/w $_ssc" "$srcdir"/$_wwwpkgname-$_wwwpkgver/scripts/pi-hole/php/update_checker.php
|
||||||
|
if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: since we don't directly install from git... 4" && return 1 ; fi
|
||||||
|
sed -i 's/\$web_current =.*$/\$web_current = "'"$_wwwpkgver"'";/' "$srcdir"/$_wwwpkgname-$_wwwpkgver/scripts/pi-hole/php/update_checker.php
|
||||||
|
sed -n "/\$FTL_current =.*$/w $_ssc" "$srcdir"/$_wwwpkgname-$_wwwpkgver/scripts/pi-hole/php/update_checker.php
|
||||||
|
if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: since we don't directly install from git... 4" && return 1 ; fi
|
||||||
|
sed -i 's/\$FTL_current =.*$/\$FTL_current = exec("pihole-FTL version");/' "$srcdir"/$_wwwpkgname-$_wwwpkgver/scripts/pi-hole/php/update_checker.php
|
||||||
|
|
||||||
|
# sed -n "/\$core_commit =.*$/w $_ssc" "$srcdir"/$_wwwpkgname-$_wwwpkgver/scripts/pi-hole/php/update_checker.php
|
||||||
|
# if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: since we don't directly install from git... 5" && return 1 ; fi
|
||||||
|
# sed -i 's/\$core_commit =.*$/\$core_commit = NULL;/' "$srcdir"/$_wwwpkgname-$_wwwpkgver/scripts/pi-hole/php/update_checker.php
|
||||||
|
# sed -n "/\$web_commit =.*$/w $_ssc" "$srcdir"/$_wwwpkgname-$_wwwpkgver/scripts/pi-hole/php/update_checker.php
|
||||||
|
# if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: since we don't directly install from git... 6" && return 1 ; fi
|
||||||
|
# sed -i 's/\$web_commit =.*$/\$web_commit = NULL;/' "$srcdir"/$_wwwpkgname-$_wwwpkgver/scripts/pi-hole/php/update_checker.php
|
||||||
|
|
||||||
|
sed -i "s|/var/www/html/admin/|/srv/http/pihole/admin/|w $_ssc" "$srcdir"/$_pkgname-$pkgver/advanced/Scripts/version.sh
|
||||||
|
if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: since we don't directly install from git... 7" && return 1 ; fi
|
||||||
|
|
||||||
|
cd "$srcdir"/"$_pkgname"-"$pkgver"
|
||||||
|
patch -p1 -i "$srcdir"/version.patch
|
||||||
|
cd "$srcdir"
|
||||||
|
|
||||||
|
sed -n "/{{corever}}/w $_ssc" "$srcdir"/$_pkgname-$pkgver/advanced/Scripts/version.sh
|
||||||
|
if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: since we don't directly install from git... 13" && return 1 ; fi
|
||||||
|
sed -i "s/{{corever}}/$pkgver/" "$srcdir"/$_pkgname-$pkgver/advanced/Scripts/version.sh
|
||||||
|
sed -n "/{{webver}}/w $_ssc" "$srcdir"/$_pkgname-$pkgver/advanced/Scripts/version.sh
|
||||||
|
if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: since we don't directly install from git... 14" && return 1 ; fi
|
||||||
|
sed -i "s/{{webver}}/$_wwwpkgver/" "$srcdir"/$_pkgname-$pkgver/advanced/Scripts/version.sh
|
||||||
|
|
||||||
|
# -----------------
|
||||||
|
|
||||||
|
# web admin footer update setup
|
||||||
|
sed -i "s|https:\/\/github.com\/pi-hole\/pi-hole\/releases|https:\/\/aur.archlinux.org\/packages\/pi-hole-server|w $_ssc" "$srcdir"/$_wwwpkgname-$_wwwpkgver/scripts/pi-hole/php/footer.php
|
||||||
|
if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: web admin footer update setup 1" && return 1 ; fi
|
||||||
|
sed -i "s|https:\/\/github.com\/pi-hole\/AdminLTE\/releases|https:\/\/aur.archlinux.org\/packages\/pi-hole-server|w $_ssc" "$srcdir"/$_wwwpkgname-$_wwwpkgver/scripts/pi-hole/php/footer.php
|
||||||
|
if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: web admin footer update setup 2" && return 1 ; fi
|
||||||
|
sed -i "s|https:\/\/github.com\/pi-hole\/FTL\/releases|https:\/\/aur.archlinux.org\/packages\/pi-hole-server|w $_ssc" "$srcdir"/$_wwwpkgname-$_wwwpkgver/scripts/pi-hole/php/footer.php
|
||||||
|
if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: web admin footer update setup 3" && return 1 ; fi
|
||||||
|
|
||||||
|
# -----------------
|
||||||
|
|
||||||
|
# sudo pihole full path (php-fpm compatibility)
|
||||||
|
sed -i "s|sudo pihole|sudo /usr/bin/pihole|w $_ssc" "$srcdir"/$_wwwpkgname-$_wwwpkgver/api.php
|
||||||
|
if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: sudo pihole full path (php-fpm compatibility) 1" && return 1 ; fi
|
||||||
|
sed -i "s|sudo pihole|sudo /usr/bin/pihole|w $_ssc" "$srcdir"/$_wwwpkgname-$_wwwpkgver/scripts/pi-hole/php/header.php
|
||||||
|
if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: sudo pihole full path (php-fpm compatibility) 2" && return 1 ; fi
|
||||||
|
sed -i "s|sudo pihole|sudo /usr/bin/pihole|w $_ssc" "$srcdir"/$_wwwpkgname-$_wwwpkgver/scripts/pi-hole/php/queryads.php
|
||||||
|
if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: sudo pihole full path (php-fpm compatibility) 3" && return 1 ; fi
|
||||||
|
sed -i "s|sudo pihole|sudo /usr/bin/pihole|w $_ssc" "$srcdir"/$_wwwpkgname-$_wwwpkgver/scripts/pi-hole/php/savesettings.php
|
||||||
|
if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: sudo pihole full path (php-fpm compatibility) 4" && return 1 ; fi
|
||||||
|
sed -i "s|sudo pihole|sudo /usr/bin/pihole|w $_ssc" "$srcdir"/$_wwwpkgname-$_wwwpkgver/scripts/pi-hole/php/sub.php
|
||||||
|
if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: sudo pihole full path (php-fpm compatibility) 5" && return 1 ; fi
|
||||||
|
sed -i "s|sudo pihole|sudo /usr/bin/pihole|w $_ssc" "$srcdir"/$_wwwpkgname-$_wwwpkgver/scripts/pi-hole/php/add.php
|
||||||
|
if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: sudo pihole full path (php-fpm compatibility) 6" && return 1 ; fi
|
||||||
|
sed -i "s|sudo pihole|sudo /usr/bin/pihole|w $_ssc" "$srcdir"/$_wwwpkgname-$_wwwpkgver/scripts/pi-hole/php/gravity.sh.php
|
||||||
|
if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: sudo pihole full path (php-fpm compatibility) 7" && return 1 ; fi
|
||||||
|
sed -i "s|sudo pihole|sudo /usr/bin/pihole|w $_ssc" "$srcdir"/$_wwwpkgname-$_wwwpkgver/scripts/pi-hole/php/loginpage.php
|
||||||
|
if [ -s $_ssc ] ; then rm $_ssc ; else echo " ==> Sed error: sudo pihole full path (php-fpm compatibility) 8" && return 1 ; fi
|
||||||
|
|
||||||
|
# -----------------
|
||||||
|
|
||||||
|
# pi-hole sudoers file is now populated by install script
|
||||||
|
echo "http ALL=NOPASSWD: /usr/bin/pihole" >> $_pkgname-$pkgver/advanced/pihole.sudo
|
||||||
|
}
|
||||||
|
|
||||||
|
package() {
|
||||||
|
cd "$srcdir"
|
||||||
|
install -Dm755 $_pkgname-$pkgver/pihole "$pkgdir"/usr/bin/pihole
|
||||||
|
|
||||||
|
install -dm755 "$pkgdir"/opt/pihole
|
||||||
|
install -Dm755 $_pkgname-$pkgver/gravity.sh "$pkgdir"/opt/pihole/gravity.sh
|
||||||
|
install -Dm755 $_pkgname-$pkgver/advanced/Scripts/version.sh "$pkgdir"/opt/pihole/version.sh
|
||||||
|
install -Dm755 $_pkgname-$pkgver/advanced/Scripts/piholeLogFlush.sh "$pkgdir"/opt/pihole/piholeLogFlush.sh
|
||||||
|
install -Dm755 $_pkgname-$pkgver/advanced/Scripts/chronometer.sh "$pkgdir"/opt/pihole/chronometer.sh
|
||||||
|
install -Dm755 $_pkgname-$pkgver/advanced/Scripts/list.sh "$pkgdir"/opt/pihole/list.sh
|
||||||
|
install -Dm755 $_pkgname-$pkgver/advanced/Scripts/webpage.sh "$pkgdir"/opt/pihole/webpage.sh
|
||||||
|
install -Dm755 $_pkgname-$pkgver/advanced/Scripts/COL_TABLE "$pkgdir"/opt/pihole/COL_TABLE
|
||||||
|
|
||||||
|
install -Dm755 piholeDebug.sh "$pkgdir"/opt/pihole/piholeDebug.sh
|
||||||
|
install -Dm755 mimic_setupVars.conf.sh "$pkgdir"/opt/pihole/mimic_setupVars.conf.sh
|
||||||
|
|
||||||
|
install -dm750 "$pkgdir"/etc/sudoers.d
|
||||||
|
install -Dm440 $_pkgname-$pkgver/advanced/pihole.sudo "$pkgdir"/etc/sudoers.d/pihole
|
||||||
|
|
||||||
|
install -Dm644 pi-hole.tmpfile "$pkgdir"/usr/lib/tmpfiles.d/pi-hole.conf
|
||||||
|
|
||||||
|
install -Dm644 "$_pkgname-gravity.timer" "$pkgdir/usr/lib/systemd/system/$_pkgname-gravity.timer"
|
||||||
|
install -Dm644 "$_pkgname-gravity.service" $pkgdir/usr/lib/systemd/system/$_pkgname-gravity.service
|
||||||
|
install -Dm644 "$_pkgname-logtruncate.timer" "$pkgdir/usr/lib/systemd/system/$_pkgname-logtruncate.timer"
|
||||||
|
install -Dm644 "$_pkgname-logtruncate.service" $pkgdir/usr/lib/systemd/system/$_pkgname-logtruncate.service
|
||||||
|
install -dm755 "$pkgdir/usr/lib/systemd/system/multi-user.target.wants"
|
||||||
|
ln -s ../$_pkgname-gravity.timer "$pkgdir/usr/lib/systemd/system/multi-user.target.wants/$_pkgname-gravity.timer"
|
||||||
|
ln -s ../$_pkgname-logtruncate.timer "$pkgdir/usr/lib/systemd/system/multi-user.target.wants/$_pkgname-logtruncate.timer"
|
||||||
|
|
||||||
|
install -dm755 "$pkgdir"/etc/pihole
|
||||||
|
install -dm755 "$pkgdir"/usr/share/pihole/configs
|
||||||
|
install -Dm644 $_pkgname-$pkgver/adlists.default "$pkgdir"/etc/pihole/adlists.default
|
||||||
|
install -Dm644 $_pkgname-$pkgver/advanced/logrotate "$pkgdir"/etc/pihole/logrotate
|
||||||
|
install -Dm644 /dev/null "$pkgdir"/etc/pihole/whitelist.txt
|
||||||
|
install -Dm644 /dev/null "$pkgdir"/etc/pihole/blacklist.txt
|
||||||
|
|
||||||
|
install -Dm644 dnsmasq.main "$pkgdir"/usr/share/pihole/configs/dnsmasq.example.conf
|
||||||
|
install -Dm644 dnsmasq.include "$pkgdir"/etc/dnsmasq.d/01-pihole.conf
|
||||||
|
install -Dm644 lighttpd.pi-hole.conf "$pkgdir"/usr/share/pihole/configs/lighttpd.example.conf
|
||||||
|
install -Dm644 nginx.pi-hole.conf "$pkgdir"/usr/share/pihole/configs/nginx.example.conf
|
||||||
|
|
||||||
|
install -dm755 "$pkgdir"/srv/http/pihole/admin
|
||||||
|
install -Dm644 $_pkgname-$pkgver/advanced/index.php "$pkgdir"/srv/http/pihole/pihole/index.php
|
||||||
|
# install -Dm644 $_pkgname-$pkgver/advanced/index.js "$pkgdir"/srv/http/pihole/pihole/index.js
|
||||||
|
install -Dm644 $_pkgname-$pkgver/advanced/blockingpage.css "$pkgdir"/srv/http/pihole/pihole/blockingpage.css
|
||||||
|
|
||||||
|
cp -dpr --no-preserve=ownership $_wwwpkgname-$_wwwpkgver/* "$pkgdir"/srv/http/pihole/admin/
|
||||||
|
|
||||||
|
install -dm755 "$pkgdir"/usr/share/licenses/pihole
|
||||||
|
install -Dm644 ${pkgname%-*}-$pkgver/LICENSE "$pkgdir"/usr/share/licenses/pihole/Pi-hole
|
||||||
|
install -Dm644 $_wwwpkgname-$_wwwpkgver/LICENSE "$pkgdir"/usr/share/licenses/pihole/AdminLTE
|
||||||
|
install -Dm644 $_wwwpkgname-$_wwwpkgver/style/vendor/SourceSansPro/OFL.txt \
|
||||||
|
"$pkgdir"/usr/share/licenses/pihole/SourceSansPro
|
||||||
|
|
||||||
|
rm "$pkgdir"/srv/http/pihole/admin/*.md
|
||||||
|
rm "$pkgdir"/srv/http/pihole/admin/LICENSE
|
||||||
|
rm "$pkgdir"/srv/http/pihole/admin/style/vendor/LICENSE
|
||||||
|
rm "$pkgdir"/srv/http/pihole/admin/scripts/vendor/LICENSE
|
||||||
|
rm "$pkgdir"/srv/http/pihole/admin/style/vendor/SourceSansPro/OFL.txt
|
||||||
|
}
|
34
src/pi-hole-server/dnsmasq.include
Normal file
34
src/pi-hole-server/dnsmasq.include
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
# Pi-hole: A black hole for Internet advertisements
|
||||||
|
# (c) 2015, 2016 by Jacob Salmela
|
||||||
|
# Network-wide ad blocking via your Raspberry Pi
|
||||||
|
# http://pi-hole.net
|
||||||
|
# dnsmasq config for Pi-hole
|
||||||
|
#
|
||||||
|
# Pi-hole is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# FILE AUTOMATICALLY POPULATED BY PI-HOLE INSTALL/UPDATE PROCEDURE. #
|
||||||
|
# ANY CHANGES MADE TO THIS FILE AFTER INSTALL WILL BE LOST ON THE NEXT UPDATE #
|
||||||
|
# #
|
||||||
|
# IF YOU WISH TO CHANGE THE UPSTREAM SERVERS, CHANGE THEM IN: #
|
||||||
|
# /etc/pihole/setupVars.conf #
|
||||||
|
# #
|
||||||
|
# ANY OTHER CHANGES SHOULD BE MADE IN A SEPERATE CONFIG FILE #
|
||||||
|
# OR IN /etc/dnsmasq.conf #
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
addn-hosts=/etc/pihole/gravity.list
|
||||||
|
addn-hosts=/etc/pihole/local.list
|
||||||
|
addn-hosts=/etc/pihole/black.list
|
||||||
|
domain-needed
|
||||||
|
localise-queries
|
||||||
|
bogus-priv
|
||||||
|
no-resolv
|
||||||
|
cache-size=10000
|
||||||
|
log-queries=extra
|
||||||
|
log-facility=/run/log/pihole/pihole.log
|
||||||
|
local-ttl=300
|
||||||
|
log-async
|
11
src/pi-hole-server/dnsmasq.main
Normal file
11
src/pi-hole-server/dnsmasq.main
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
# If you want dnsmasq to listen for DHCP and DNS requests only on
|
||||||
|
# specified interfaces (and the loopback) give the name of the
|
||||||
|
# interface (eg eth0) here.
|
||||||
|
#interface=eth0
|
||||||
|
# Or which to listen on by address (remember to include 127.0.0.1 if
|
||||||
|
# you use this.)
|
||||||
|
#listen-address=127.0.0.1
|
||||||
|
|
||||||
|
# Include all files in a directory which end in .conf
|
||||||
|
conf-dir=/etc/dnsmasq.d/,*.conf
|
||||||
|
|
89
src/pi-hole-server/lighttpd.pi-hole.conf
Normal file
89
src/pi-hole-server/lighttpd.pi-hole.conf
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
# Pi-hole: A black hole for Internet advertisements
|
||||||
|
# (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
||||||
|
# Network-wide ad blocking via your own hardware.
|
||||||
|
#
|
||||||
|
# Lighttpd config for Pi-hole
|
||||||
|
#
|
||||||
|
# This file is copyright under the latest version of the EUPL.
|
||||||
|
# Please see LICENSE file for your rights under this license.
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# FILE AUTOMATICALLY OVERWRITTEN BY PI-HOLE INSTALL/UPDATE PROCEDURE. #
|
||||||
|
# ANY CHANGES MADE TO THIS FILE AFTER INSTALL WILL BE LOST ON THE NEXT UPDATE #
|
||||||
|
# #
|
||||||
|
# CHANGES SHOULD BE MADE IN A SEPARATE CONFIG FILE: #
|
||||||
|
# /etc/lighttpd/external.conf #
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
server.modules = (
|
||||||
|
"mod_access",
|
||||||
|
"mod_accesslog",
|
||||||
|
"mod_expire",
|
||||||
|
"mod_compress",
|
||||||
|
"mod_redirect",
|
||||||
|
"mod_setenv",
|
||||||
|
"mod_rewrite",
|
||||||
|
"mod_fastcgi"
|
||||||
|
)
|
||||||
|
|
||||||
|
mimetype.assign = (
|
||||||
|
".html" => "text/html",
|
||||||
|
".txt" => "text/plain",
|
||||||
|
".css" => "text/css",
|
||||||
|
".js" => "application/x-javascript",
|
||||||
|
".jpg" => "image/jpeg",
|
||||||
|
".jpeg" => "image/jpeg",
|
||||||
|
".gif" => "image/gif",
|
||||||
|
".png" => "image/png",
|
||||||
|
".svg" => "image/svg+xml", # thanks to nikke
|
||||||
|
"" => "application/octet-stream"
|
||||||
|
)
|
||||||
|
|
||||||
|
fastcgi.server = (
|
||||||
|
".php" => (
|
||||||
|
"localhost" => (
|
||||||
|
"bin-path" => "/usr/bin/php-cgi -d session.save_path=/run/pihole",
|
||||||
|
"socket" => "/tmp/php-fastcgi.sock",
|
||||||
|
"broken-scriptfilename" => "enable",
|
||||||
|
"max-procs" => 4,
|
||||||
|
"bin-environment" => (
|
||||||
|
"PHP_FCGI_CHILDREN" => "1" # default value
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
server.document-root = "/srv/http/pihole"
|
||||||
|
server.error-handler-404 = "/pihole/index.php"
|
||||||
|
server.username = "http"
|
||||||
|
server.groupname = "http"
|
||||||
|
server.port = 80
|
||||||
|
|
||||||
|
index-file.names = ( "index.php", "index.html", "index.lighttpd.html" )
|
||||||
|
url.access-deny = ( "~", ".inc", ".md", ".yml", ".ini" )
|
||||||
|
static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )
|
||||||
|
|
||||||
|
compress.cache-dir = "/var/cache/lighttpd/compress/"
|
||||||
|
compress.filetype = ( "application/javascript", "text/css", "text/html", "text/plain" )
|
||||||
|
|
||||||
|
# If the URL starts with /admin, it is the Web interface
|
||||||
|
$HTTP["url"] =~ "^/admin/" {
|
||||||
|
# Create a response header for debugging using curl -I
|
||||||
|
setenv.add-response-header = (
|
||||||
|
"X-Pi-hole" => "The Pi-hole Web interface is working!",
|
||||||
|
"X-Frame-Options" => "DENY"
|
||||||
|
)
|
||||||
|
|
||||||
|
$HTTP["url"] =~ ".ttf$" {
|
||||||
|
# Allow Block Page access to local fonts
|
||||||
|
setenv.add-response-header = ( "Access-Control-Allow-Origin" => "*" )
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Block . files from being served, such as .git, .github, .gitignore
|
||||||
|
$HTTP["url"] =~ "^/admin/\.(.*)" {
|
||||||
|
url.access-deny = ("")
|
||||||
|
}
|
||||||
|
|
||||||
|
# Add user chosen options held in external file
|
||||||
|
include_shell "cat external.conf 2>/dev/null"
|
61
src/pi-hole-server/mimic_setupVars.conf.sh
Executable file
61
src/pi-hole-server/mimic_setupVars.conf.sh
Executable file
@ -0,0 +1,61 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
setupVars=/etc/pihole/setupVars.conf
|
||||||
|
|
||||||
|
# official pihole basic-install.sh code here
|
||||||
|
getIPv4stuff()
|
||||||
|
{
|
||||||
|
IPV4DEV=$(ip route get 8.8.8.8 | awk '{for(i=1;i<=NF;i++)if($i~/dev/)print $(i+1)}')
|
||||||
|
IPV4_ADDRESS=$(ip -o -f inet addr show dev "$IPV4DEV" | awk '{print $4}' | awk 'END {print}')
|
||||||
|
}
|
||||||
|
|
||||||
|
# official pihole basic-install.sh code here
|
||||||
|
testIPv6() {
|
||||||
|
first="$(cut -f1 -d":" <<< "$1")"
|
||||||
|
value1=$(((0x$first)/256))
|
||||||
|
value2=$(((0x$first)%256))
|
||||||
|
((($value1&254)==252)) && echo "ULA" || true
|
||||||
|
((($value1&112)==32)) && echo "GUA" || true
|
||||||
|
((($value1==254) && (($value2&192)==128))) && echo "Link-local" || true
|
||||||
|
}
|
||||||
|
|
||||||
|
# official pihole basic-install.sh code here
|
||||||
|
getIPv6stuff()
|
||||||
|
{
|
||||||
|
if [ -e /proc/net/if_inet6 ]; then
|
||||||
|
IPV6_ADDRESSES=($(ip -6 address | grep 'scope global' | awk '{print $2}'))
|
||||||
|
|
||||||
|
# Determine type of found IPv6 addresses
|
||||||
|
for i in "${IPV6_ADDRESSES[@]}"; do
|
||||||
|
result=$(testIPv6 "$i")
|
||||||
|
[[ "${result}" == "ULA" ]] && ULA_ADDRESS="${i%/*}"
|
||||||
|
[[ "${result}" == "GUA" ]] && GUA_ADDRESS="${i%/*}"
|
||||||
|
done
|
||||||
|
|
||||||
|
# Determine which address to be used: Prefer ULA over GUA or don't use any if none found
|
||||||
|
if [[ ! -z "${ULA_ADDRESS}" ]]; then
|
||||||
|
IPV6_ADDRESS="${ULA_ADDRESS}"
|
||||||
|
elif [[ ! -z "${GUA_ADDRESS}" ]]; then
|
||||||
|
IPV6_ADDRESS="${GUA_ADDRESS}"
|
||||||
|
else
|
||||||
|
IPV6_ADDRESS=""
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# from official pihole basic-install.sh, almost
|
||||||
|
finalExports() {
|
||||||
|
#If it already exists, lets overwrite it with the new values.
|
||||||
|
if [[ -f ${setupVars} ]];then
|
||||||
|
rm ${setupVars}
|
||||||
|
fi
|
||||||
|
{
|
||||||
|
echo "PIHOLE_INTERFACE=${IPV4DEV}"
|
||||||
|
echo "IPV4_ADDRESS=${IPV4_ADDRESS}"
|
||||||
|
echo "IPV6_ADDRESS=${IPV6_ADDRESS}"
|
||||||
|
}>> "${setupVars}"
|
||||||
|
}
|
||||||
|
|
||||||
|
getIPv4stuff
|
||||||
|
getIPv6stuff
|
||||||
|
finalExports
|
52
src/pi-hole-server/nginx.pi-hole.conf
Normal file
52
src/pi-hole-server/nginx.pi-hole.conf
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
#
|
||||||
|
# /etc/nginx/conf.d/pihole.conf
|
||||||
|
#
|
||||||
|
# https://github.com/pi-hole/pi-hole/wiki/Nginx-Configuration
|
||||||
|
#
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 80 default_server;
|
||||||
|
listen [::]:80 default_server;
|
||||||
|
|
||||||
|
root /srv/http/pihole;
|
||||||
|
server_name _;
|
||||||
|
autoindex off;
|
||||||
|
|
||||||
|
proxy_intercept_errors on;
|
||||||
|
error_page 404 /pihole/index.php;
|
||||||
|
|
||||||
|
index pihole/index.php index.php index.html index.htm;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
expires max;
|
||||||
|
try_files $uri $uri/ =404;
|
||||||
|
add_header X-Pi-hole "A black hole for Internet advertisements";
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ \.php$ {
|
||||||
|
include fastcgi.conf;
|
||||||
|
fastcgi_intercept_errors on;
|
||||||
|
fastcgi_pass 127.0.0.1:9000;
|
||||||
|
fastcgi_param SERVER_NAME $host;
|
||||||
|
}
|
||||||
|
|
||||||
|
location /admin {
|
||||||
|
root /srv/http/pihole;
|
||||||
|
index index.php index.html index.htm;
|
||||||
|
add_header X-Pi-hole "The Pi-hole Web interface is working!";
|
||||||
|
add_header X-Frame-Options "DENY";
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ /\.ttf {
|
||||||
|
add_header Access-Control-Allow-Origin "*";
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ /admin/\. {
|
||||||
|
deny all;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ /\.ht {
|
||||||
|
deny all;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
9
src/pi-hole-server/pi-hole-gravity.service
Normal file
9
src/pi-hole-server/pi-hole-gravity.service
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Ad-serving domains collector
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
ExecStart=/usr/bin/pihole updateGravity
|
||||||
|
Nice=19
|
||||||
|
IOSchedulingClass=best-effort
|
||||||
|
IOSchedulingPriority=7
|
7
src/pi-hole-server/pi-hole-gravity.timer
Normal file
7
src/pi-hole-server/pi-hole-gravity.timer
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Weekly ad-serving domains gathering
|
||||||
|
|
||||||
|
[Timer]
|
||||||
|
OnCalendar=weekly
|
||||||
|
AccuracySec=3h
|
||||||
|
Persistent=true
|
9
src/pi-hole-server/pi-hole-logtruncate.service
Normal file
9
src/pi-hole-server/pi-hole-logtruncate.service
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Reset dnsmasq/pi-hole query log
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
ExecStart=/usr/bin/pihole flush once quiet
|
||||||
|
Nice=19
|
||||||
|
IOSchedulingClass=best-effort
|
||||||
|
IOSchedulingPriority=7
|
7
src/pi-hole-server/pi-hole-logtruncate.timer
Normal file
7
src/pi-hole-server/pi-hole-logtruncate.timer
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Daily reset of dnsmasq/pi-hole query log
|
||||||
|
|
||||||
|
[Timer]
|
||||||
|
OnCalendar=daily
|
||||||
|
AccuracySec=5m
|
||||||
|
Persistent=true
|
38
src/pi-hole-server/pi-hole-server.install
Normal file
38
src/pi-hole-server/pi-hole-server.install
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
warning() {
|
||||||
|
echo -e "\e[1;33m==>\e[0m Ver. 3.2: \e[1;31mWeb servers configurations are changed.\e[0m Please follow WIKI instructions.\e[0m"
|
||||||
|
}
|
||||||
|
|
||||||
|
post_install() {
|
||||||
|
echo -e "\e[1;33m==>\e[0m Read setup instructions at \e[1;36mhttps://wiki.archlinux.org/index.php/Pi-hole\e[0m"
|
||||||
|
echo -e "\e[1;33m==>\e[0m Generating initial block list, please wait...\e[0m"
|
||||||
|
chown -R http:http /srv/http/pihole
|
||||||
|
chown pihole:pihole /etc/pihole
|
||||||
|
/opt/pihole/mimic_setupVars.conf.sh
|
||||||
|
|
||||||
|
# update lists on first run
|
||||||
|
pihole -g > /dev/null
|
||||||
|
|
||||||
|
# setup dns server which by definition modifies /etc/dnsmasq.d/01-pihole.conf
|
||||||
|
# and thus protects it from getting overwritten by package updates
|
||||||
|
/usr/bin/pihole -a setdns 8.8.8.8,8.8.4.4 > /dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
post_upgrade() {
|
||||||
|
# clean old/unused/deprecated files
|
||||||
|
[ -e /etc/pihole/hosts ] && rm /etc/pihole/hosts
|
||||||
|
[ -e /etc/pihole/.useIPv6 ] && rm /etc/pihole/.useIPv6
|
||||||
|
|
||||||
|
# update owner of existing dir
|
||||||
|
chown pihole:pihole /etc/pihole
|
||||||
|
|
||||||
|
# warning
|
||||||
|
|
||||||
|
# keep pacman from throwing errors should none them be on the filesystem
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
post_remove() {
|
||||||
|
# delete all temp files except those modified the user
|
||||||
|
# TODO - make this more intelligent to save *.pacsave.# where # is a number
|
||||||
|
find /etc/pihole -type f ! -name '*.pacsave' ! -name 'pihole-FTL.conf' ! -name 'pihole-FTL.db' -delete
|
||||||
|
}
|
3
src/pi-hole-server/pi-hole.tmpfile
Normal file
3
src/pi-hole-server/pi-hole.tmpfile
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
d /run/pihole 0755 http root - -
|
||||||
|
d /run/log/pihole 0755 dnsmasq root - -
|
||||||
|
f /run/log/pihole/pihole.log 0644 dnsmasq root - -
|
4
src/pi-hole-server/piholeDebug.sh
Normal file
4
src/pi-hole-server/piholeDebug.sh
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
#!/usr/bin/sh
|
||||||
|
echo -e "Pi-hole debug options are \e[1;31mdisabled\e[0m.\n"
|
||||||
|
echo -e "ArchLinux distribution of Pi-hole is not supported by official project and this debug report CAN NOT be uploaded to their debug team."
|
||||||
|
echo -e "Follow instructions carefully on the project wiki page (\e[1;36mhttps://wiki.archlinux.org/index.php/Pi-hole\e[0m) and please refer to AUR package web page for support and debugging (\e[1;36mhttps://aur.archlinux.org/packages/pi-hole-server\e[0m).\n"
|
72
src/pi-hole-server/version.patch
Normal file
72
src/pi-hole-server/version.patch
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
diff -ur pi-hole-3.1/advanced/Scripts/version.sh pi-hole-3.1.a/advanced/Scripts/version.sh
|
||||||
|
--- pi-hole-3.1/advanced/Scripts/version.sh 2017-06-20 23:17:41.000000000 +0200
|
||||||
|
+++ pi-hole-3.1.a/advanced/Scripts/version.sh 2017-06-22 13:52:36.293206505 +0200
|
||||||
|
@@ -20,63 +20,21 @@
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
- # Get the tagged version of the local repository
|
||||||
|
- local directory="${1}"
|
||||||
|
- local version
|
||||||
|
-
|
||||||
|
- cd "${directory}" 2> /dev/null || { echo "${DEFAULT}"; return 1; }
|
||||||
|
- version=$(git describe --tags --always || echo "$DEFAULT")
|
||||||
|
- if [[ "${version}" =~ ^v ]]; then
|
||||||
|
- echo "${version}"
|
||||||
|
- elif [[ "${version}" == "${DEFAULT}" ]]; then
|
||||||
|
- echo "ERROR"
|
||||||
|
- return 1
|
||||||
|
+ if [[ "$1" == "pi-hole" ]]; then
|
||||||
|
+ echo "{{corever}}"
|
||||||
|
else
|
||||||
|
- echo "Untagged"
|
||||||
|
+ echo "{{webver}}"
|
||||||
|
fi
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
getLocalHash() {
|
||||||
|
- # Local FTL hash does not exist on filesystem
|
||||||
|
- if [[ "$1" == "FTL" ]]; then
|
||||||
|
- echo "N/A"
|
||||||
|
- return 0
|
||||||
|
- fi
|
||||||
|
-
|
||||||
|
- # Get the short hash of the local repository
|
||||||
|
- local directory="${1}"
|
||||||
|
- local hash
|
||||||
|
-
|
||||||
|
- cd "${directory}" 2> /dev/null || { echo "${DEFAULT}"; return 1; }
|
||||||
|
- hash=$(git rev-parse --short HEAD || echo "$DEFAULT")
|
||||||
|
- if [[ "${hash}" == "${DEFAULT}" ]]; then
|
||||||
|
- echo "ERROR"
|
||||||
|
- return 1
|
||||||
|
- else
|
||||||
|
- echo "${hash}"
|
||||||
|
- fi
|
||||||
|
+ echo "N/A"
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
getRemoteHash(){
|
||||||
|
- # Remote FTL hash is not applicable
|
||||||
|
- if [[ "$1" == "FTL" ]]; then
|
||||||
|
- echo "N/A"
|
||||||
|
- return 0
|
||||||
|
- fi
|
||||||
|
-
|
||||||
|
- local daemon="${1}"
|
||||||
|
- local branch="${2}"
|
||||||
|
-
|
||||||
|
- hash=$(git ls-remote --heads "https://github.com/pi-hole/${daemon}" | \
|
||||||
|
- awk -v bra="$branch" '$0~bra {print substr($0,0,8);exit}')
|
||||||
|
- if [[ -n "$hash" ]]; then
|
||||||
|
- echo "$hash"
|
||||||
|
- else
|
||||||
|
- echo "ERROR"
|
||||||
|
- return 1
|
||||||
|
- fi
|
||||||
|
+ echo "N/A"
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user