From 8c9034e5797d6cd59fceaa326a636158e70db986 Mon Sep 17 00:00:00 2001 From: obadz Date: Sat, 4 Mar 2017 15:22:46 +0000 Subject: [PATCH] remove swap partitions before rebooting. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Should help keep /old-root a bit smaller… --- nixos-infect | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/nixos-infect b/nixos-infect index 13214d6..429bf7f 100755 --- a/nixos-infect +++ b/nixos-infect @@ -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