diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2017-04-10 22:31:59 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2017-04-11 13:02:28 -0400 |
commit | e8f1b2c68d45a8ffd655cd57835f7391e5253760 (patch) | |
tree | 02e6c0fd6f9ae58604bf32ec5aaa81a0a4b4c870 /test/test-common.sh | |
parent | 9d90d48c9d01fa45d1a363fc01d0a1c2ffc9e790 (diff) |
test/test-common.sh: Improve btrfs-aware rm-rf cleanup
Diffstat (limited to 'test/test-common.sh')
-rw-r--r-- | test/test-common.sh | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/test/test-common.sh b/test/test-common.sh index f81738a..ed3bdd0 100644 --- a/test/test-common.sh +++ b/test/test-common.sh @@ -53,12 +53,9 @@ _cleanup_chrootdir() ( chrootdir=$1 shopt -s nullglob if [[ $SUDO ]]; then - local chroottype=$(stat -f -c %T "$chrootdir") - if [[ "$chroottype" == btrfs ]]; then - sudo find "$chrootdir" -type d -print0 | - LC_ALL=C sort -rz | - xargs -r0 sudo -n \ - btrfs subvolume delete &>/dev/null || true + if [[ "$(stat -f -c %T "$chrootdir")" == btrfs ]]; then + sudo find "$chrootdir" -depth -inum 256 -exec \ + btrfs subvolume delete {} \; &>/dev/null fi sudo rm -rf -- "$chrootdir" else |