mirror of
https://github.com/elitak/nixos-infect
synced 2024-11-10 05:54:20 +00:00
remove swap partitions before rebooting.
Should help keep /old-root a bit smaller…
This commit is contained in:
parent
9e1c0fdd42
commit
8c9034e579
1 changed files with 11 additions and 2 deletions
13
nixos-infect
13
nixos-infect
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue