From 9b3bc3d25f1f50156d517070685fe3543f94f64c Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 1 Mar 2022 14:28:13 +0100 Subject: [PATCH] CI: convenience for after-crash-cleanup --- ci/umount.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100755 ci/umount.sh diff --git a/ci/umount.sh b/ci/umount.sh new file mode 100755 index 000000000..400b0e115 --- /dev/null +++ b/ci/umount.sh @@ -0,0 +1,17 @@ +#! /bin/sh +# +# This is an "unmount" script that tries to unmount whatever +# filesystems Calamares might have left mounted (e.g. because of +# a crash, or ^C'ing the installer, or ..). +# + +# Swap may have become enabled on the disks just used; assume +# we're in a live session where we don't want any. +sudo swapoff -a +# In Arch-based systems, there may be a gpg-agent started by +# pacman during installation, which lives in the chroot. Kill +# them all; again assume we're in a live session where it doesn't matter. +sudo pkill gpg-agent +# Unmount the filesystems in *reverse* order, since we need to ditch +# e.g. /run/udev before /run before the root filesystem. +sudo umount $( LC_ALL=C mount | awk '/calamares-root/{print $3}' | LC_ALL=C sort -r )