forked from pool/mdadm
Accepting request 29126 from home:michal-m:branches:Base:System
Copy from home:michal-m:branches:Base:System/mdadm via accept of submit request 29126 revision 2. Request was accepted with message: Reviewed ok OBS-URL: https://build.opensuse.org/request/show/29126 OBS-URL: https://build.opensuse.org/package/show/Base:System/mdadm?expand=0&rev=10
This commit is contained in:
committed by
Git OBS Bridge
parent
f5eef324e8
commit
bc6e213f2e
@@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
#%stage: softraid
|
||||
#%programs: /sbin/mdadm /sbin/mdmon
|
||||
#%modules: raid0 raid1 raid456
|
||||
#%modules: raid0 raid1 raid10 raid456
|
||||
#%if: -n "$need_mdadm"
|
||||
#
|
||||
##### MD (Software-)Raid
|
||||
@@ -33,36 +33,41 @@ if [ -f /sys/module/md_mod/parameters/start_ro ]; then
|
||||
echo 1 > /sys/module/md_mod/parameters/start_ro
|
||||
fi
|
||||
|
||||
if [ -n "$need_mdadm" ]; then
|
||||
|
||||
if [ -f /etc/mdadm.conf ] ; then
|
||||
mdconf="-Ac /etc/mdadm.conf"
|
||||
[ -z "$md_dev" ] && md_dev="--scan"
|
||||
md_assemble()
|
||||
{
|
||||
local dev=$1 mdconf container
|
||||
|
||||
case "$dev" in
|
||||
/dev/md[0-9]*p[0-9]*)
|
||||
dev=${dev%p[0-9]*}
|
||||
esac
|
||||
if test -f /etc/mdadm.conf; then
|
||||
mdconf="-c /etc/mdadm.conf"
|
||||
container=$( \
|
||||
sed -rn "s:^ARRAY +$dev .*container=([^ ]*).*:\\1:p" \
|
||||
/etc/mdadm.conf)
|
||||
else
|
||||
mdconf="-c partitions"
|
||||
fi
|
||||
if test -n "$container"; then
|
||||
mdadm -A $mdconf --uuid="$container" /dev/md/container
|
||||
fi
|
||||
mdadm -A $mdconf $mdarg "$dev"
|
||||
}
|
||||
|
||||
if [ -n "$need_mdadm" ]; then
|
||||
|
||||
if [ -n "$md_uuid" ] ; then
|
||||
mdarg="--uuid=$md_uuid"
|
||||
elif [ -n "$md_uuid" ] ; then
|
||||
mdarg="$mdarg --uuid=$md_uuid"
|
||||
fi
|
||||
if [ -n "$md_minor" ] ; then
|
||||
mdarg="$mdarg --super-minor=$md_minor"
|
||||
md_dev="/dev/md$md_minor"
|
||||
elif [ -z "$md_minor" -a -n "$md_minor" ] ; then
|
||||
mdarg="$mdarg --super-minor=$md_minor"
|
||||
fi
|
||||
|
||||
case $resumedev in
|
||||
/dev/md*)
|
||||
echo 1 > /sys/module/md_mod/parameters/start_ro
|
||||
resume_minor="${resumedev#/dev/md}"
|
||||
mdadm -Ac partitions -m $resume_minor --auto=md $resumedev
|
||||
;;
|
||||
/dev/md*)
|
||||
md_assemble "$resumedev"
|
||||
esac
|
||||
|
||||
if [ "$md_dev" ] ; then
|
||||
/sbin/mdadm $mdconf --auto=md $md_dev || /sbin/mdadm -Ac partitions $mdarg --auto=md $md_dev
|
||||
if [ -n "$md_dev" ] ; then
|
||||
md_assemble "$md_dev"
|
||||
fi
|
||||
wait_for_events
|
||||
fi
|
||||
|
||||
|
Reference in New Issue
Block a user