1
0
mirror of https://github.com/moparisthebest/pi-hole synced 2024-12-01 13:32:23 -05:00

Merge pull request #42 from hawson/noswap

Allow for local settings to disable swap
This commit is contained in:
Jacob Salmela 2015-09-18 16:49:43 -05:00
commit 2ca9b6b005

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 [[ -n "$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