diff options
-rwxr-xr-x | src/chroot-tools/librechroot | 3 | ||||
-rw-r--r-- | test/librechroot-test.sh | 13 |
2 files changed, 16 insertions, 0 deletions
diff --git a/src/chroot-tools/librechroot b/src/chroot-tools/librechroot index 6ae4b12..d763830 100755 --- a/src/chroot-tools/librechroot +++ b/src/chroot-tools/librechroot @@ -449,6 +449,9 @@ main() { # - set 'CacheDir' in \`/etc/pacman.conf'" # - apply -C or -M flags arch-nspawn "$copydir" true + if [[ -n ${tmppacmanconf:-} ]]; then + rm -f -- "$tmppacmanconf" + fi trap EXIT # clear the trap to remove the tmp pacman.conf from -A arch_nspawn_flags=() # XXX dirty hack, don't apply -C or -M again fi diff --git a/test/librechroot-test.sh b/test/librechroot-test.sh index 42d4803..edf7a4f 100644 --- a/test/librechroot-test.sh +++ b/test/librechroot-test.sh @@ -145,3 +145,16 @@ it_deletes_subvolumes_recursively() { testsudo librechroot -l "$roundup_test_name" delete not test -e "$chrootdir/default/$roundup_test_name" } + +it_cleans_up_TMPDIR() { + require network sudo || return 0 + + local dir="$tmpdir/tmp" + mkdir -- "$dir" + + libremessages msg 'Creating a chroot, may take a few minutes' &>/dev/tty + TMPDIR=$dir testsudo librechroot -l "$roundup_test_name" -A x86_64 make + + # Make sure $dir is now empty + rmdir -- "$dir" +} |