00-fsdev.sh: add _is_mdadm helper function

master
Fabio Erculiani 11 years ago
parent f92804c752
commit 748e991ecf

@ -3,6 +3,14 @@
. /etc/initrd.d/00-common.sh . /etc/initrd.d/00-common.sh
. /etc/initrd.d/00-devmgr.sh . /etc/initrd.d/00-devmgr.sh
MDADM_BIN="/sbin/mdadm"
_is_mdadm() {
[ -x "${MDADM_BIN}" ] || return 1
[ "${USE_MDADM}" = "1" ] || return 1
return 0
}
mount_sysfs() { mount_sysfs() {
mount -t sysfs sysfs /sys -o noexec,nosuid,nodev \ mount -t sysfs sysfs /sys -o noexec,nosuid,nodev \
>/dev/null 2>&1 && return 0 >/dev/null 2>&1 && return 0
@ -172,7 +180,7 @@ setup_md_device() {
start_md_volumes() { start_md_volumes() {
good_msg "Starting md devices" good_msg "Starting md devices"
mdadm --assemble --scan "${MDADM_BIN}" --assemble --scan
# do not bad_msg, user could have this enabled even though # do not bad_msg, user could have this enabled even though
# no RAID is currently available. # no RAID is currently available.
} }
@ -185,7 +193,7 @@ start_volumes() {
ln -sf /dev/device-mapper /dev/mapper/control ln -sf /dev/device-mapper /dev/mapper/control
fi fi
[ "${USE_MDADM}" = "1" ] && start_md_volumes _is_mdadm && start_md_volumes
if [ "${USE_MULTIPATH_NORMAL}" = "1" ]; then if [ "${USE_MULTIPATH_NORMAL}" = "1" ]; then
good_msg "Scanning for multipath devices" good_msg "Scanning for multipath devices"

@ -87,7 +87,6 @@ for x in ${CMDLINE}; do
USE_LVM_NORMAL=1 USE_LVM_NORMAL=1
;; ;;
domdadm) domdadm)
# TODO(lxnay): enable this implicitly if /sbin/mdadm is available
USE_MDADM=1 USE_MDADM=1
;; ;;
dodmraid) dodmraid)

Loading…
Cancel
Save