test: split out host_has_{btrfs,mdadm}() from TEST-64-UDEV-STORAGE

This commit is contained in:
Yu Watanabe 2023-12-06 13:29:36 +09:00
parent 997ba18af1
commit 5b4fa6f13c
2 changed files with 12 additions and 2 deletions

View file

@ -24,7 +24,7 @@ _host_has_feature() {(
case "${1:?}" in
btrfs)
modprobe -nv btrfs && command -v mkfs.btrfs && command -v btrfs || return $?
host_has_btrfs
;;
iscsi)
# Client/initiator (Open-iSCSI)
@ -36,7 +36,7 @@ _host_has_feature() {(
command -v lvm || return $?
;;
mdadm)
command -v mdadm || return $?
host_has_mdadm
;;
multipath)
command -v multipath && command -v multipathd || return $?

View file

@ -1190,6 +1190,11 @@ install_lvm() {
mkdir -p "${initdir:?}/etc/lvm"
}
host_has_btrfs() (
set -e
modprobe -nv btrfs && command -v mkfs.btrfs && command -v btrfs || return $?
)
install_btrfs() {
instmods btrfs
# Not all utilities provided by btrfs-progs are listed here; extend the list
@ -1257,6 +1262,11 @@ install_iscsi() {
fi
}
host_has_mdadm() (
set -e
command -v mdadm || return $?
)
install_mdadm() {
local unit
local mdadm_units=(