index : builder | |
Archlinux32 build system | gitolite user |
summaryrefslogtreecommitdiff |
author | Erich Eckner <git@eckner.net> | 2019-04-17 13:47:54 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2019-04-17 13:47:54 +0200 |
commit | 2d3827b12d0eda00f28147905ea579d3d07df02c (patch) | |
tree | 56ab7dcf09d180f4b1fc08d88d9abd4167e7edb4 | |
parent | 254a31c2e10b3b806a3b00137d32acf24af77a44 (diff) |
-rwxr-xr-x | lib/common-functions | 19 |
diff --git a/lib/common-functions b/lib/common-functions index e87e6ef..17309fb 100755 --- a/lib/common-functions +++ b/lib/common-functions @@ -390,10 +390,25 @@ recursively_umount_and_rm() { exit 42 fi + # the sh -c '...' construct branch below is borrowed from + # archlinux/devtools lib/archroot.sh: is_subvolume(), is_same_fs() and + # subvolume_delete_recursive() + # shellcheck disable=SC1004,SC2016 find "${dir}" \ - -xdev -depth -type d \ + -depth \ + -xdev \ + -type d \ -exec 'mountpoint' '-q' '{}' ';' \ - -exec 'sudo' 'umount' '-l' '{}' ';' + -exec 'sudo' 'umount' '-l' '{}' ';' \ + -prune \ + , \ + -inum 256 \ + -exec sh -c ' + [ "$(stat -f -c %T "$1")" = btrfs ] && \ + [ "$(stat -c %d "$1")" = "$2" ] + ' {} "$(stat -c %d "${dir}")" \; \ + -exec btrfs subvolume delete {} \; \ + -prune rm -rf --one-file-system "${dir}" } |