瀏覽代碼

Update contrib/nuke-graph-directory.sh

Signed-off-by: Brett Milford <brettmilford@gmail.com>
Brett Milford 4 年之前
父節點
當前提交
a0d1a1f78c
共有 1 個文件被更改,包括 5 次插入7 次删除
  1. 5 7
      contrib/nuke-graph-directory.sh

+ 5 - 7
contrib/nuke-graph-directory.sh

@@ -60,13 +60,11 @@ if command -v btrfs > /dev/null 2>&1; then
 	# Find btrfs subvolumes under $dir checking for inode 256
 	# Source: http://stackoverflow.com/a/32865333
 	for subvol in $(find "$dir" -type d -inum 256 | sort -r); do
-		if [ "$dir" != "$subvol" ]; then
-			if [ "$(stat -f --format=%T $subvol)" == "btrfs" ]; then
-				(
-					set -x
-					btrfs subvolume delete "$subvol"
-				)
-			fi
+		if [ "$dir" != "$subvol" ] && subvolType="$(stat -f --format=%T "$subvol")" && [ "$subvolType" = "btrfs" ]; then
+			(
+				set -x
+				btrfs subvolume delete "$subvol"
+			)
 		fi
 	done
 fi