File tree Expand file tree Collapse file tree 2 files changed +23
-1
lines changed
Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change 3131
3232fs=" ${1} "
3333
34+ if ! is_zfs_filesystem " ${fs} " ; then
35+ zerror " '${fs} ' is not a ZFS filesystem"
36+ exit 1
37+ fi
38+
3439COLUMNS=" $( tput cols ) "
3540
3641while true ; do
Original file line number Diff line number Diff line change @@ -2072,7 +2072,6 @@ is_efi_system() {
20722072 return 1
20732073}
20742074
2075-
20762075# arg1: 'ro' or 'rw' to mount or remount efivarfs in that desired mode
20772076# arg2: optional mountpoint
20782077# prints: nothing
@@ -2096,3 +2095,21 @@ mount_efivarfs() {
20962095 mount -t efivarfs efivarfs " ${efivar_location} " -o " ${efivar_state} "
20972096 fi
20982097}
2098+
2099+ # arg1: zfs dataset name
2100+ # returns: 0 if filesystem
2101+
2102+ is_zfs_filesystem () {
2103+ local dataset
2104+
2105+ dataset=" ${1} "
2106+
2107+ if [ -z " ${dataset} " ]; then
2108+ zerror " dataset undefined"
2109+ return 1
2110+ fi
2111+
2112+ zfs list -H -o name -t filesystem " ${dataset} " > /dev/null 2>&1 && return 0
2113+
2114+ return 1
2115+ }
You can’t perform that action at this time.
0 commit comments