summaryrefslogtreecommitdiff
path: root/core/mdadm
diff options
context:
space:
mode:
authorMichał Masłowski <mtjm@mtjm.eu>2012-05-06 11:43:14 +0200
committerMichał Masłowski <mtjm@mtjm.eu>2012-05-06 11:43:14 +0200
commit601a559448eb957ac98aca7a6e03de59e45fff91 (patch)
tree13fc71216622c3d764aa611b6a54e1918f21c496 /core/mdadm
parentc96a7351e1f295c1e311860dec19ac7b506b0c5c (diff)
parentf37e773fe397778858ea8d51601554863c252536 (diff)
Merge branch 'master' of ssh://parabolagnulinux.org:1863/home/parabola/abslibre-pre-mips64el
Conflicts: community/rtorrent/PKGBUILD core/libcap/PKGBUILD extra/samba/PKGBUILD extra/systemd/PKGBUILD extra/usbmuxd/PKGBUILD testing/glib2/PKGBUILD
Diffstat (limited to 'core/mdadm')
-rw-r--r--core/mdadm/PKGBUILD23
-rwxr-xr-xcore/mdadm/mdadm31
-rwxr-xr-xcore/mdadm/mdadm_hook65
-rw-r--r--core/mdadm/mdadm_udev_install25
4 files changed, 77 insertions, 67 deletions
diff --git a/core/mdadm/PKGBUILD b/core/mdadm/PKGBUILD
index d80e88886..b527ea833 100644
--- a/core/mdadm/PKGBUILD
+++ b/core/mdadm/PKGBUILD
@@ -1,9 +1,9 @@
-# $Id: PKGBUILD 157942 2012-04-30 07:17:54Z tpowa $
+# $Id: PKGBUILD 158626 2012-05-05 03:23:11Z dreisner $
# Maintainer: Tobias Powalowski <tpowa@archlinux.org>
# Contributor: Judd Vinet <jvinet@zeroflux.org>
pkgname=mdadm
pkgver=3.2.3
-pkgrel=2
+pkgrel=3
pkgdesc="A tool for managing/monitoring Linux md device arrays, also known as Software RAID"
arch=(i686 x86_64 'mips64el')
license=('GPL')
@@ -19,16 +19,7 @@ source=(ftp://ftp.kernel.org/pub/linux/utils/raid/mdadm/mdadm-$pkgver.tar.bz2
mdadm_hook
mdadm_udev_install
disable-werror.patch)
-
-install=mdadm.install
replaces=('raidtools')
-md5sums=('d789d6ecb9c1d5ebcc64f0fc52bca92f'
- '6df172c8f77b280018cf87eb3d313f29'
- '00cbed931db4f15b6ce49e3e7d433966'
- '9b01e96b6c3c218fb61628c9281fe688'
- 'c8c0713f5c7da51822ee6f3911473a1c'
- 'cd258e1bf430c02a25f40b4329df9f57'
- '4ad87b74a4bc9a34621280abe0e0c3e4')
build() {
cd $srcdir/$pkgname-$pkgver
@@ -50,4 +41,14 @@ package() {
install -D -m644 ../mdadm_udev_install $pkgdir/usr/lib/initcpio/install/mdadm_udev
# symlink for backward compatibility
ln -sf /usr/lib/initcpio/hooks/mdadm $pkgdir/usr/lib/initcpio/hooks/raid
+ # move /lib/* to /usr/lib/
+ mv $pkgdir/lib/udev $pkgdir/usr/lib/
+ rm -rf $pkgdir/lib
}
+md5sums=('d789d6ecb9c1d5ebcc64f0fc52bca92f'
+ '8333d405f550317c2bacd5510bf1cb60'
+ '00cbed931db4f15b6ce49e3e7d433966'
+ '9b01e96b6c3c218fb61628c9281fe688'
+ 'fbb5542d9bdf87441a11dd7e7a0a17f8'
+ '2318b99701dba9b01a6891c62be7bc1c'
+ '4ad87b74a4bc9a34621280abe0e0c3e4')
diff --git a/core/mdadm/mdadm b/core/mdadm/mdadm
index e196f3642..9bf468e98 100755
--- a/core/mdadm/mdadm
+++ b/core/mdadm/mdadm
@@ -3,28 +3,33 @@
. /etc/rc.conf
. /etc/rc.d/functions
-PID=`pidof -o %PPID /sbin/mdadm`
-case "$1" in
+pidfile=/run/mdadm.pid
+if [[ -r $pidfile ]]; then
+ read -r PID <"$pidfile"
+ if [[ $PID && ! -d /proc/$PID ]]; then
+ # stale pidfile
+ unset PID
+ rm -f "$pidfile"
+ fi
+fi
+
+case $1 in
start)
stat_busy "Starting mdadm RAID Monitor"
- if [ -z "$PID" ]; then
- /sbin/mdadm --monitor --scan -i /var/run/mdadm.pid -f
- fi
- if [ ! -z "$PID" -o $? -gt 0 ]; then
- stat_fail
- else
+ if [[ -z $PID ]] && mdadm --monitor --scan -i "$pidfile" -f; then
add_daemon mdadm
stat_done
+ else
+ stat_fail
fi
;;
stop)
stat_busy "Stopping mdadm RAID Monitor"
- [ ! -z "$PID" ] && kill $PID &>/dev/null
- if [ $? -gt 0 ]; then
- stat_fail
- else
+ if [[ $PID ]] && kill "$PID" &>/dev/null; then
rm_daemon mdadm
stat_done
+ else
+ stat_fail
fi
;;
restart)
@@ -33,5 +38,5 @@ case "$1" in
$0 start
;;
*)
- echo "usage: $0 {start|stop|restart}"
+ echo "usage: $0 {start|stop|restart}"
esac
diff --git a/core/mdadm/mdadm_hook b/core/mdadm/mdadm_hook
index 7b2dc1ad1..787be5d0c 100755
--- a/core/mdadm/mdadm_hook
+++ b/core/mdadm/mdadm_hook
@@ -1,44 +1,49 @@
-# vim: set ft=sh:
-run_hook ()
-{
- input="$(cat /proc/cmdline)"
- mdconfig="/etc/mdadm.conf"
+#!/usr/bin/ash
+
+run_hook() {
+ local i= 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
+
+ if [ -n "$md" ]; then
+ echo 'DEVICE partitions' >"$mdconfig"
+ for i in $(cat /proc/cmdline); do
case $i in
- # raid
+ # 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
+ device=${i%%,*}
+ device=${device/=/}
+ array=${i#*,}
+ echo "ARRAY /dev/$device devices=$array"
;;
# 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
+ device=${i%%,*}
+ device=${device/=/_}
+ array=${i#*,}
+ echo "ARRAY /dev/$device devices=$array"
;;
- # 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
+ # raid UUID
+ md=[0-9]*,[0-9,a-fA-F]*)
+ device=${i%%,*}
+ device=${device/=/}
+ array=${i#*,}
+ echo "ARRAY /dev/$device UUID=$array"
;;
# 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
+ md=d[0-9]*,[0-9,a-fA-F]*)
+ device=${i%%,*}
+ device=${device/=/_}
+ array=${i#*,}
+ echo "ARRAY /dev/$device UUID=$array"
;;
- esac
- done
+ esac
+ done >>"$mdconfig"
fi
+
# assemble everything
- [ -e $mdconfig ] && /sbin/mdassemble
+ [ -s "$mdconfig" ] && /sbin/mdassemble
}
+
+# vim: set ft=sh ts=4 sw=4 et:
diff --git a/core/mdadm/mdadm_udev_install b/core/mdadm/mdadm_udev_install
index 9fc161624..be653fc74 100644
--- a/core/mdadm/mdadm_udev_install
+++ b/core/mdadm/mdadm_udev_install
@@ -1,23 +1,22 @@
-# vim: set ft=sh:
+#!/bin/bash
+
+build() {
+ MODULES=" $(checked_modules "drivers/md/*" | grep -v "dm-")"
-build()
-{
- MODULES=" $(checked_modules "drivers/md/*" | grep -v "dm-") "
- BINARIES=""
- FILES=""
- SCRIPT=""
# check if a custom mdadm.conf exists
- if grep -q ^ARRAY /etc/mdadm.conf; then
+ if grep -qw ^ARRAY "$BASEDIR/etc/mdadm.conf"; then
echo "Custom /etc/mdadm.conf file will be used in initramfs for assembling arrays."
add_file "/etc/mdadm.conf"
fi
- add_binary "/sbin/mdadm"
- add_file "/lib/udev/rules.d/64-md-raid.rules"
+
+ add_binary "mdadm"
+ add_file "/usr/lib/udev/rules.d/64-md-raid.rules"
}
-help ()
-{
-cat<<HELPEOF
+help() {
+ cat <<HELPEOF
This hook loads raid arrays with udev.
HELPEOF
}
+
+# vim: set ft=sh ts=4 sw=4 et: