From 0c81b88f98fdfb60e570c818391544d3dc968280 Mon Sep 17 00:00:00 2001 From: Fredrik Lindqvist Date: Tue, 23 Oct 2018 21:28:42 +0200 Subject: [PATCH 1/2] Adds pihole install script --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index bb2eae99..300cdfe1 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # Hassbian-scripts -These are the scripts used in the [Hassbian][hassbian] image. +These are the scripts used in the [Hassbian][hassbian] image. The scripts in this repository where made to be used with the Hassbian image -and the included Home Assistant instance. +and the included Home Assistant instance. ## The included scripts @@ -23,6 +23,7 @@ below for usage and instructions. - [MariaDB](/docs/mariadb.md) - [Monitor](/docs/monitor.md) - [Mosquitto](/docs/mosquitto.md) + - [Pi-hole](/docs/pihole.md) - [PostgreSQL](/docs/postgresql.md) - [MS SQL](/docs/mssql.md) - [RaZberry](/docs/razberry.md) From 7d8d8dc7af76fd646ff6808a8a6475b49f89787e Mon Sep 17 00:00:00 2001 From: Fredrik Lindqvist Date: Tue, 23 Oct 2018 21:29:02 +0200 Subject: [PATCH 2/2] Adds pihole install script --- docs/pihole.md | 30 +++++++++++++++++ package/opt/hassbian/suites/pihole.sh | 46 +++++++++++++++++++++++++++ 2 files changed, 76 insertions(+) create mode 100644 docs/pihole.md create mode 100644 package/opt/hassbian/suites/pihole.sh diff --git a/docs/pihole.md b/docs/pihole.md new file mode 100644 index 00000000..507fbbab --- /dev/null +++ b/docs/pihole.md @@ -0,0 +1,30 @@ +# Monitor + +This script downloads and runs the [Pi-Hole][pihole] install script from https://pi-hole.net/ . +## Installation + +```bash +sudo hassbian-config install pihole +``` + +## Upgrade + +Upgrades are handled by the Pi-hole software + +## Additional info + +Description | Command/value +:--- | :--- +Running as: | pihole +Start service: | `sudo systemctl start pihole-FTL.service ` +Stop service: | `sudo systemctl stop pihole-FTL.service` +Restart service: | `sudo systemctl restart pihole-FTL.service` +Service status: | `sudo systemctl status pihole-FTL.service` + +*** + +This install script was originally contributed by [@Landrash][landrash] + + +[landrash]: https://github.com/landrash +[pihole]: https://pi-hole.net/ diff --git a/package/opt/hassbian/suites/pihole.sh b/package/opt/hassbian/suites/pihole.sh new file mode 100644 index 00000000..e5e9adb9 --- /dev/null +++ b/package/opt/hassbian/suites/pihole.sh @@ -0,0 +1,46 @@ +#!/bin/bash +function pihole-show-short-info { + echo "Downloads and runs the Pi-hole install script." +} + +function pihole-show-long-info { + echo "This script downloads and runs the Pi-hole install script" + echo "All credit for the install script goes to the Pi-hole authors." +} + +function pihole-show-copyright-info { + echo "Original concept by Landrash ." +} + +function pihole-install-package { +echo -n "Downloading Pi-hole install script: " +mkdir /tmp/pihole || exit +cd /tmp/pihole || exit +wget -O basic-install.sh https://install.pi-hole.net + +echo "Running interactive setup" +cd /tmp/pihole || exit +chmod +x /tmp/pihole/basic-install.sh || exit +bash /tmp/pihole/basic-install.sh + +echo "Checking the installation..." +ip_address=$(ifconfig | grep "inet.*broadcast" | grep -v 0.0.0.0 | awk '{print $2}') + +echo "Checking the installation..." +validation=$(pgrep -f pihole) +if [ ! -z "${validation}" ]; then + echo + echo -e "\\e[32mInstallation done.\\e[0m" + echo + echo "Your Pi-Hole instance is running at $ip_address or if preferred hassbian.local" + echo + else + echo + echo -e "\\e[31mInstallation failed..." + echo + return 1 +fi +return 0 +} + +[[ "$_" == "$0" ]] && echo "hassbian-config helper script; do not run directly, use hassbian-config instead"