From b7891f92a587287f7d28e21affa18fd7cae428ec Mon Sep 17 00:00:00 2001 From: Ludovic Rousseau Date: Sun, 18 Feb 2018 13:00:56 +0100 Subject: [PATCH 1/2] Create blacklist.txt if not existant Closes: https://github.com/pi-hole/pi-hole/issues/1888 Signed-off-by: Ludovic Rousseau --- advanced/Scripts/list.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/advanced/Scripts/list.sh b/advanced/Scripts/list.sh index 72250afd..106f5caf 100755 --- a/advanced/Scripts/list.sh +++ b/advanced/Scripts/list.sh @@ -84,6 +84,11 @@ PoplistFile() { touch ${whitelist} fi + # Check blacklist file exists, and if not, create it + if [[ ! -f ${blacklist} ]]; then + touch ${blacklist} + fi + for dom in "${domList[@]}"; do # Logic: If addmode then add to desired list and remove from the other; if delmode then remove from desired list but do not add to the other if ${addmode}; then From 47bbea9ba71faea5669aa75526e1ab66d1164b30 Mon Sep 17 00:00:00 2001 From: Ludovic Rousseau Date: Sun, 18 Feb 2018 21:18:52 +0100 Subject: [PATCH 2/2] Use " " to protect parameter substitution Signed-off-by: Ludovic Rousseau --- advanced/Scripts/list.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/advanced/Scripts/list.sh b/advanced/Scripts/list.sh index 106f5caf..1d96ea3c 100755 --- a/advanced/Scripts/list.sh +++ b/advanced/Scripts/list.sh @@ -10,9 +10,9 @@ # Globals basename=pihole -piholeDir=/etc/${basename} -whitelist=${piholeDir}/whitelist.txt -blacklist=${piholeDir}/blacklist.txt +piholeDir=/etc/"${basename}" +whitelist="${piholeDir}"/whitelist.txt +blacklist="${piholeDir}"/blacklist.txt readonly wildcardlist="/etc/dnsmasq.d/03-pihole-wildcard.conf" reload=false addmode=true @@ -80,13 +80,13 @@ HandleOther() { PoplistFile() { # Check whitelist file exists, and if not, create it - if [[ ! -f ${whitelist} ]]; then - touch ${whitelist} + if [[ ! -f "${whitelist}" ]]; then + touch "${whitelist}" fi # Check blacklist file exists, and if not, create it - if [[ ! -f ${blacklist} ]]; then - touch ${blacklist} + if [[ ! -f "${blacklist}" ]]; then + touch "${blacklist}" fi for dom in "${domList[@]}"; do