index : devtools32 | |
Archlinux32 fork of devtools | gitolite user |
summaryrefslogtreecommitdiff |
author | Luke Shumaker <lukeshu@parabola.nu> | 2017-04-10 13:08:33 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@parabola.nu> | 2017-04-16 23:20:29 -0400 |
commit | d209a589f690723e5aa14f94a3b5c57222f31c54 (patch) | |
tree | cb88b7b5063bc6a97c8ee3f2bf6187ae9ee398b5 /lib | |
parent | 49088b0860276c664933c2b3e36a2fef714b7a07 (diff) |
-rw-r--r-- | lib/archroot.sh | 11 |
diff --git a/lib/archroot.sh b/lib/archroot.sh index 46d4963..87c28a2 100644 --- a/lib/archroot.sh +++ b/lib/archroot.sh @@ -25,6 +25,15 @@ is_btrfs() { } ## +# usage : is_subvolume( $path ) +# return : whether $path is a the root of a btrfs subvolume (including +# the top-level subvolume). +## +is_subvolume() { + [[ -e "$1" && "$(stat -f -c %T "$1")" == btrfs && "$(stat -c %i "$1")" == 256 ]] +} + +## # usage : subvolume_delete_recursive( $path ) # # Find all btrfs subvolumes under and including $path and delete them. @@ -32,7 +41,7 @@ is_btrfs() { subvolume_delete_recursive() { local subvol - is_btrfs "$1" || return 0 + is_subvolume "$1" || return 0 while IFS= read -d $'\0' -r subvol; do if ! btrfs subvolume delete "$subvol" &>/dev/null; then |