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
1 changed files with 11 additions and 2 deletions

View File

@ -145,11 +145,19 @@ EOF
makeSwap() {
# 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))
chmod 0600 $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() {
@ -260,4 +268,5 @@ checkEnv
makeConf
makeSwap # smallest (512MB) droplet needs extra memory!
infect
removeSwap
reboot