diff options
author | Luke Shumaker <lukeshu@parabola.nu> | 2017-05-06 00:41:01 +0200 |
---|---|---|
committer | Jan Alexander Steffens (heftig) <jan.steffens@gmail.com> | 2017-07-05 18:21:55 +0200 |
commit | 31a800fd8821396f6a17a2e38e04c792c7f61b3e (patch) | |
tree | 0c817190ff930efc08b176f47b15d272848405b9 /lib | |
parent | 6d1992909cc46e293027ff488ae2632047603e66 (diff) | |
download | devtools-31a800fd8821396f6a17a2e38e04c792c7f61b3e.tar.gz devtools-31a800fd8821396f6a17a2e38e04c792c7f61b3e.tar.xz |
lib/archroot.sh: subvolume_delete_recursive: support arbitrary recursion
The `-xdev` flag to `find` makes it not recurse over subvolumes; so it only
supports recursion with depth=1. Fix this by having the function
recursively call itself.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/archroot.sh | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/archroot.sh b/lib/archroot.sh index 6b1b52e..3a1023e 100644 --- a/lib/archroot.sh +++ b/lib/archroot.sh @@ -52,11 +52,14 @@ subvolume_delete_recursive() { is_subvolume "$1" || return 0 while IFS= read -d $'\0' -r subvol; do - if ! btrfs subvolume delete "$subvol" &>/dev/null; then - error "Unable to delete subvolume %s" "$subvol" + if ! subvolume_delete_recursive "$subvol"; then return 1 fi - done < <(find "$1" -xdev -depth -inum 256 -print0) + done < <(find "$1" -mindepth 1 -xdev -depth -inum 256 -print0) + if ! btrfs subvolume delete "$1" &>/dev/null; then + error "Unable to delete subvolume %s" "$subvol" + return 1 + fi return 0 } |