From 1f8634dd48a36a1e4225a5238395a0a57eca9cde Mon Sep 17 00:00:00 2001 From: Danylo Hlynskyi Date: Fri, 13 Jul 2018 00:27:59 +0300 Subject: [PATCH] more robust removeSwap During my nixos-infect tests I have sometimes canceled infection in the middle. Rerun of nixos-infect failed because there were some old swap files, which were no longer available as swap devices. `swapoff -a` will handle this for us (we are going reboot anyway) --- nixos-infect | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/nixos-infect b/nixos-infect index 70b9bc8..1bcf646 100755 --- a/nixos-infect +++ b/nixos-infect @@ -127,11 +127,8 @@ makeSwap() { } removeSwap() { - for swapFile in /tmp/nixos-infect.*.swp - do - swapoff -v "$swapFile" - rm -vf "$swapFile" - done + swapoff -a + rm -vf /tmp/nixos-infect.*.swp } prepareEnv() {