diff options
author | dennis <dennis@mrslave> | 2019-10-23 20:52:46 +0200 |
---|---|---|
committer | dennis <dennis@mrslave> | 2019-10-23 20:52:46 +0200 |
commit | 1ed250752c69271c79c770c1874c4c54fb5230be (patch) | |
tree | 3c880a0ef5b3564e072fbb7be12b32fc3ceef1e9 | |
download | mkosi-pihole-1ed250752c69271c79c770c1874c4c54fb5230be.tar.gz |
initial commit
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | mkosi.default | 19 | ||||
-rw-r--r-- | mkosi.nspawn | 15 | ||||
-rwxr-xr-x | mkosi.postinst | 33 | ||||
-rw-r--r-- | mkosi.skeleton/etc/apt/apt.conf.d/20auto-upgrades | 6 | ||||
-rw-r--r-- | mkosi.skeleton/etc/apt/apt.conf.d/50unattended-upgrades | 33 | ||||
-rw-r--r-- | mkosi.skeleton/etc/docker-pi-hole-version | 1 | ||||
l--------- | mkosi.skeleton/etc/systemd/network/80-container-host0.network | 1 | ||||
-rw-r--r-- | mkosi.skeleton/etc/systemd/network/wired.network | 14 |
9 files changed, 124 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3dff6a2 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +# mkosi cache +mkosi.cache/* diff --git a/mkosi.default b/mkosi.default new file mode 100644 index 0000000..46c35ed --- /dev/null +++ b/mkosi.default @@ -0,0 +1,19 @@ +[Distribution] +Distribution=ubuntu +Release=bionic +Repositories=main,universe +Mirror=http://no.archive.ubuntu.com + +[Output] +Format=directory +Output=/var/lib/machines/pihole + +[Packages] +WithNetwork=yes +Packages= + unattended-upgrades + ca-certificates + wget + iproute2 + vim + iputils-ping diff --git a/mkosi.nspawn b/mkosi.nspawn new file mode 100644 index 0000000..bc9dca7 --- /dev/null +++ b/mkosi.nspawn @@ -0,0 +1,15 @@ +[Exec] +Hostname=pihole +ResolvConf=copy-host +Timezone=copy +PrivateUsers=yes +NoNewPrivilegs=yes + +[Files] +PrivateUsersChown=yes +Bind=/var/local/pihole/etc-pihole:/etc/pihole +Bind=/var/local/pihole/etc-dnsmasq.d:/etc/dnsmasq.d +Bind=/var/local/pihole/pihole.log:/var/log/pihole.log + +[Network] +Bridge=br0 diff --git a/mkosi.postinst b/mkosi.postinst new file mode 100755 index 0000000..73da326 --- /dev/null +++ b/mkosi.postinst @@ -0,0 +1,33 @@ +#!/bin/sh +set -ex +export DEBIAN_FRONTEND=noninteractive + +# network +systemctl enable systemd-networkd + +export VERSION='v4.3.2' + +echo "$VERSION" > /etc/docker-pi-hole-version + +cd /root + +wget "https://raw.githubusercontent.com/pi-hole/docker-pi-hole/master/install.sh" + +export PIHOLE_INSTALL="ph_install.sh" +export S6OVERLAY_RELEASE="https://github.com/just-containers/s6-overlay/releases/download/v1.21.7.0/s6-overlay-amd64.tar.gz" + +bash -ex ./install.sh 2>&1 + + +sed -i 's/^PIHOLE_INTERFACE.*/PIHOLE_INTERFACE\=host0/' /etc/pihole/setupVars.conf +sed -i '/^PIHOLE_DNS/d' /etc/pihole/setupVars.conf +echo "PIHOLE_DNS_1=130.67.15.198" >> /etc/pihole/setupVars.conf +echo "PIHOLE_DNS_2=193.213.112.4" >> /etc/pihole/setupVars.conf + +sed -i 's/^interface.*/interface\=host0/' /etc/dnsmasq.d/01-pihole.conf +sed -i 's/server\=8\.8\.8\.8/server\=130\.67\.15\.198/' /etc/dnsmasq.d/01-pihole.conf +sed -i 's/server\=8\.8\.4\.4/server\=193\.213\.112\.4/' /etc/dnsmasq.d/01-pihole.conf + +sed -i '/.*ipv6.*/d' /etc/lighttpd/lighttpd.conf +echo 'server.bind = "10.71.2.2"' > /etc/lighttpd/external.conf + diff --git a/mkosi.skeleton/etc/apt/apt.conf.d/20auto-upgrades b/mkosi.skeleton/etc/apt/apt.conf.d/20auto-upgrades new file mode 100644 index 0000000..8504436 --- /dev/null +++ b/mkosi.skeleton/etc/apt/apt.conf.d/20auto-upgrades @@ -0,0 +1,6 @@ +APT::Periodic::Unattended-Upgrade "1"; + +APT::Periodic::Update-Package-Lists "1"; + + +APT::Periodic::AutocleanInterval "7"; diff --git a/mkosi.skeleton/etc/apt/apt.conf.d/50unattended-upgrades b/mkosi.skeleton/etc/apt/apt.conf.d/50unattended-upgrades new file mode 100644 index 0000000..f996348 --- /dev/null +++ b/mkosi.skeleton/etc/apt/apt.conf.d/50unattended-upgrades @@ -0,0 +1,33 @@ +// Unattended-Upgrade::Origins-Pattern controls which packages are +// upgraded. +Unattended-Upgrade::Origins-Pattern { + "origin=Ubuntu,archive=${distro_codename}-security"; + "o=Ubuntu,a=${distro_codename}"; + "o=Ubuntu,a=${distro_codename}-updates"; + "o=Ubuntu,a=${distro_codename}-proposed-updates"; + "o=Ubuntu,n=${distro_codename}-backports"; + }; + +// List of packages to not update (regexp are supported) +Unattended-Upgrade::Package-Blacklist { +}; + + +// Split the upgrade into the smallest possible chunks so that +// they can be interrupted with SIGUSR1. This makes the upgrade +// a bit slower but it has the benefit that shutdown while a upgrade +// is running is possible (with a small delay) +Unattended-Upgrade::MinimalSteps "true"; + + +// Do automatic removal of new unused dependencies after the upgrade +// (equivalent to apt-get autoremove) +Unattended-Upgrade::Remove-Unused-Dependencies "true"; + + +// Do upgrade application even if it requires restart after upgrade +// I.e. "XB-Upgrade-Requires: app-restart" is set in the debian/control file +Unattended-Upgrade::IgnoreAppsRequireRestart "true"; + +// Automatically run "dpkg --force-confold --configure -a". +Unattended-Upgrade::AutoFixInterruptedDpkg "true"; diff --git a/mkosi.skeleton/etc/docker-pi-hole-version b/mkosi.skeleton/etc/docker-pi-hole-version new file mode 100644 index 0000000..db6ecdd --- /dev/null +++ b/mkosi.skeleton/etc/docker-pi-hole-version @@ -0,0 +1 @@ +v4.3.2 diff --git a/mkosi.skeleton/etc/systemd/network/80-container-host0.network b/mkosi.skeleton/etc/systemd/network/80-container-host0.network new file mode 120000 index 0000000..dc1dc0c --- /dev/null +++ b/mkosi.skeleton/etc/systemd/network/80-container-host0.network @@ -0,0 +1 @@ +/dev/null
\ No newline at end of file diff --git a/mkosi.skeleton/etc/systemd/network/wired.network b/mkosi.skeleton/etc/systemd/network/wired.network new file mode 100644 index 0000000..7e97f43 --- /dev/null +++ b/mkosi.skeleton/etc/systemd/network/wired.network @@ -0,0 +1,14 @@ +[Match] +Name=host0 + +[Network] +DNS=127.0.0.1 +Domains=dnns.no +Address=192.168.1.250 +Gateway=192.168.1.1 +Address=10.71.2.2/24 + +[Route] +Gateway=10.71.2.1 +Destination=10.71.2.0/24 +GatewayOnlink=true |