summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Severance2015-08-06 20:08:49 -0400
committerChris Severance2015-08-06 20:08:49 -0400
commit9cb75f5911d134cb7951fe7357719e08488eb014 (patch)
treed3250acdd00a2f295491a48aee56a318cf14ccab
parent25d098eed60e348733a3b89561e33b16d568dab5 (diff)
downloadaur-9cb75f5911d134cb7951fe7357719e08488eb014.tar.gz
Improved PKGBUILD install, mdadm_udev_hook
-rw-r--r--.SRCINFO12
-rw-r--r--PKGBUILD44
-rw-r--r--mdadm.install8
-rw-r--r--mdadm_udev_hook18
4 files changed, 57 insertions, 25 deletions
diff --git a/.SRCINFO b/.SRCINFO
index bc0e5121a227..e44f51692fec 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,6 +1,6 @@
pkgbase = mdadm-git
- pkgdesc = create, manage, and monitor Linux md block device RAID arrays
- pkgver = mdadm.3.3.3.r16.g53a087b
+ pkgdesc = create, manage, and monitor Linux mdraid block device RAID arrays
+ pkgver = mdadm.3.3.4.r22.gccc93b3
pkgrel = 1
url = http://neil.brown.name/blog/mdadm
install = mdadm.install
@@ -8,22 +8,24 @@ pkgbase = mdadm-git
arch = x86_64
license = GPL
makedepends = git
- depends = linux
depends = glibc
+ provides = mdadm
conflicts = mkinitcpio<0.7
conflicts = mdadm
replaces = raidtools
backup = etc/mdadm.conf
source = mdadm_github::git+https://github.com/neilbrown/mdadm.git
source = mdadm.conf::https://projects.archlinux.org/svntogit/packages.git/plain/trunk/mdadm.conf?h=packages/mdadm
+ source = mdadm_hook::https://projects.archlinux.org/svntogit/packages.git/plain/trunk/mdadm_hook?h=packages/mdadm
source = mdadm_install::https://projects.archlinux.org/svntogit/packages.git/plain/trunk/mdadm_install?h=packages/mdadm
source = mdadm_udev_install::https://projects.archlinux.org/svntogit/packages.git/plain/trunk/mdadm_udev_install?h=packages/mdadm
- source = mdadm_hook::https://projects.archlinux.org/svntogit/packages.git/plain/trunk/mdadm_hook?h=packages/mdadm
+ source = mdadm_udev_hook
sha256sums = SKIP
sha256sums = 4ce1e90690282f98e4828e11576fbd61be65e97a2cdae6c7eac7035ea5ee53e5
+ sha256sums = d297b4fa6213016ec08e4f66d07cf7eb03426e4e17ab31eddfa5c5c1d82ea294
sha256sums = 15bc46b9fa663dc204e2168861fabfd26e0dbcbb073792f271e3e4510897fb4e
sha256sums = 170b0e5d548416c0adb9df4e6941bea6bc33d843419c997e45ecaf9e36a58f38
- sha256sums = d297b4fa6213016ec08e4f66d07cf7eb03426e4e17ab31eddfa5c5c1d82ea294
+ sha256sums = d395184617f45849cbbaf5b4ee3665ca6895a1d642e0470e9de703ce944279ca
pkgname = mdadm-git
diff --git a/PKGBUILD b/PKGBUILD
index 59ab51414a7e..2edc3981d0c2 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -7,32 +7,37 @@
set -u
_pkgname='mdadm'
pkgname="${_pkgname}-git"
-pkgver=mdadm.3.3.3.r16.g53a087b
+pkgver=mdadm.3.3.4.r22.gccc93b3
pkgrel=1
-pkgdesc='create, manage, and monitor Linux md block device RAID arrays'
+pkgdesc='create, manage, and monitor Linux mdraid block device RAID arrays'
arch=('i686' 'x86_64')
license=('GPL')
+#url='https://github.com/neilbrown/mdadm'
url='http://neil.brown.name/blog/mdadm'
-conflicts=('mkinitcpio<0.7' 'mdadm')
+conflicts=('mkinitcpio<0.7' "${_pkgname}")
+provides=("${_pkgname}")
makedepends=('git')
-depends=('linux' 'glibc')
+depends=('glibc')
+#optdepends=('lvm2' 'dm-crypt' 'bcache')
backup=("etc/${_pkgname}.conf")
_archlink="@@@::https://projects.archlinux.org/svntogit/packages.git/plain/trunk/@@@?h=packages/${_pkgname}"
source=(# use either one, but not both. Reset with makepkg -sCf. My comparison shows these are identical, including the tags. Github is faster.
#"mdadm_gitnb::git://neil.brown.name/${_pkgname}"
"mdadm_github::git+https://github.com/neilbrown/${_pkgname}.git"
"${_archlink//@@@/${_pkgname}.conf}"
+ "${_archlink//@@@/${_pkgname}_hook}"
"${_archlink//@@@/${_pkgname}_install}"
"${_archlink//@@@/${_pkgname}_udev_install}"
- "${_archlink//@@@/${_pkgname}_hook}")
+ "mdadm_udev_hook")
install="${_pkgname}.install"
replaces=('raidtools')
sha256sums=('SKIP'
'4ce1e90690282f98e4828e11576fbd61be65e97a2cdae6c7eac7035ea5ee53e5'
+ 'd297b4fa6213016ec08e4f66d07cf7eb03426e4e17ab31eddfa5c5c1d82ea294'
'15bc46b9fa663dc204e2168861fabfd26e0dbcbb073792f271e3e4510897fb4e'
'170b0e5d548416c0adb9df4e6941bea6bc33d843419c997e45ecaf9e36a58f38'
- 'd297b4fa6213016ec08e4f66d07cf7eb03426e4e17ab31eddfa5c5c1d82ea294')
+ 'd395184617f45849cbbaf5b4ee3665ca6895a1d642e0470e9de703ce944279ca')
pkgver() {
cd mdadm_git*/
@@ -42,8 +47,8 @@ pkgver() {
prepare() {
set -u
cd mdadm_git*/
- # NB strives for warning free code so this patch should not be necessary. Comment but don't erase it as it will be needed from time to time.
- sed -i -e 's: -Werror : :g' 'Makefile' # disable-werror.patch.
+ # NB strives for warning free code so the werror patch should not be necessary. Comment but don't erase it as it may be needed from time to time.
+ #sed -i -e 's: -Werror : :g' 'Makefile' # disable-werror.patch
sed -i -e 's:/usr/sbin/:/usr/bin:g' -e 's:/sbin:/usr/bin:g' 'Makefile' 'test' 'mkinitramfs' 'mdadm.conf.5'
set +u
}
@@ -51,20 +56,16 @@ prepare() {
build() {
set -u
cd mdadm_git*/
- local _XFlags='-O' # -Wno-maybe-uninitialized' # uninitalized warnings are too dangerous to be hidden
- CPPFLAGS+=" ${_XFlags}" # warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Wcpp]
- CXXFLAGS+=" ${_XFlags}" # Despite claims in the Makefile, make CXFLAGS='-O' doesn't work.
- make -s -j $(nproc) BINDIR='/usr/bin' UDEVDIR='/usr/lib/udev'
+ make -s -j $(nproc) CXFLAGS='-O' BINDIR='/usr/bin' UDEVDIR='/usr/lib/udev'
# build static mdassemble for Arch's initramfs for use with mkinitcpio hook mdadm. Hook mdadm_udev does not use mdassemble.
- make -s MDASSEMBLE_AUTO=1 mdassemble
- # 2015-08-02 https://github.com/neilbrown/mdadm/issues/10 mdassemble used by hook mdadm does not update the map file
+ make -s -j $(nproc) CXFLAGS='-O' MDASSEMBLE_AUTO=1 mdassemble
set +u
}
check() {
set -u
cd mdadm_git*/
- make -s test
+ make -s -j $(nproc) CXFLAGS='-O' test
#sudo ./test # can't do sudo in a PKGBUILD
set +u
}
@@ -78,12 +79,17 @@ package() {
install -Dpm644 "${srcdir}/mdadm.conf" -t "${pkgdir}/etc/"
sed -i -e 's:/usr/sbin/:/usr/bin:g' "${pkgdir}/etc/mdadm.conf"
install -Dpm644 "${srcdir}/mdadm_install" "${pkgdir}/usr/lib/initcpio/install/mdadm"
- # 2015-08-04 mdadm is required even when using mdassemble. This eliminates the need for adding mdadm to BINARIES="" in mkinitcpio.conf
- if ! grep -q '/usr/bin/mdadm' "${pkgdir}/usr/lib/initcpio/install/mdadm"; then
- sed -i -e 's:^\(\s\+\)\(add_binary \):\1\2"/usr/bin/mdadm"\n&:g' "${pkgdir}/usr/lib/initcpio/install/mdadm"
- fi
+ ## 2015-08-04 mdadm is required even when using mdassemble. This eliminates the need for adding mdadm to BINARIES="" in mkinitcpio.conf
+ #if ! grep -q '/usr/bin/mdadm' "${pkgdir}/usr/lib/initcpio/install/mdadm"; then
+ # sed -i -e 's:^\(\s\+\)\(add_binary \):\1\2"/usr/bin/mdadm"\n&:g' "${pkgdir}/usr/lib/initcpio/install/mdadm"
+ #fi
install -Dpm644 "${srcdir}/mdadm_hook" "${pkgdir}/usr/lib/initcpio/hooks/mdadm"
+ sed -i -e 's:/usr/bin/ash:/usr/bin/bash:g' "${pkgdir}/usr/lib/initcpio/hooks/mdadm"
install -Dpm644 "${srcdir}/mdadm_udev_install" "${pkgdir}/usr/lib/initcpio/install/mdadm_udev"
+ if ! grep -q 'add_runscript' "${pkgdir}/usr/lib/initcpio/install/mdadm_udev"; then
+ sed -i -e 's:^\(\s\+\)add_binary:\1add_runscript\n&:g' "${pkgdir}/usr/lib/initcpio/install/mdadm_udev"
+ fi
+ install -Dpm644 "${srcdir}/mdadm_udev_hook" "${pkgdir}/usr/lib/initcpio/hooks/mdadm_udev"
sed -i -e 's:#!/bin/bash:#!/usr/bin/bash:g' "${pkgdir}/usr/lib/initcpio/install"/{mdadm,mdadm_udev}
sed -i -e 's:#!/bin/sh:#!/usr/bin/sh:g' "${pkgdir}/usr/lib/systemd/system-shutdown/mdadm.shutdown"
#ln -sf 'mdadm' "${pkgdir}/usr/lib/initcpio/hooks/raid" # symlink for backward compatibility
diff --git a/mdadm.install b/mdadm.install
index 25896f30be5c..4c22c159fb09 100644
--- a/mdadm.install
+++ b/mdadm.install
@@ -10,7 +10,7 @@ post_upgrade() {
#if [ -s '/etc/mkinitcpio.conf' ] && grep -q '^\s*HOOKS=".*\smdadm\s.*$' '/etc/mkinitcpio.conf'; then
# echo "Attention mdadm update:"
# echo "mdadm is deprecated for mdadm_udev"
- # echo "Please update your /etc/mkinitcpio.conf accordingly."
+ # echo "See the ArchWiki and update your /etc/mkinitcpio.conf accordingly."
#fi
if ! mdadm -D --scan >/dev/null; then
cat '/proc/mdstat'
@@ -33,3 +33,9 @@ post_install() {
fi
fi
}
+
+pre_remove() {
+ if [ -e '/proc/mdstat' ]; then
+ echo 'You still have active arrays. mdadm should be reinstalled soon.'
+ fi
+}
diff --git a/mdadm_udev_hook b/mdadm_udev_hook
new file mode 100644
index 000000000000..895cadd16241
--- /dev/null
+++ b/mdadm_udev_hook
@@ -0,0 +1,18 @@
+#!/usr/bin/bash
+
+# This hook doesn't do anything except echo the status lines that the old mdadm hook did.
+# Started md1 with 2 of 2 devices [UU]
+
+# First made for Arch Linux AUR package mdadm-git
+
+run_hook() {
+ # bash -c 'source mdadm_udev_hook; run_hook'
+ # http://unix.stackexchange.com/questions/28636/how-to-check-mdadm-raids-while-running
+ # awk puts the 2 lines together. sed outputs the formatted text
+ awk '/^md/ {printf "%s: ", $1}; /blocks/ {print $0 }' < '/proc/mdstat' | sed -ne 's;^\(.\+\):.*\[\([0-9]\+\)\/\([0-9]\+\)\].*\(\[[^]]*\]\).*$;Started \1 with \2 of \3 devices \4;p' | sort
+ #sleep 1
+ if ! /usr/bin/mdadm -D --scan >/dev/null; then
+ echo 'A RAID array may be damaged. Review /proc/mdstat and fix soon!'
+ sleep 5
+ fi
+}