remove swap partitions before rebooting.

Should help keep /old-root a bit smaller…
This commit is contained in:
obadz 2017-03-04 15:22:46 +00:00
parent 9e1c0fdd42
commit 8c9034e579

View file

@ -145,11 +145,19 @@ EOF
makeSwap() { makeSwap() {
# TODO check currently available swapspace first # TODO check currently available swapspace first
swapFile=`mktemp` swapFile=`mktemp /tmp/nixos-infect.XXXXX.swp`
dd if=/dev/zero of=$swapFile bs=1M count=$((1*1024)) dd if=/dev/zero of=$swapFile bs=1M count=$((1*1024))
chmod 0600 $swapFile chmod 0600 $swapFile
mkswap $swapFile mkswap $swapFile
swapon $swapFile swapon -v $swapFile
}
removeSwap() {
for swapFile in /tmp/nixos-infect.*.swp
do
swapoff -v $swapFile
rm -vf $swapFile
done
} }
prepareEnv() { prepareEnv() {
@ -260,4 +268,5 @@ checkEnv
makeConf makeConf
makeSwap # smallest (512MB) droplet needs extra memory! makeSwap # smallest (512MB) droplet needs extra memory!
infect infect
removeSwap
reboot reboot