File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11# since lsblk lacks zfs support, we have to do it this way
22def remove :
33 if .fstype == "zfs_member" then
4- "zpool destroy -f \( .label ) "
4+ "if type zpool >/dev/null; then zpool destroy -f \( .label ) ; zpool labelclear -f \( .label ) ; fi "
55 elif .fstype == "LVM2_member" then
66 [
77 "vg=$(pvs \( .path ) --noheadings --options vg_name | grep -o '[a-zA-Z0-9-]*')" ,
@@ -14,8 +14,8 @@ def remove:
1414 # maybe its zfs
1515 [
1616 # the next line has some horrible escaping
17- "zpool=$(zdb -l \( .path ) | sed -nr $'s/ +name: \\ '(.*)\\ '/\\\\ 1/p')" ,
18- "if [[ -n \" ${zpool}\" ]]; then zpool destroy -f \" $zpool\" ; fi" ,
17+ "zpool=$(if type zdb >/dev/null; then zdb -l \( .path ) | sed -nr $'s/ +name: \\ '(.*)\\ '/\\\\ 1/p'; fi )" ,
18+ "if [[ -n \" ${zpool}\" ]]; then zpool destroy -f \" $zpool\" ; zpool labelclear -f \" $zpool \" ; fi" ,
1919 "unset zpool"
2020 ]
2121 else
Original file line number Diff line number Diff line change 148148 in
149149 ''
150150 readarray -t zfs_devices < <(cat "$disko_devices_dir"/zfs_${ config . name } )
151+ if [ '' ${#zfs_devices[@]} -eq 0 ]; then
152+ echo "no devices found for zpool ${ config . name } . Did you misspell the pool name?" >&2
153+ exit 1
154+ fi
151155 # Try importing the pool without mounting anything if it exists.
152156 # This allows us to set mounpoints.
153157 if zpool import -N -f '${ config . name } ' || zpool list '${ config . name } '; then
You can’t perform that action at this time.
0 commit comments