From 49b597e313299538c6bcbe2339dc097e6df2cd7f Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Sat, 3 Jan 2015 07:11:47 +0000 Subject: [PATCH] Fix a bashism and some minor bugs in nuke-graph-directory.sh Gbp-Pq: Name 9637-fix-nuke-bashism.patch --- contrib/nuke-graph-directory.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/contrib/nuke-graph-directory.sh b/contrib/nuke-graph-directory.sh index f44c45a1..8d12a9d6 100755 --- a/contrib/nuke-graph-directory.sh +++ b/contrib/nuke-graph-directory.sh @@ -50,9 +50,10 @@ for mount in $(awk '{ print $5 }' /proc/self/mountinfo); do done # now, let's go destroy individual btrfs subvolumes, if any exist -if command -v btrfs &> /dev/null; then +if command -v btrfs > /dev/null 2>&1; then root="$(df "$dir" | awk 'NR>1 { print $NF }')" - for subvol in $(btrfs subvolume list -o "$root" 2>/dev/null | awk -F' path ' '{ print $2 }'); do + root="${root#/}" # if root is "/", we want it to become "" + for subvol in $(btrfs subvolume list -o "$root/" 2>/dev/null | awk -F' path ' '{ print $2 }' | sort -r); do subvolDir="$root/$subvol" if dir_in_dir "$subvolDir" "$dir"; then ( set -x; btrfs subvolume delete "$subvolDir" ) -- 2.30.2