summaryrefslogtreecommitdiffstats
path: root/abs/core-testing/mdadm
diff options
context:
space:
mode:
authorJames Meyer <James.meyer@operamail.com>2008-10-02 03:19:12 (GMT)
committerJames Meyer <James.meyer@operamail.com>2008-10-02 03:19:12 (GMT)
commit0e2532d4e8f4eed5e047f1db54d5c03ba849ec0a (patch)
treec0aa2c0b53c317be87eacfcb77b63f53f1f415e7 /abs/core-testing/mdadm
downloadlinhes_pkgbuild-0e2532d4e8f4eed5e047f1db54d5c03ba849ec0a.zip
linhes_pkgbuild-0e2532d4e8f4eed5e047f1db54d5c03ba849ec0a.tar.gz
linhes_pkgbuild-0e2532d4e8f4eed5e047f1db54d5c03ba849ec0a.tar.bz2
initial import
Diffstat (limited to 'abs/core-testing/mdadm')
-rw-r--r--abs/core-testing/mdadm/PKGBUILD34
-rwxr-xr-xabs/core-testing/mdadm/mdadm37
-rw-r--r--abs/core-testing/mdadm/mdadm-2.2-segfault.patch12
-rw-r--r--abs/core-testing/mdadm/mdadm.conf64
-rw-r--r--abs/core-testing/mdadm/raid-partitions_hook21
-rw-r--r--abs/core-testing/mdadm/raid-partitions_install32
6 files changed, 200 insertions, 0 deletions
diff --git a/abs/core-testing/mdadm/PKGBUILD b/abs/core-testing/mdadm/PKGBUILD
new file mode 100644
index 0000000..13c5c98
--- /dev/null
+++ b/abs/core-testing/mdadm/PKGBUILD
@@ -0,0 +1,34 @@
+# $Id: PKGBUILD 356 2008-04-18 22:56:27Z aaron $
+# Maintainer: Judd Vinet <jvinet@zeroflux.org>
+pkgname=mdadm
+pkgver=2.6.4
+pkgrel=10
+pkgdesc="A tool for managing/monitoring Linux md device arrays, also known as Software RAID"
+arch=(i686 x86_64)
+license=('GPL')
+url="http://www.cse.unsw.edu.au/~neilb/source/mdadm/"
+groups=('base')
+depends=('glibc')
+backup=('etc/mdadm.conf')
+source=(ftp://ftp.kernel.org/pub/linux/utils/raid/mdadm/mdadm-$pkgver.tar.bz2 \
+ mdadm mdadm.conf raid-partitions_install raid-partitions_hook)
+replaces=('raidtools')
+md5sums=('b616697aecc870d5d580bd6e010472a3'
+ '6df172c8f77b280018cf87eb3d313f29'
+ '0ce4c0f9770bf582a71228053566359d'
+ '9de7e423ec9c6766b5f5d39915929003'
+ '09d72c714b40b6fa1e8eab04c1dabd42')
+
+build() {
+ cd $startdir/src/$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 -m755 ../mdadm $startdir/pkg/etc/rc.d/mdadm
+ 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
+}
diff --git a/abs/core-testing/mdadm/mdadm b/abs/core-testing/mdadm/mdadm
new file mode 100755
index 0000000..e196f36
--- /dev/null
+++ b/abs/core-testing/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-testing/mdadm/mdadm-2.2-segfault.patch b/abs/core-testing/mdadm/mdadm-2.2-segfault.patch
new file mode 100644
index 0000000..d956a20
--- /dev/null
+++ b/abs/core-testing/mdadm/mdadm-2.2-segfault.patch
@@ -0,0 +1,12 @@
+diff -Naur mdadm-2.2-orig/Assemble.c mdadm-2.2/Assemble.c
+--- mdadm-2.2-orig/Assemble.c 2005-12-04 21:56:20.000000000 -0800
++++ mdadm-2.2/Assemble.c 2006-02-06 10:56:37.000000000 -0800
+@@ -219,7 +219,7 @@
+ }
+ if (dfd >= 0) close(dfd);
+
+- if (ident->uuid_set && (!update && strcmp(update, "uuid")!= 0) &&
++ if (ident->uuid_set && (!update || strcmp(update, "uuid")!= 0) &&
+ (!super || same_uuid(info.uuid, ident->uuid, tst->ss->swapuuid)==0)) {
+ if ((inargv && verbose >= 0) || verbose > 0)
+ fprintf(stderr, Name ": %s has wrong uuid.\n",
diff --git a/abs/core-testing/mdadm/mdadm.conf b/abs/core-testing/mdadm/mdadm.conf
new file mode 100644
index 0000000..0b2c712
--- /dev/null
+++ b/abs/core-testing/mdadm/mdadm.conf
@@ -0,0 +1,64 @@
+# mdadm configuration file
+#
+# mdadm will function properly without the use of a configuration file,
+# but this file is useful for keeping track of arrays and member disks.
+# In general, a mdadm.conf file is created, and updated, after arrays
+# are created. This is the opposite behavior of /etc/raidtab which is
+# created prior to array construction.
+#
+#
+# the config file takes two types of lines:
+#
+# DEVICE lines specify a list of devices of where to look for
+# potential member disks
+#
+# ARRAY lines specify information about how to identify arrays so
+# so that they can be activated
+#
+
+
+# You can have more than one device line and use wild cards. The first
+# example includes SCSI the first partition of SCSI disks /dev/sdb,
+# /dev/sdc, /dev/sdd, /dev/sdj, /dev/sdk, and /dev/sdl. The second
+# line looks for array slices on IDE disks.
+#
+#DEVICE /dev/sd[bcdjkl]1
+#DEVICE /dev/hda1 /dev/hdb1
+#
+# The designation "partitions" will scan all partitions found in
+# /proc/partitions
+DEVICE partitions
+
+
+# ARRAY lines specify an array to assemble and a method of identification.
+# Arrays can currently be identified by using a UUID, superblock minor number,
+# or a listing of devices.
+#
+# super-minor is usually the minor number of the metadevice
+# UUID is the Universally Unique Identifier for the array
+# Each can be obtained using
+#
+# mdadm -D <md>
+#
+# To capture the UUIDs for all your RAID arrays to this file, run this:
+# # mdadm -D --scan >>/etc/mdadm.conf
+#
+#ARRAY /dev/md0 UUID=3aaa0122:29827cfa:5331ad66:ca767371
+#ARRAY /dev/md1 super-minor=1
+#ARRAY /dev/md2 devices=/dev/hda1,/dev/hdb1
+#
+# ARRAY lines can also specify a "spare-group" for each array. mdadm --monitor
+# will then move a spare between arrays in a spare-group if one array has a
+# failed drive but no spare
+#ARRAY /dev/md4 uuid=b23f3c6d:aec43a9f:fd65db85:369432df spare-group=group1
+#ARRAY /dev/md5 uuid=19464854:03f71b1b:e0df2edd:246cc977 spare-group=group1
+#
+
+
+# When used in --follow (aka --monitor) mode, mdadm needs a
+# mail address and/or a program. To start mdadm's monitor mode, add
+# "mdadm" to your DAEMONS array in /etc/rc.conf
+#
+# If the lines are not found, mdadm will exit quietly
+#MAILADDR root@mydomain.tld
+#PROGRAM /usr/sbin/handle-mdadm-events
diff --git a/abs/core-testing/mdadm/raid-partitions_hook b/abs/core-testing/mdadm/raid-partitions_hook
new file mode 100644
index 0000000..bed1cb2
--- /dev/null
+++ b/abs/core-testing/mdadm/raid-partitions_hook
@@ -0,0 +1,21 @@
+# vim: set ft=sh:
+run_hook ()
+{
+ #TODO scan for these somehow...
+ /sbin/modprobe -aq linear multipath raid0 raid1 raid456 raid10>/dev/null 2>&1
+ # md= can be specified multiple times. The simplistic commandline
+ # parsing does not handle this, so we will let mdassemble parse it
+ for i in $(replace $(echo $md) ',' ' '); do
+ case $i in d[0-9])
+ for i in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15; do
+ /sbin/mdadm --create -a mdp /dev/md_d$i >/dev/null 2>&1
+ done
+ mdadm --assemble --auto=mdp /dev/md_$(replace $(echo $md) ',' ' ')
+ export USE_RAID_ARRAY=1
+ ;;
+ esac
+ done
+ if ! [ "$USE_RAID_ARRAY" = "1" ] ; then
+ /bin/mdassemble ${CMDLINE}
+ fi
+}
diff --git a/abs/core-testing/mdadm/raid-partitions_install b/abs/core-testing/mdadm/raid-partitions_install
new file mode 100644
index 0000000..8fe5184
--- /dev/null
+++ b/abs/core-testing/mdadm/raid-partitions_install
@@ -0,0 +1,32 @@
+# vim: set ft=sh:
+
+install ()
+{
+ MODULES=" $(checked_modules "drivers/md/*" | grep -v "dm-") "
+ BINARIES="mdadm"
+ FILES=""
+ SCRIPT="raid-partitions"
+ add_file "/usr/lib/klibc/bin/mdassemble" "/bin/mdassemble"
+}
+
+help ()
+{
+cat<<HELPEOF
+ This hook loads the necessary modules for an raid mdp/partitionable root device,
+ and assemble the raid device when run.
+
+ Kernel Parameters:
+ Specify all your md arrays with md= parameter:
+ ::: Example ::: md=d0,/dev/sda3,/dev/sda4 md=d1,/dev/hda1,/dev/hdb1
+ This will setup 2 md partitionable arrays
+
+ Setup:
+ - to assemble a partitionable array:
+ md=d<md device no.>,dev0,dev1,...,devn
+
+ 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
+HELPEOF
+}