From 18c24d985f6cf1e7acf7b4b935556a704d6357be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6nig?= Date: Thu, 23 Jul 2020 20:43:12 +0200 Subject: [PATCH 1/5] Create custom.list during install/update if it doesn't exist MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Christian König --- automated install/basic-install.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 5aa20187..2887fe56 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -70,6 +70,7 @@ PI_HOLE_BLOCKPAGE_DIR="${webroot}/pihole" useUpdateVars=false adlistFile="/etc/pihole/adlists.list" +="${PI_HOLE_CONFIG_DIR}/custom.list" # Pi-hole needs an IP address; to begin, these variables are empty since we don't know what the IP is until # this script can run IPV4_ADDRESS=${IPV4_ADDRESS} @@ -1810,6 +1811,16 @@ installPiholeWeb() { printf "%b %b %s\\n" "${OVER}" "${TICK}" "${str}" } +# Creates custom DNS file if it does not exist +installCustomDNSfile() { + + if [[ ! -e "${customDNSfile}" ]]; then + touch "${customDNSfile}" + chmod 644 "${customDNSfile}" + fi + +} + # Installs a cron file installCron() { # Install the cron job @@ -2037,6 +2048,9 @@ installPihole() { # install a man page entry for pihole install_manpage + # install custom DNS file if it does not exist + installCustomDNSfile + # Update setupvars.conf with any variables that may or may not have been changed during the install finalExports } From 331502e14cc31972f4653b9741b931be7569031a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6nig?= Date: Thu, 23 Jul 2020 20:52:21 +0200 Subject: [PATCH 2/5] Add variable that got lost MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Christian König --- automated install/basic-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 2887fe56..b682fa33 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -70,7 +70,7 @@ PI_HOLE_BLOCKPAGE_DIR="${webroot}/pihole" useUpdateVars=false adlistFile="/etc/pihole/adlists.list" -="${PI_HOLE_CONFIG_DIR}/custom.list" +customDNSfile="${PI_HOLE_CONFIG_DIR}/custom.list" # Pi-hole needs an IP address; to begin, these variables are empty since we don't know what the IP is until # this script can run IPV4_ADDRESS=${IPV4_ADDRESS} From ec9f490fcc0c31a559d3d523dd22796cb31a94e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6nig?= Date: Fri, 24 Jul 2020 20:32:32 +0200 Subject: [PATCH 3/5] Remove separate install function, move to installConfigs(), use pihole syntax MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Christian König --- automated install/basic-install.sh | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index b682fa33..fc90154a 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -70,7 +70,6 @@ PI_HOLE_BLOCKPAGE_DIR="${webroot}/pihole" useUpdateVars=false adlistFile="/etc/pihole/adlists.list" -customDNSfile="${PI_HOLE_CONFIG_DIR}/custom.list" # Pi-hole needs an IP address; to begin, these variables are empty since we don't know what the IP is until # this script can run IPV4_ADDRESS=${IPV4_ADDRESS} @@ -1477,6 +1476,15 @@ installConfigs() { return 1 fi fi + + # Install empty custom.list file if it does not exist + if [[ ! -r "${PI_HOLE_CONFIG_DIR}/custom.list" ]]; then + if ! install -o root -m 664 /dev/null "${PI_HOLE_CONFIG_DIR}/custom.list" &>/dev/null; then + printf " %bError: Unable to initialize configuration file %s/custom.list\\n" "${COL_LIGHT_RED}" "${PI_HOLE_CONFIG_DIR}" + return 1 + fi + fi + # If the user chose to install the dashboard, if [[ "${INSTALL_WEB_SERVER}" == true ]]; then # and if the Web server conf directory does not exist, @@ -1811,15 +1819,6 @@ installPiholeWeb() { printf "%b %b %s\\n" "${OVER}" "${TICK}" "${str}" } -# Creates custom DNS file if it does not exist -installCustomDNSfile() { - - if [[ ! -e "${customDNSfile}" ]]; then - touch "${customDNSfile}" - chmod 644 "${customDNSfile}" - fi - -} # Installs a cron file installCron() { @@ -2048,9 +2047,6 @@ installPihole() { # install a man page entry for pihole install_manpage - # install custom DNS file if it does not exist - installCustomDNSfile - # Update setupvars.conf with any variables that may or may not have been changed during the install finalExports } From dfcdfd4b0a9244db5b2e923fdf0f47fef79e3fcf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6nig?= Date: Sun, 26 Jul 2020 12:27:55 +0200 Subject: [PATCH 4/5] Remove empty line MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Christian König --- automated install/basic-install.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index fc90154a..8f98e16f 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -1484,7 +1484,7 @@ installConfigs() { return 1 fi fi - + # If the user chose to install the dashboard, if [[ "${INSTALL_WEB_SERVER}" == true ]]; then # and if the Web server conf directory does not exist, @@ -1819,7 +1819,6 @@ installPiholeWeb() { printf "%b %b %s\\n" "${OVER}" "${TICK}" "${str}" } - # Installs a cron file installCron() { # Install the cron job From 0a81d687e83de65e337f533c71dcdac0d2810a6c Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Sun, 26 Jul 2020 12:31:11 -0700 Subject: [PATCH 5/5] Update automated install/basic-install.sh --- automated install/basic-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 8f98e16f..4bc932e6 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -1479,7 +1479,7 @@ installConfigs() { # Install empty custom.list file if it does not exist if [[ ! -r "${PI_HOLE_CONFIG_DIR}/custom.list" ]]; then - if ! install -o root -m 664 /dev/null "${PI_HOLE_CONFIG_DIR}/custom.list" &>/dev/null; then + if ! install -o root -m 644 /dev/null "${PI_HOLE_CONFIG_DIR}/custom.list" &>/dev/null; then printf " %bError: Unable to initialize configuration file %s/custom.list\\n" "${COL_LIGHT_RED}" "${PI_HOLE_CONFIG_DIR}" return 1 fi