diff options
author | Michael Hanson <hansonorders@verizon.net> | 2010-11-24 02:53:27 (GMT) |
---|---|---|
committer | Michael Hanson <hansonorders@verizon.net> | 2010-11-24 02:53:27 (GMT) |
commit | eb64f8a36a7ce7572bac1fb5a6ec17e08bb9a5e5 (patch) | |
tree | 14fbe26d73dabe2b333e187af28463687a824382 /abs/core/mdadm/mdadm_hook | |
parent | 66d9054984063e6c34f034b135bf8153e0e8b431 (diff) | |
download | linhes_pkgbuild-eb64f8a36a7ce7572bac1fb5a6ec17e08bb9a5e5.zip linhes_pkgbuild-eb64f8a36a7ce7572bac1fb5a6ec17e08bb9a5e5.tar.gz linhes_pkgbuild-eb64f8a36a7ce7572bac1fb5a6ec17e08bb9a5e5.tar.bz2 |
mdadm: upgrade
Diffstat (limited to 'abs/core/mdadm/mdadm_hook')
-rwxr-xr-x | abs/core/mdadm/mdadm_hook | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/abs/core/mdadm/mdadm_hook b/abs/core/mdadm/mdadm_hook new file mode 100755 index 0000000..57799d3 --- /dev/null +++ b/abs/core/mdadm/mdadm_hook @@ -0,0 +1,44 @@ +# vim: set ft=sh: +run_hook () +{ + input="$(cat /proc/cmdline)" + mdconfig="/etc/mdadm.conf" + # for partitionable raid, we need to load md_mod first! + modprobe md_mod 2>/dev/null + # If md is specified on commandline, create config file from those parameters. + if [ "$(echo $input | grep "md=")" ]; then + #Create initial mdadm.conf + # scan all devices in /proc/partitions + echo DEVICE partitions > $mdconfig + for i in $input; do + case $i in + # raid + md=[0-9]*,/*) + device="$(echo "$i" | sed -e 's|,/.*||g' -e 's|=||g')" + array="$(echo $i | cut -d, -f2-)" + echo "ARRAY /dev/$device devices=$array" >> $mdconfig + ;; + # partitionable raid + md=d[0-9]*,/*) + device="$(echo "$i" | sed -e 's|,/.*||g' -e 's|=|_|g')" + array="$(echo $i | cut -d, -f2-)" + echo "ARRAY /dev/$device devices=$array" >> $mdconfig + ;; + # raid UUID + md=[0-9]*,[0-9,a-z]*) + device="$(echo "$i" | sed -e 's|,.*||g' -e 's|=||g')" + array="$(echo $i | cut -d, -f2-)" + echo "ARRAY /dev/$device UUID=$array" >> $mdconfig + ;; + # partitionable raid UUID + md=d[0-9]*,[0-9,a-z]*) + device="$(echo "$i" | sed -e 's|,.*||g' -e 's|=|_|g')" + array="$(echo $i | cut -d, -f2-)" + echo "ARRAY /dev/$device UUID=$array" >> $mdconfig + ;; + esac + done + fi + # assemble everything + [ -e $mdconfig ] && /sbin/mdassemble +}
\ No newline at end of file |