summaryrefslogtreecommitdiffstats
path: root/abs/core/mdadm
diff options
context:
space:
mode:
Diffstat (limited to 'abs/core/mdadm')
-rw-r--r--abs/core/mdadm/PKGBUILD60
-rw-r--r--abs/core/mdadm/__changelog2
-rw-r--r--abs/core/mdadm/finish17
-rwxr-xr-xabs/core/mdadm/mdadm37
-rw-r--r--abs/core/mdadm/mdadm.conf5
-rw-r--r--abs/core/mdadm/mdadm.install19
-rwxr-xr-xabs/core/mdadm/mdadm_hook44
-rw-r--r--abs/core/mdadm/mdadm_install46
-rw-r--r--abs/core/mdadm/run10
9 files changed, 218 insertions, 22 deletions
diff --git a/abs/core/mdadm/PKGBUILD b/abs/core/mdadm/PKGBUILD
index 22ecc25..a491dce 100644
--- a/abs/core/mdadm/PKGBUILD
+++ b/abs/core/mdadm/PKGBUILD
@@ -1,33 +1,51 @@
-# $Id: PKGBUILD 356 2008-04-18 22:56:27Z aaron $
-# Maintainer: Judd Vinet <jvinet@zeroflux.org>
+# $Id: PKGBUILD 89445 2010-09-01 06:46:31Z tpowa $
+# Maintainer: Tobias Powalowski <tpowa@archlinux.org>
+# Contributor: Judd Vinet <jvinet@zeroflux.org>
pkgname=mdadm
-pkgver=3.1.2
-pkgrel=2
+pkgver=3.1.4
+pkgrel=1
pkgdesc="A tool for managing/monitoring Linux md device arrays, also known as Software RAID"
-arch=(i686 x86_64)
+arch=('i686' 'x86_64')
license=('GPL')
url="http://www.cse.unsw.edu.au/~neilb/source/mdadm/"
groups=('base')
+conflicts=('mkinitcpio<0.5.99')
depends=('glibc')
backup=('etc/mdadm.conf')
-conflicts=('udev<135-4')
-source=(ftp://ftp.kernel.org/pub/linux/utils/raid/mdadm/$pkgname-$pkgver.tar.bz2 \
- mdadm.conf raid-partitions_install raid-partitions_hook)
+source=(ftp://ftp.kernel.org/pub/linux/utils/raid/mdadm/mdadm-$pkgver.tar.bz2
+ mdadm
+ mdadm.conf
+ mdadm_install
+ mdadm_hook
+ run
+ finish)
+install=mdadm.install
replaces=('raidtools')
build() {
- cd $startdir/src/$pkgname-$pkgver
+ cd $srcdir/$pkgname-$pkgver
make || return 1
- make INSTALL=/bin/install DESTDIR=$startdir/pkg install
- install -D -m644 ../mdadm.conf $startdir/pkg/etc/mdadm.conf
- install -D -m644 ../raid-partitions_install $startdir/pkg/lib/initcpio/install/raid-partitions
- install -D -m644 ../raid-partitions_hook $startdir/pkg/lib/initcpio/hooks/raid-partitions
- # a static binary is required for Arch's initrd
- rm mdadm
- make LDFLAGS+=-static || return 1
- install -D -m755 mdadm $startdir/pkg/sbin/mdadm.static
}
-md5sums=('c5a39f38c465229767a5af2a4eb81bef'
- '0ce4c0f9770bf582a71228053566359d'
- '9de7e423ec9c6766b5f5d39915929003'
- '09d72c714b40b6fa1e8eab04c1dabd42')
+package() {
+ cd $srcdir/$pkgname-$pkgver
+ make INSTALL=/bin/install DESTDIR=$pkgdir install
+ install -D -m644 ../mdadm.conf $pkgdir/etc/mdadm.conf
+ install -D -m755 ../mdadm $pkgdir/etc/rc.d/mdadm
+ install -D -m644 ../mdadm_install $pkgdir/lib/initcpio/install/mdadm
+ install -D -m644 ../mdadm_hook $pkgdir/lib/initcpio/hooks/mdadm
+ install -d ${pkgdir}/etc/sv/mdadm/supervise
+ install -D -m755 ${srcdir}/run ${pkgdir}/etc/sv/mdadm/run
+ install -D -m755 ${srcdir}/finish ${pkgdir}/etc/sv/mdadm/finish
+ # symlink for backward compatibility
+ ln -sf /lib/initcpio/hooks/mdadm $pkgdir/lib/initcpio/hooks/raid
+ # build static mdassemble for Arch's initramfs
+ make MDASSEMBLE_AUTO=1 mdassemble
+ install -D -m755 mdassemble $pkgdir/sbin/mdassemble
+}
+md5sums=('0e7dcb5cc4192ae3abd9956bac475576'
+ '6df172c8f77b280018cf87eb3d313f29'
+ '00cbed931db4f15b6ce49e3e7d433966'
+ '865c3d39e5f5dae58388160b563981f1'
+ '1a3eb63832cecd6550f5b0a21d58cfdb'
+ '0b12cc70819ec274f6eec0b8a4238970'
+ 'fbd58f9753db94e754bd8de71d465489')
diff --git a/abs/core/mdadm/__changelog b/abs/core/mdadm/__changelog
new file mode 100644
index 0000000..aaebdd9
--- /dev/null
+++ b/abs/core/mdadm/__changelog
@@ -0,0 +1,2 @@
+add and add logic to install run and finish scripts to PKGBUILD
+add logic to mdadm.install to add and remove the mdadm monitoring service
diff --git a/abs/core/mdadm/finish b/abs/core/mdadm/finish
new file mode 100644
index 0000000..5c94528
--- /dev/null
+++ b/abs/core/mdadm/finish
@@ -0,0 +1,17 @@
+#!/bin/bash
+#
+# Stop Monitoring software raid arrays
+exec 2>&1
+export TERM=linux
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PID=`pidof -o %PPID /sbin/mdadm`
+ stat_runit "Stopping mdadm RAID Monitor"
+ [ ! -z "$PID" ] && kill $PID &>/dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon mdadm
+ stat_done
+ fi
diff --git a/abs/core/mdadm/mdadm b/abs/core/mdadm/mdadm
new file mode 100755
index 0000000..e196f36
--- /dev/null
+++ b/abs/core/mdadm/mdadm
@@ -0,0 +1,37 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PID=`pidof -o %PPID /sbin/mdadm`
+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
+ add_daemon mdadm
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping mdadm RAID Monitor"
+ [ ! -z "$PID" ] && kill $PID &>/dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon mdadm
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
diff --git a/abs/core/mdadm/mdadm.conf b/abs/core/mdadm/mdadm.conf
index 0b2c712..57bd4c6 100644
--- a/abs/core/mdadm/mdadm.conf
+++ b/abs/core/mdadm/mdadm.conf
@@ -40,8 +40,11 @@ DEVICE partitions
#
# mdadm -D <md>
#
-# To capture the UUIDs for all your RAID arrays to this file, run this:
+# To capture the UUIDs for all your RAID arrays to this file, run these:
+# to get a list of running arrays:
# # mdadm -D --scan >>/etc/mdadm.conf
+# to get a list from superblocks:
+# # mdadm -E --scan >>/etc/mdadm.conf
#
#ARRAY /dev/md0 UUID=3aaa0122:29827cfa:5331ad66:ca767371
#ARRAY /dev/md1 super-minor=1
diff --git a/abs/core/mdadm/mdadm.install b/abs/core/mdadm/mdadm.install
new file mode 100644
index 0000000..cfeed3c
--- /dev/null
+++ b/abs/core/mdadm/mdadm.install
@@ -0,0 +1,19 @@
+# arg 1: the new package version
+# arg 2: the old package version
+post_install() {
+ # Add the mdadm monitoring service
+ /sbin/add_service.sh mdadm
+}
+
+post_upgrade() {
+ if [ "$(vercmp $2 2.6.8-2)" -lt 0 -a "$(grep raid_partitions /etc/mkinitcpio.conf)" ]; then
+ echo "Attention mdadm update:"
+ echo "raid_partitions hook has been replaced by the more powerfull mdadm hook."
+ echo "Please update your /etc/mkinitcpio.conf accordingly."
+ fi
+}
+
+pre_remove() {
+ # Remove the mdadm monitoring service
+ /sbin/remove_service.sh mdadm
+}
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
diff --git a/abs/core/mdadm/mdadm_install b/abs/core/mdadm/mdadm_install
new file mode 100644
index 0000000..b7a57ea
--- /dev/null
+++ b/abs/core/mdadm/mdadm_install
@@ -0,0 +1,46 @@
+# vim: set ft=sh:
+
+install ()
+{
+ MODULES=" $(checked_modules "drivers/md/*" | grep -v "dm-") "
+ BINARIES=""
+ FILES=""
+ SCRIPT="mdadm"
+ # check if a custom mdadm.conf exists
+ if grep -q ^ARRAY /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/mdassemble"
+ add_file "/lib/udev/rules.d/64-md-raid.rules"
+}
+
+help ()
+{
+cat<<HELPEOF
+ This hook loads the necessary modules for any raid root device,
+ and assembles the raid device when run.
+
+ If arrays are defined in /etc/mdadm.conf, the file will be used instead
+ of command line assembling.
+
+ Command Line Setup:
+ - for raid arrays with persistent superblocks:
+ md=<md device no.>,dev0,dev1,...,devn
+ md=<md device no.>,uuid
+ - for partitionable raid arrays with persistent superblocks:
+ md=d<md device no.>,dev0,dev1,...,devn
+ md=d<md device no.>,uuid
+
+ Parameters:
+ - <md device no.> = the number of the md device:
+ 0 means md0, 1 means md1, ...
+ - <dev0-devn>: e.g. /dev/hda1,/dev/hdc1,/dev/sda1,/dev/sdb1
+ or 0900878d:f95f6057:c39a36e9:55efa60a
+ Examples:
+ - md=d0,/dev/sda3,/dev/sda4 md=d1,/dev/hda1,/dev/hdb1
+ This will setup 2 md partitionable arrays.
+ - md=0,/dev/sda3,/dev/sda4 md=1,/dev/hda1,/dev/hdb1
+ This will setup 2 md arrays with persistent superblocks.
+HELPEOF
+}
diff --git a/abs/core/mdadm/run b/abs/core/mdadm/run
new file mode 100644
index 0000000..567332e
--- /dev/null
+++ b/abs/core/mdadm/run
@@ -0,0 +1,10 @@
+#!/bin/bash
+#
+# Start Monitoring software raid arrays
+exec 2>&1
+export TERM=linux
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+ stat_runit "Starting mdadm RAID Monitor"
+ exec /sbin/mdadm -F -s