diff options
author | James Meyer <james.meyer@operamail.com> | 2012-08-07 17:36:10 (GMT) |
---|---|---|
committer | James Meyer <james.meyer@operamail.com> | 2012-08-07 17:36:10 (GMT) |
commit | 9bf6461124e215b2cbff57dd0f514dac5dfc0174 (patch) | |
tree | 214ec9084a8122b167d316c49f34072d25c3a008 /abs/core | |
parent | d959d709bde5168e9d8bbfba7affd622ced1e6b4 (diff) | |
download | linhes_pkgbuild-9bf6461124e215b2cbff57dd0f514dac5dfc0174.zip linhes_pkgbuild-9bf6461124e215b2cbff57dd0f514dac5dfc0174.tar.gz linhes_pkgbuild-9bf6461124e215b2cbff57dd0f514dac5dfc0174.tar.bz2 |
mdadm 3.2.5
Diffstat (limited to 'abs/core')
-rw-r--r-- | abs/core/mdadm/PKGBUILD | 61 | ||||
-rw-r--r-- | abs/core/mdadm/__changelog | 2 | ||||
-rw-r--r-- | abs/core/mdadm/disable-werror.patch | 11 | ||||
-rw-r--r-- | abs/core/mdadm/finish | 17 | ||||
-rw-r--r-- | abs/core/mdadm/linux-3.0.patch | 45 | ||||
-rwxr-xr-x | abs/core/mdadm/mdadm | 31 | ||||
-rw-r--r-- | abs/core/mdadm/mdadm.install | 19 | ||||
-rw-r--r-- | abs/core/mdadm/mdadm.service | 8 | ||||
-rwxr-xr-x | abs/core/mdadm/mdadm_hook | 67 | ||||
-rw-r--r-- | abs/core/mdadm/mdadm_install | 71 | ||||
-rw-r--r-- | abs/core/mdadm/mdadm_udev_install | 24 | ||||
-rw-r--r-- | abs/core/mdadm/run | 10 |
12 files changed, 211 insertions, 155 deletions
diff --git a/abs/core/mdadm/PKGBUILD b/abs/core/mdadm/PKGBUILD index a491dce..3c905ac 100644 --- a/abs/core/mdadm/PKGBUILD +++ b/abs/core/mdadm/PKGBUILD @@ -1,15 +1,15 @@ -# $Id: PKGBUILD 89445 2010-09-01 06:46:31Z tpowa $ +# $Id: PKGBUILD 160025 2012-05-28 10:25:39Z tpowa $ # Maintainer: Tobias Powalowski <tpowa@archlinux.org> # Contributor: Judd Vinet <jvinet@zeroflux.org> pkgname=mdadm -pkgver=3.1.4 -pkgrel=1 +pkgver=3.2.5 +pkgrel=2 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/" +url="http://neil.brown.name/blog/mdadm" groups=('base') -conflicts=('mkinitcpio<0.5.99') +conflicts=('mkinitcpio<0.7') depends=('glibc') backup=('etc/mdadm.conf') source=(ftp://ftp.kernel.org/pub/linux/utils/raid/mdadm/mdadm-$pkgver.tar.bz2 @@ -17,35 +17,42 @@ source=(ftp://ftp.kernel.org/pub/linux/utils/raid/mdadm/mdadm-$pkgver.tar.bz2 mdadm.conf mdadm_install mdadm_hook - run - finish) -install=mdadm.install + mdadm_udev_install + mdadm.service + disable-werror.patch) replaces=('raidtools') +md5sums=('83ba4a6249ae24677e915e44c9cfcc58' + '8333d405f550317c2bacd5510bf1cb60' + '00cbed931db4f15b6ce49e3e7d433966' + '609d10888727710cb20db7ac3e096116' + 'fbb5542d9bdf87441a11dd7e7a0a17f8' + 'd1d8e9eb81ce9347de74f3c84a9db09e' + 'aafb5f9ac8437a284cbf948b9b13b179' + '4ad87b74a4bc9a34621280abe0e0c3e4') build() { cd $srcdir/$pkgname-$pkgver - make || return 1 + patch -Np0 -i ../disable-werror.patch + make CXFLAGS="$CFLAGS" + # build static mdassemble for Arch's initramfs + make MDASSEMBLE_AUTO=1 mdassemble + } + package() { cd $srcdir/$pkgname-$pkgver - make INSTALL=/bin/install DESTDIR=$pkgdir install + make INSTALL=/usr/bin/install DESTDIR=$pkgdir install + install -D -m755 mdassemble $pkgdir/sbin/mdassemble 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 + install -D -m644 ../mdadm_install $pkgdir/usr/lib/initcpio/install/mdadm + install -D -m644 ../mdadm_hook $pkgdir/usr/lib/initcpio/hooks/mdadm + install -D -m644 ../mdadm_udev_install $pkgdir/usr/lib/initcpio/install/mdadm_udev # 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 + 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 + # systemd service file + install -D -m644 $srcdir/mdadm.service $pkgdir/usr/lib/systemd/system/mdadm.service } -md5sums=('0e7dcb5cc4192ae3abd9956bac475576' - '6df172c8f77b280018cf87eb3d313f29' - '00cbed931db4f15b6ce49e3e7d433966' - '865c3d39e5f5dae58388160b563981f1' - '1a3eb63832cecd6550f5b0a21d58cfdb' - '0b12cc70819ec274f6eec0b8a4238970' - 'fbd58f9753db94e754bd8de71d465489') diff --git a/abs/core/mdadm/__changelog b/abs/core/mdadm/__changelog deleted file mode 100644 index aaebdd9..0000000 --- a/abs/core/mdadm/__changelog +++ /dev/null @@ -1,2 +0,0 @@ -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/disable-werror.patch b/abs/core/mdadm/disable-werror.patch new file mode 100644 index 0000000..50a33f1 --- /dev/null +++ b/abs/core/mdadm/disable-werror.patch @@ -0,0 +1,11 @@ +--- Makefile.old 2011-06-17 09:38:03.269238332 +0200 ++++ Makefile 2011-06-17 09:38:14.122398837 +0200 +@@ -42,7 +42,7 @@ + + CC = $(CROSS_COMPILE)gcc + CXFLAGS = -ggdb +-CWFLAGS = -Wall -Werror -Wstrict-prototypes -Wextra -Wno-unused-parameter ++CWFLAGS = -Wall -Wstrict-prototypes -Wextra -Wno-unused-parameter + ifdef WARN_UNUSED + CWFLAGS += -Wp,-D_FORTIFY_SOURCE=2 -O + endif diff --git a/abs/core/mdadm/finish b/abs/core/mdadm/finish deleted file mode 100644 index 5c94528..0000000 --- a/abs/core/mdadm/finish +++ /dev/null @@ -1,17 +0,0 @@ -#!/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/linux-3.0.patch b/abs/core/mdadm/linux-3.0.patch new file mode 100644 index 0000000..cd9d547 --- /dev/null +++ b/abs/core/mdadm/linux-3.0.patch @@ -0,0 +1,45 @@ +From f161d047eed634b3380262767f955eb888502e88 Mon Sep 17 00:00:00 2001 +From: NeilBrown <neilb@suse.de> +Date: Fri, 17 Jun 2011 22:49:24 +1000 +Subject: [PATCH 1/1] util: correctly parse shorter linux version numbers. + +The next version of Linux might be 3.0. If it is, get_linux_version +will fail. +So make it more robust. + +Reported-by: Namhyung Kim <namhyung@gmail.com> +Reported-by: Milan Broz <mbroz@redhat.com> +Signed-off-by: NeilBrown <neilb@suse.de> +--- + util.c | 10 +++++----- + 1 files changed, 5 insertions(+), 5 deletions(-) + +diff --git a/util.c b/util.c +index 10bbe56..55d171a 100644 +--- a/util.c ++++ b/util.c +@@ -146,16 +146,16 @@ int get_linux_version() + { + struct utsname name; + char *cp; +- int a,b,c; ++ int a = 0, b = 0,c = 0; + if (uname(&name) <0) + return -1; + + cp = name.release; + a = strtoul(cp, &cp, 10); +- if (*cp != '.') return -1; +- b = strtoul(cp+1, &cp, 10); +- if (*cp != '.') return -1; +- c = strtoul(cp+1, NULL, 10); ++ if (*cp == '.') ++ b = strtoul(cp+1, &cp, 10); ++ if (*cp == '.') ++ c = strtoul(cp+1, &cp, 10); + + return (a*1000000)+(b*1000)+c; + } +-- +1.7.2.3 + diff --git a/abs/core/mdadm/mdadm b/abs/core/mdadm/mdadm index e196f36..9bf468e 100755 --- a/abs/core/mdadm/mdadm +++ b/abs/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/abs/core/mdadm/mdadm.install b/abs/core/mdadm/mdadm.install deleted file mode 100644 index cfeed3c..0000000 --- a/abs/core/mdadm/mdadm.install +++ /dev/null @@ -1,19 +0,0 @@ -# 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.service b/abs/core/mdadm/mdadm.service new file mode 100644 index 0000000..8389715 --- /dev/null +++ b/abs/core/mdadm/mdadm.service @@ -0,0 +1,8 @@ +[Unit] +Description=MDADM Event Monitor + +[Service] +ExecStart=/sbin/mdadm --monitor --scan + +[Install] +WantedBy=multi-user.target diff --git a/abs/core/mdadm/mdadm_hook b/abs/core/mdadm/mdadm_hook index 57799d3..787be5d 100755 --- a/abs/core/mdadm/mdadm_hook +++ b/abs/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 -}
\ No newline at end of file + [ -s "$mdconfig" ] && /sbin/mdassemble +} + +# vim: set ft=sh ts=4 sw=4 et: diff --git a/abs/core/mdadm/mdadm_install b/abs/core/mdadm/mdadm_install index b7a57ea..cf6159e 100644 --- a/abs/core/mdadm/mdadm_install +++ b/abs/core/mdadm/mdadm_install @@ -1,46 +1,45 @@ -# vim: set ft=sh: - -install () -{ - MODULES=" $(checked_modules "drivers/md/*" | grep -v "dm-") " - BINARIES="" - FILES="" - SCRIPT="mdadm" +#!/bin/bash + +build() { + add_checked_modules -f 'dm-' 'drivers/md/*' + # 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" + + add_runscript } -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. +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 } + +# vim: set ft=sh ts=4 sw=4 et: diff --git a/abs/core/mdadm/mdadm_udev_install b/abs/core/mdadm/mdadm_udev_install new file mode 100644 index 0000000..f6f5de4 --- /dev/null +++ b/abs/core/mdadm/mdadm_udev_install @@ -0,0 +1,24 @@ +#!/bin/bash + +build() { + add_checked_modules -f 'dm-' 'drivers/md/*' + + # check if a custom mdadm.conf exists + 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 "mdadm" + add_file "/usr/lib/udev/rules.d/64-md-raid.rules" +} + +help() { + cat <<HELPEOF +This hook loads the necessary modules for a RAID array and uses incremental +assembly via udev at runtime to create the devices. This hook with NOT work +without the udev hook included on the image. +HELPEOF +} + +# vim: set ft=sh ts=4 sw=4 et: diff --git a/abs/core/mdadm/run b/abs/core/mdadm/run deleted file mode 100644 index 567332e..0000000 --- a/abs/core/mdadm/run +++ /dev/null @@ -1,10 +0,0 @@ -#!/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 |