From 4a4db7ab5607c33b84e55e1b67ae97da93e225e5 Mon Sep 17 00:00:00 2001 From: Jesse Becker Date: Fri, 11 Sep 2015 22:54:37 -0400 Subject: [PATCH 1/2] Allow for local settings to disable swap --- gravity.sh | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/gravity.sh b/gravity.sh index 2bef29b..c7505b9 100755 --- a/gravity.sh +++ b/gravity.sh @@ -19,9 +19,6 @@ sources=('https://adaway.org/hosts.txt' adList=/etc/pihole/gravity.list origin=/etc/pihole piholeDir=/etc/pihole -if [[ -f $piholeDir/pihole.conf ]];then - . $piholeDir/pihole.conf -fi justDomainsExtension=domains matter=pihole.0.matter.txt andLight=pihole.1.andLight.txt @@ -34,6 +31,13 @@ latentBlacklist=$origin/latentBlacklist.txt whitelist=$piholeDir/whitelist.txt latentWhitelist=$origin/latentWhitelist.txt +# After setting defaults, check if there's local overrides +if [[ -r $piholeDir/pihole.conf ]];then + echo "** Local calibration requested..." + . $piholeDir/pihole.conf +fi + + echo "** Neutrino emissions detected..." # Create the pihole resource directory if it doesn't exist. Future files will be stored here @@ -55,7 +59,11 @@ function createSwapFile() sudo dphys-swapfile swapon } -if [[ -f /etc/dphys-swapfile ]];then + +if [[ -z "$noSwap" ]]; then + # if $noSwap is set, don't do anything + : +elif [[ -f /etc/dphys-swapfile ]];then swapSize=$(cat /etc/dphys-swapfile | grep -m1 CONF_SWAPSIZE | cut -d'=' -f2) if [[ $swapSize != 500 ]];then mv /etc/dphys-swapfile /etc/dphys-swapfile.orig From cfac2be334b34f636edaaa0ff5e85fa981ce5704 Mon Sep 17 00:00:00 2001 From: Jesse Becker Date: Sun, 13 Sep 2015 15:23:29 -0400 Subject: [PATCH 2/2] toggle test case for noswap --- gravity.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gravity.sh b/gravity.sh index c7505b9..1f5e3fb 100755 --- a/gravity.sh +++ b/gravity.sh @@ -60,7 +60,7 @@ function createSwapFile() } -if [[ -z "$noSwap" ]]; then +if [[ -n "$noSwap" ]]; then # if $noSwap is set, don't do anything : elif [[ -f /etc/dphys-swapfile ]];then