Allow for local settings to disable swap

This commit is contained in:
Jesse Becker 2015-09-11 22:54:37 -04:00
parent 23713d82a0
commit 4a4db7ab56

View file

@ -19,9 +19,6 @@ sources=('https://adaway.org/hosts.txt'
adList=/etc/pihole/gravity.list adList=/etc/pihole/gravity.list
origin=/etc/pihole origin=/etc/pihole
piholeDir=/etc/pihole piholeDir=/etc/pihole
if [[ -f $piholeDir/pihole.conf ]];then
. $piholeDir/pihole.conf
fi
justDomainsExtension=domains justDomainsExtension=domains
matter=pihole.0.matter.txt matter=pihole.0.matter.txt
andLight=pihole.1.andLight.txt andLight=pihole.1.andLight.txt
@ -34,6 +31,13 @@ latentBlacklist=$origin/latentBlacklist.txt
whitelist=$piholeDir/whitelist.txt whitelist=$piholeDir/whitelist.txt
latentWhitelist=$origin/latentWhitelist.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..." echo "** Neutrino emissions detected..."
# Create the pihole resource directory if it doesn't exist. Future files will be stored here # 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 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) swapSize=$(cat /etc/dphys-swapfile | grep -m1 CONF_SWAPSIZE | cut -d'=' -f2)
if [[ $swapSize != 500 ]];then if [[ $swapSize != 500 ]];then
mv /etc/dphys-swapfile /etc/dphys-swapfile.orig mv /etc/dphys-swapfile /etc/dphys-swapfile.orig