From 81fdfcba22868357017aa8288473bd17baa762b2 Mon Sep 17 00:00:00 2001 From: Jim Liu Date: Thu, 21 Apr 2016 23:40:38 +0800 Subject: [PATCH 1/7] Update whitelist.sh --- advanced/Scripts/whitelist.sh | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/advanced/Scripts/whitelist.sh b/advanced/Scripts/whitelist.sh index 92db9afe..23a72fae 100755 --- a/advanced/Scripts/whitelist.sh +++ b/advanced/Scripts/whitelist.sh @@ -42,12 +42,19 @@ verbose=true domList=() domToRemoveList=() +piholeIPfile=/tmp/piholeIP piholeIPv6file=/etc/pihole/.useIPv6 -# Otherwise, the IP address can be taken directly from the machine, which will happen when the script is run by the user and not the installation script -IPv4dev=$(ip route get 8.8.8.8 | awk '{for(i=1;i<=NF;i++)if($i~/dev/)print $(i+1)}') -piholeIPCIDR=$(ip -o -f inet addr show dev "$IPv4dev" | awk '{print $4}' | awk 'END {print}') -piholeIP=${piholeIPCIDR%/*} +if [[ -f $piholeIPfile ]];then + # If the file exists, it means it was exported from the installation script and we should use that value instead of detecting it in this script + piholeIP=$(cat $piholeIPfile) + #rm $piholeIPfile +else + # Otherwise, the IP address can be taken directly from the machine, which will happen when the script is run by the user and not the installation script + IPv4dev=$(ip route get 8.8.8.8 | awk '{for(i=1;i<=NF;i++)if($i~/dev/)print $(i+1)}') + piholeIPCIDR=$(ip -o -f inet addr show dev "$IPv4dev" | awk '{print $4}' | awk 'END {print}') + piholeIP=${piholeIPCIDR%/*} +fi modifyHost=false From a5ad48aa1843e4b24eec63fdd0411769b0fa16a5 Mon Sep 17 00:00:00 2001 From: Jim Liu Date: Thu, 21 Apr 2016 23:40:44 +0800 Subject: [PATCH 2/7] Update gravity.sh --- gravity.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gravity.sh b/gravity.sh index ffcbf342..0538405e 100755 --- a/gravity.sh +++ b/gravity.sh @@ -38,7 +38,7 @@ blacklistScript=/opt/pihole/blacklist.sh if [[ -f $piholeIPfile ]];then # If the file exists, it means it was exported from the installation script and we should use that value instead of detecting it in this script piholeIP=$(cat $piholeIPfile) - rm $piholeIPfile + #rm $piholeIPfile else # Otherwise, the IP address can be taken directly from the machine, which will happen when the script is run by the user and not the installation script IPv4dev=$(ip route get 8.8.8.8 | awk '{for(i=1;i<=NF;i++)if($i~/dev/)print $(i+1)}') From 08e95ed606bbb0d1e027d8b3ccbcc16793f45556 Mon Sep 17 00:00:00 2001 From: Jim Liu Date: Fri, 22 Apr 2016 01:40:42 +0800 Subject: [PATCH 3/7] Update gravity.sh Change piholeIPfile to a permanent location. --- gravity.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gravity.sh b/gravity.sh index 0538405e..ce04e181 100755 --- a/gravity.sh +++ b/gravity.sh @@ -27,7 +27,7 @@ else fi fi -piholeIPfile=/tmp/piholeIP +piholeIPfile=/etc/pihole/piholeIP piholeIPv6file=/etc/pihole/.useIPv6 adListFile=/etc/pihole/adlists.list From 10066209e72d50b01e601f315661c381642ec93f Mon Sep 17 00:00:00 2001 From: Jim Liu Date: Fri, 22 Apr 2016 01:41:11 +0800 Subject: [PATCH 4/7] Update whitelist.sh Change piholeIPfile to a permanent location. --- advanced/Scripts/whitelist.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/advanced/Scripts/whitelist.sh b/advanced/Scripts/whitelist.sh index 23a72fae..b927615e 100755 --- a/advanced/Scripts/whitelist.sh +++ b/advanced/Scripts/whitelist.sh @@ -42,7 +42,7 @@ verbose=true domList=() domToRemoveList=() -piholeIPfile=/tmp/piholeIP +piholeIPfile=/etc/pihole/piholeIP piholeIPv6file=/etc/pihole/.useIPv6 if [[ -f $piholeIPfile ]];then From 08e6f60941f3a6486e038421b5d887c324664728 Mon Sep 17 00:00:00 2001 From: Jim Liu Date: Fri, 22 Apr 2016 01:42:43 +0800 Subject: [PATCH 5/7] Update blacklist.sh --- advanced/Scripts/blacklist.sh | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/advanced/Scripts/blacklist.sh b/advanced/Scripts/blacklist.sh index f7a18eae..e28188eb 100755 --- a/advanced/Scripts/blacklist.sh +++ b/advanced/Scripts/blacklist.sh @@ -42,12 +42,19 @@ verbose=true domList=() domToRemoveList=() +piholeIPfile=/etc/pihole/piholeIP piholeIPv6file=/etc/pihole/.useIPv6 -# Otherwise, the IP address can be taken directly from the machine, which will happen when the script is run by the user and not the installation script -IPv4dev=$(ip route get 8.8.8.8 | awk '{for(i=1;i<=NF;i++)if($i~/dev/)print $(i+1)}') -piholeIPCIDR=$(ip -o -f inet addr show dev "$IPv4dev" | awk '{print $4}' | awk 'END {print}') -piholeIP=${piholeIPCIDR%/*} +if [[ -f $piholeIPfile ]];then + # If the file exists, it means it was exported from the installation script and we should use that value instead of detecting it in this script + piholeIP=$(cat $piholeIPfile) + #rm $piholeIPfile +else + # Otherwise, the IP address can be taken directly from the machine, which will happen when the script is run by the user and not the installation script + IPv4dev=$(ip route get 8.8.8.8 | awk '{for(i=1;i<=NF;i++)if($i~/dev/)print $(i+1)}') + piholeIPCIDR=$(ip -o -f inet addr show dev "$IPv4dev" | awk '{print $4}' | awk 'END {print}') + piholeIP=${piholeIPCIDR%/*} +fi modifyHost=false From 221b72439b2b3069735af706a611b44119ab9de4 Mon Sep 17 00:00:00 2001 From: Jim Liu Date: Fri, 22 Apr 2016 01:46:27 +0800 Subject: [PATCH 6/7] Update basic-install.sh --- automated install/basic-install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 139a7a4b..0f05ab63 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -255,8 +255,8 @@ It is also possible to use a DHCP reservation, but if you are going to do that, IP address: $IPv4addr Gateway: $IPv4gw" $r $c)then # If the settings are correct, then we need to set the piholeIP - # Saving it to a temporary file us to retrieve it later when we run the gravity.sh script - echo "${IPv4addr%/*}" > /tmp/piholeIP + # Saving it to a temporary file us to retrieve it later when we run the gravity.sh script. piholeIP is saved to a permanent file so gravity.sh can use it when updating + echo "${IPv4addr%/*}" > /etc/pihole/piholeIP echo "$piholeInterface" > /tmp/piholeINT # After that's done, the loop ends and we move on ipSettingsCorrect=True From 00cc480bc1f69eb00e79b26769b7993079d9697d Mon Sep 17 00:00:00 2001 From: Jim Liu Date: Tue, 26 Apr 2016 16:10:51 +0800 Subject: [PATCH 7/7] Update basic-install.sh --- automated install/basic-install.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 0f05ab63..bf3d855a 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -235,6 +235,8 @@ getStaticIPv4Settings() { whiptail --msgbox --backtitle "IP information" --title "FYI: IP Conflict" "It is possible your router could still try to assign this IP to a device, which would cause a conflict. But in most cases the router is smart enough to not do that. If you are worried, either manually set the address, or modify the DHCP reservation pool so it does not include the IP you want. It is also possible to use a DHCP reservation, but if you are going to do that, you might as well set a static address." $r $c + #piholeIP is saved to a permanent file so gravity.sh can use it when updating + echo "${IPv4addr%/*}" > /etc/pihole/piholeIP # Nothing else to do since the variables are already set above else # Otherwise, we need to ask the user to input their desired settings.