summaryrefslogtreecommitdiff
path: root/libre-testing/mdadm/mdadm_hook
diff options
context:
space:
mode:
authorBruno Cichon <ebrasca@librepanther.com>2018-10-01 01:51:03 +0200
committerBruno Cichon <ebrasca@librepanther.com>2018-10-01 01:51:03 +0200
commit56f955aca6231693fe797de4793f77ed58ab116e (patch)
tree17daeabce98174f288bab94b47961dc9e9931e66 /libre-testing/mdadm/mdadm_hook
parent75ff40baa049bae7e9270d20ef86a88b733006ab (diff)
downloadabslibre-56f955aca6231693fe797de4793f77ed58ab116e.tar.gz
abslibre-56f955aca6231693fe797de4793f77ed58ab116e.tar.bz2
abslibre-56f955aca6231693fe797de4793f77ed58ab116e.zip
Add some base packages for ppc64le
Diffstat (limited to 'libre-testing/mdadm/mdadm_hook')
-rwxr-xr-xlibre-testing/mdadm/mdadm_hook49
1 files changed, 49 insertions, 0 deletions
diff --git a/libre-testing/mdadm/mdadm_hook b/libre-testing/mdadm/mdadm_hook
new file mode 100755
index 000000000..5371baaca
--- /dev/null
+++ b/libre-testing/mdadm/mdadm_hook
@@ -0,0 +1,49 @@
+#!/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 [ -n "$md" ]; then
+ echo 'DEVICE partitions' >"$mdconfig"
+ for i in $(cat /proc/cmdline); do
+ case $i in
+ # raid
+ md=[0-9]*,/*)
+ device=${i%%,*}
+ device=${device/=/}
+ array=${i#*,}
+ echo "ARRAY /dev/$device devices=$array"
+ ;;
+ # partitionable raid
+ md=d[0-9]*,/*)
+ device=${i%%,*}
+ device=${device/=/_}
+ array=${i#*,}
+ echo "ARRAY /dev/$device devices=$array"
+ ;;
+ # 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-fA-F]*)
+ device=${i%%,*}
+ device=${device/=/_}
+ array=${i#*,}
+ echo "ARRAY /dev/$device UUID=$array"
+ ;;
+ esac
+ done >>"$mdconfig"
+ fi
+
+ # assemble everything
+ [ -s "$mdconfig" ] && /usr/bin/mdassemble
+}
+
+# vim: set ft=sh ts=4 sw=4 et: