mirror of
https://github.com/nix-community/disko
synced 2024-11-10 06:14:14 +00:00
disk-deactivate: only run zfs command if they are present
This commit is contained in:
parent
37c83c08d1
commit
c789d113c6
1 changed files with 2 additions and 2 deletions
|
@ -1,7 +1,7 @@
|
|||
# since lsblk lacks zfs support, we have to do it this way
|
||||
def remove:
|
||||
if .fstype == "zfs_member" then
|
||||
"zpool destroy -f \(.label)"
|
||||
"if type zpool >/dev/null; then zpool destroy -f \(.label); fi"
|
||||
elif .fstype == "LVM2_member" then
|
||||
[
|
||||
"vg=$(pvs \(.path) --noheadings --options vg_name | grep -o '[a-zA-Z0-9-]*')",
|
||||
|
@ -14,7 +14,7 @@ def remove:
|
|||
# maybe its zfs
|
||||
[
|
||||
# the next line has some horrible escaping
|
||||
"zpool=$(zdb -l \(.path) | sed -nr $'s/ +name: \\'(.*)\\'/\\\\1/p')",
|
||||
"zpool=$(if type zdb >/dev/null; then zdb -l \(.path) | sed -nr $'s/ +name: \\'(.*)\\'/\\\\1/p') else echo ""; fi",
|
||||
"if [[ -n \"${zpool}\" ]]; then zpool destroy -f \"$zpool\"; fi",
|
||||
"unset zpool"
|
||||
]
|
||||
|
|
Loading…
Reference in a new issue