forked from pool/mdadm
This commit is contained in:
parent
ad7f039e9b
commit
622aa915e2
@ -1,3 +1,8 @@
|
||||
-------------------------------------------------------------------
|
||||
Wed Jul 23 15:21:59 CEST 2008 - hare@suse.de
|
||||
|
||||
- Include mkinitrd scriptlets.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Jun 20 14:28:20 CEST 2008 - mmarek@suse.cz
|
||||
|
||||
|
13
mdadm.spec
13
mdadm.spec
@ -13,7 +13,7 @@
|
||||
|
||||
Name: mdadm
|
||||
Version: 2.6.7
|
||||
Release: 1
|
||||
Release: 6
|
||||
BuildRequires: sgmltool
|
||||
PreReq: %fillup_prereq %insserv_prereq
|
||||
Obsoletes: raidtools
|
||||
@ -28,6 +28,8 @@ Source1: Software-RAID.HOWTO.tar.bz2
|
||||
Source2: sysconfig.mdadm
|
||||
Source3: mdadmd
|
||||
Source4: boot.md
|
||||
Source5: mkinitrd-setup.sh
|
||||
Source6: mkinitrd-boot.sh
|
||||
Patch1: mdadm-2.6.7-56f8add2.patch
|
||||
Patch2: mdadm-2.6.7-60b435db.patch
|
||||
|
||||
@ -60,6 +62,9 @@ install -d $RPM_BUILD_ROOT%{_var}/adm/fillup-templates
|
||||
install -d $RPM_BUILD_ROOT{%{_sbindir},%{_sysconfdir}/init.d}
|
||||
install -d $RPM_BUILD_ROOT/lib/udev/devices
|
||||
install -m 755 %{S:4} %{S:3} $RPM_BUILD_ROOT%{_sysconfdir}/init.d/
|
||||
install -d $RPM_BUILD_ROOT/lib/mkinitrd/scripts
|
||||
install -m 755 %{S:5} $RPM_BUILD_ROOT/lib/mkinitrd/scripts/setup-md.sh
|
||||
install -m 755 %{S:6} $RPM_BUILD_ROOT/lib/mkinitrd/scripts/boot-md.sh
|
||||
install -m 644 %{S:2} $RPM_BUILD_ROOT%{_var}/adm/fillup-templates/
|
||||
ln -sf ../../etc/init.d/mdadmd $RPM_BUILD_ROOT/%{_sbindir}/rcmdadmd
|
||||
|
||||
@ -118,8 +123,14 @@ rm -rf $RPM_BUILD_ROOT
|
||||
/lib/udev
|
||||
%{_sbindir}/*
|
||||
%{_var}/adm/fillup-templates/sysconfig.mdadm
|
||||
%dir /lib/mkinitrd
|
||||
%dir /lib/mkinitrd/scripts
|
||||
/lib/mkinitrd/scripts/setup-md.sh
|
||||
/lib/mkinitrd/scripts/boot-md.sh
|
||||
|
||||
%changelog
|
||||
* Wed Jul 23 2008 hare@suse.de
|
||||
- Include mkinitrd scriptlets.
|
||||
* Fri Jun 20 2008 mmarek@suse.cz
|
||||
- updated to 2.6.7 + fixes from git
|
||||
* Avoid segfault when parsing /proc/mdstat with auto-read-only
|
||||
|
67
mkinitrd-boot.sh
Normal file
67
mkinitrd-boot.sh
Normal file
@ -0,0 +1,67 @@
|
||||
#!/bin/bash
|
||||
#%stage: softraid
|
||||
#%programs: /sbin/mdadm
|
||||
#%modules: raid0 raid1 raid456
|
||||
#%if: -n "$need_mdadm"
|
||||
#
|
||||
##### MD (Software-)Raid
|
||||
##
|
||||
## This activates and waits for an MD software raid.
|
||||
##
|
||||
## Command line parameters
|
||||
## -----------------------
|
||||
##
|
||||
## need_mdadm=1 use MD raid
|
||||
## md_uuid the uuid of the raid to activate
|
||||
##
|
||||
|
||||
# load the necessary module before we initialize the raid system
|
||||
load_modules
|
||||
|
||||
[ "$mduuid" ] && md_uuid="$mduuid"
|
||||
|
||||
md_major=$(sed -ne 's/\s*\([0-9]\+\)\s*md$/\1/p' /proc/devices)
|
||||
if [ -n "$md_major" -a "$md_major" = "$maj" ]; then
|
||||
md_minor="$min"
|
||||
md_dev="/dev/md$md_minor"
|
||||
fi
|
||||
|
||||
# Always start md devices read/only. They will get set to rw as soon
|
||||
# as the first write occurs. This way we can guarantee that no
|
||||
# restore occurs before resume.
|
||||
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"
|
||||
fi
|
||||
|
||||
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
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ "$md_dev" ] ; then
|
||||
/sbin/mdadm $mdconf --auto=md $md_dev || /sbin/mdadm -Ac partitions $mdarg --auto=md $md_dev
|
||||
fi
|
||||
fi
|
||||
|
34
mkinitrd-setup.sh
Normal file
34
mkinitrd-setup.sh
Normal file
@ -0,0 +1,34 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
#%stage: softraid
|
||||
#
|
||||
mdblockdev=
|
||||
|
||||
for bd in $blockdev ; do
|
||||
# get information about the current blockdev
|
||||
update_blockdev $bd
|
||||
mdconf=$(mdadm -Db $bd 2> /dev/null | sed -n "s@/dev/md[0-9]*@/dev/md$blockminor@p")
|
||||
if [ -n "$mdconf" ] ; then
|
||||
md_tmpblockdev=$(mdadm -Dbv $bd 2> /dev/null | sed -n "1D;s/,/ /g;s/^ *devices=\(.*\)/\1/p")
|
||||
md_dev=${bd##/dev/}
|
||||
mdblockdev="$mdblockdev $md_tmpblockdev"
|
||||
eval md_conf_${md_dev}=\"$mdconf\"
|
||||
md_devs="$md_devs $md_dev"
|
||||
root_md=1
|
||||
else
|
||||
mdblockdev="$mdblockdev $bd"
|
||||
fi
|
||||
done
|
||||
|
||||
blockdev="$mdblockdev"
|
||||
|
||||
if [ -n "$root_md" ] ; then
|
||||
need_mdadm=1
|
||||
echo "DEVICE partitions" > $tmp_mnt/etc/mdadm.conf
|
||||
for md in $md_devs; do
|
||||
eval echo \$md_conf_$md >> $tmp_mnt/etc/mdadm.conf
|
||||
done
|
||||
fi
|
||||
|
||||
save_var need_mdadm
|
||||
save_var root_md
|
Loading…
Reference in New Issue
Block a user