From 51c4c51d9e1ca21c8454fb999d3691c0eea598a0 Mon Sep 17 00:00:00 2001 From: Promofaux Date: Sat, 15 Oct 2016 20:03:33 +0100 Subject: [PATCH] Add trap to check existence of setupVars --- gravity.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/gravity.sh b/gravity.sh index 0aaf2b88..4ef440a5 100755 --- a/gravity.sh +++ b/gravity.sh @@ -32,7 +32,15 @@ whitelistScript=/opt/pihole/whitelist.sh blacklistScript=/opt/pihole/blacklist.sh #Source the setupVars from install script for the IP -. /etc/pihole/setupVars.conf +setupVars=/etc/pihole/setupVars.conf +if [[ -f ${setupVars} ]];then + . /etc/pihole/setupVars.conf +else + echo "::: WARNING: /etc/pihole/setupVars.conf missing. Possible installation failure." + echo "::: Please run 'pihole -r', and choose the 'install' option to reconfigure." + exit 1 +fi + #Remove the /* from the end of the IPv4addr. IPv4addr=${IPv4_address%/*}