From dbf8c79270a82a24b0f82b8aeae051b4261f0f50 Mon Sep 17 00:00:00 2001
From: jgstroud <accounts@bsclimbing.com>
Date: Sat, 3 Jul 2021 00:33:55 -0500
Subject: [PATCH] Add Pihole upgrade script (#190)

* Add a script to update your pihole container

* Add instructions for upgrading your pihole container

Co-authored-by: Jon Stroud <jon.stroud@keysight.com>
---
 run-pihole/README.md     |  7 ++++++-
 run-pihole/upd_pihole.sh | 17 +++++++++++++++++
 2 files changed, 23 insertions(+), 1 deletion(-)
 create mode 100755 run-pihole/upd_pihole.sh

diff --git a/run-pihole/README.md b/run-pihole/README.md
index 581e9b7..baf45a1 100644
--- a/run-pihole/README.md
+++ b/run-pihole/README.md
@@ -75,6 +75,11 @@
 1. Update your DNS Servers to 10.0.5.3 (or your custom ip) for each of your Networks (UDM GUI | Networks | Advanced | DHCP Name Server)
 1. Access the pihole like you would normally, e.g. http://10.0.5.3 if using examples above
 
+## Upgrading your PiHole container
+1. Edit upd_pihole.sh script to use the same `podman run` command you used at installation. 
+2. Copy the upd_pihole.sh script to /mnt/data/scripts
+3. Anytime you want to update your pihole installation, simply run `/mnt/data/scripts/upd_pihole.sh`
+
 ## PiHole with CloudFlareD Command
     ```sh
      podman run -d --network dns --restart always \
@@ -92,4 +97,4 @@
         -e PIHOLE_DNS_="127.0.0.1#5053" \
         -e IPv6="False" \
         boostchicken/pihole:latest
-    ```
\ No newline at end of file
+    ```
diff --git a/run-pihole/upd_pihole.sh b/run-pihole/upd_pihole.sh
new file mode 100755
index 0000000..ee1daba
--- /dev/null
+++ b/run-pihole/upd_pihole.sh
@@ -0,0 +1,17 @@
+podman pull pihole/pihole:latest
+podman stop pihole
+podman rm pihole
+podman run -d --network dns --restart always \
+    --name pihole \
+    -e TZ="America/Chicago" \
+    -v "/mnt/data/etc-pihole/:/etc/pihole/" \
+    -v "/mnt/data/pihole/etc-dnsmasq.d/:/etc/dnsmasq.d/" \
+    --dns=127.0.0.1 \
+    --dns=1.1.1.1 \
+    --dns=1.0.0.1 \
+    --hostname pi.hole \
+    -e VIRTUAL_HOST="pi.hole" \
+    -e PROXY_LOCATION="pi.hole" \
+    -e ServerIP="10.0.5.3" \
+    -e IPv6="False" \
+    pihole/pihole:latest