mirror of
https://github.com/moparisthebest/arch-ppa
synced 2024-11-24 01:22:18 -05:00
Add pi-hole-standalone
This commit is contained in:
parent
48a001dcf3
commit
69158cfae7
70
src/pi-hole-standalone/PKGBUILD
Normal file
70
src/pi-hole-standalone/PKGBUILD
Normal file
@ -0,0 +1,70 @@
|
||||
# Maintainer: max.bra <max dot bra dot gtalk at gmail dot com>
|
||||
|
||||
pkgname=pi-hole-standalone
|
||||
_pkgname=pi-hole
|
||||
pkgver=4.2.2
|
||||
pkgrel=2
|
||||
pkgdesc='The Pi-hole is an advertising-aware DNS/Web server. Arch alteration for standalone PC.'
|
||||
arch=('any')
|
||||
license=('EUPL-1.1')
|
||||
url="https://github.com/pi-hole/pi-hole"
|
||||
depends=('dnsmasq' 'net-tools' 'iproute2' 'bind-tools')
|
||||
conflicts=('pi-hole-server')
|
||||
install=$pkgname.install
|
||||
backup=('etc/pihole/whitelist.txt' 'etc/pihole/blacklist.txt'
|
||||
'etc/dnsmasq.d/01-pihole.conf')
|
||||
|
||||
source=(https://github.com/$_pkgname/$_pkgname/archive/v$pkgver.tar.gz
|
||||
"https://raw.githubusercontent.com/max72bra/pi-hole-standalone-archlinux-customization/master/arch-server-core-$pkgver.patch"
|
||||
dnsmasq.main
|
||||
dnsmasq.include
|
||||
$_pkgname-gravity.service
|
||||
$_pkgname-gravity.timer
|
||||
mimic_setupVars.conf.sh
|
||||
piholeDebug.sh)
|
||||
|
||||
md5sums=('deebe32fd4867b289687689e0f377d72'
|
||||
'6c24887dccda882c5779ff577e2e4db7'
|
||||
'91a3f21bb0a7d429cce2b8d7551e99da'
|
||||
'50d29442a7b185f0d05bc2ed72f875be'
|
||||
'047f13d4ac97877f724f87b002aaee63'
|
||||
'd42a864f88299998f8233c0bc0dd093d'
|
||||
'7821b6dfe380955073701e5acd1587a2'
|
||||
'd7b69ae51db0e8ac8e27f20a234eed85')
|
||||
|
||||
prepare() {
|
||||
cd "$srcdir"/"$_pkgname"-"$pkgver"
|
||||
patch -Np1 -i "$srcdir"/arch-server-core-$pkgver.patch
|
||||
}
|
||||
|
||||
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/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 $_pkgname-$pkgver/advanced/Scripts/wildcard_regex_converter.sh "$pkgdir"/opt/pihole/wildcard_regex_converter.sh
|
||||
install -Dm755 $_pkgname-$pkgver/advanced/Scripts/query.sh "$pkgdir"/opt/pihole/query.sh
|
||||
|
||||
install -Dm755 piholeDebug.sh "$pkgdir"/opt/pihole/piholeDebug.sh
|
||||
install -Dm755 mimic_setupVars.conf.sh "$pkgdir"/opt/pihole/mimic_setupVars.conf.sh
|
||||
|
||||
install -dm755 "$pkgdir/usr/lib/systemd/system/multi-user.target.wants"
|
||||
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
|
||||
ln -s ../$_pkgname-gravity.timer "$pkgdir/usr/lib/systemd/system/multi-user.target.wants/$_pkgname-gravity.timer"
|
||||
|
||||
install -dm755 "$pkgdir"/etc/pihole
|
||||
install -dm755 "$pkgdir"/usr/share/pihole/configs
|
||||
install -Dm644 $_pkgname-$pkgver/adlists.list "$pkgdir"/etc/pihole/adlists.list
|
||||
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 -dm755 "$pkgdir"/usr/share/licenses/pihole
|
||||
install -Dm644 ${pkgname%-*}-$pkgver/LICENSE "$pkgdir"/usr/share/licenses/pihole/Pi-hole
|
||||
}
|
||||
|
34
src/pi-hole-standalone/dnsmasq.include
Normal file
34
src/pi-hole-standalone/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
|
||||
# If a DHCP client claims that its name is "wpad", ignore that.
|
||||
# This fixes a security hole. see CERT Vulnerability VU#598349
|
||||
dhcp-name-match=set:wpad-ignore,wpad
|
||||
dhcp-ignore-names=tag:wpad-ignore
|
10
src/pi-hole-standalone/dnsmasq.main
Normal file
10
src/pi-hole-standalone/dnsmasq.main
Normal file
@ -0,0 +1,10 @@
|
||||
# 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
|
37
src/pi-hole-standalone/mimic_setupVars.conf.sh
Normal file
37
src/pi-hole-standalone/mimic_setupVars.conf.sh
Normal file
@ -0,0 +1,37 @@
|
||||
#!/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)}')
|
||||
# change local ip to unusable 0.0.0.0 (ref. http://dlaa.me/blog/post/skyhole), and :: for ipv6
|
||||
IPV4_ADDRESS="0.0.0.0"
|
||||
}
|
||||
|
||||
# official pihole basic-install.sh code here
|
||||
getIPv6stuff()
|
||||
{
|
||||
if [ -e /proc/net/if_inet6 ]; then
|
||||
# change local ip to unusable 0.0.0.0 (ref. http://dlaa.me/blog/post/skyhole), and :: for ipv6
|
||||
IPV6_ADDRESS="::"
|
||||
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
|
9
src/pi-hole-standalone/pi-hole-gravity.service
Normal file
9
src/pi-hole-standalone/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-standalone/pi-hole-gravity.timer
Normal file
7
src/pi-hole-standalone/pi-hole-gravity.timer
Normal file
@ -0,0 +1,7 @@
|
||||
[Unit]
|
||||
Description=Weekly ad-serving domains gathering
|
||||
|
||||
[Timer]
|
||||
OnCalendar=weekly
|
||||
AccuracySec=3h
|
||||
Persistent=true
|
34
src/pi-hole-standalone/pi-hole-standalone.install
Normal file
34
src/pi-hole-standalone/pi-hole-standalone.install
Normal file
@ -0,0 +1,34 @@
|
||||
warning() {
|
||||
/usr/bin/true
|
||||
}
|
||||
|
||||
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"
|
||||
|
||||
/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
|
||||
|
||||
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' -delete
|
||||
}
|
4
src/pi-hole-standalone/piholeDebug.sh
Normal file
4
src/pi-hole-standalone/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"
|
Loading…
Reference in New Issue
Block a user