[arch-projects] [devtools] [PATCH v2] makechrootpkg: Be recursive when deleting btrfs subvolumes.
Luke Shumaker
lukeshu at lukeshu.com
Fri Feb 17 20:13:28 UTC 2017
I'm embarrased that I sent this iteration of the patch. I was just
eager to make the suggested changes. I didn't even test it. I have a
test suite for this purpose; why the hell didn't I run it before
sending?
> + # sequence of "key value key value...". Unfortunately, both
There should be no comma there. I fixed it in the commit message, but
not the code comment.
> + path=$(awk -v id="$1" '$1 == id { sub($1 FS, ""); print }' <<<"$all")
That should be `id="$id"`, not `id="$1"`.
> + subvolumes="$(btrfs_subvolume_list "$dir")" || return
> + for read -r subvolume; do
> + btrfs subvolume delete "$dir/$subvolume" || return
> + done <<<"$subvolumes"
1. Stupid copy-pasto; that should be `while` instead of `for`.
2. I used a subshell and a variable rather than a pipe to make sure
that if `btrfs_subvolume_list`, we find out about it before
deleting anything. But, because `$(...)` trims trailing
whitespace, and `<<<` adds a trailing newline, this doesn't work
for the common case of there being no subvolumes to delete.
--
Happy hacking,
~ Luke Shumaker
More information about the arch-projects
mailing list