mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-01 23:22:37 +00:00
* Revert r19339 because it doesn't work and gives a lot of errors:
client# /dev/fd/9: line 13: -q: command not found client# /dev/fd/9: line 18: test: -neq: binary operator expected client# mdadm: No arrays found in config file svn path=/nixos/trunk/; revision=19386
This commit is contained in:
parent
b5ade01199
commit
f89e46bc12
@ -5,7 +5,6 @@
|
|||||||
let
|
let
|
||||||
|
|
||||||
tempConf = "/var/run/mdadm.conf";
|
tempConf = "/var/run/mdadm.conf";
|
||||||
tempStatus = "/var/run/mdadm.status";
|
|
||||||
logFile = "/var/log/mdadmEvents.log";
|
logFile = "/var/log/mdadmEvents.log";
|
||||||
modprobe = config.system.sbin.modprobe;
|
modprobe = config.system.sbin.modprobe;
|
||||||
inherit (pkgs) mdadm diffutils;
|
inherit (pkgs) mdadm diffutils;
|
||||||
@ -43,21 +42,9 @@ in
|
|||||||
# Scan /proc/partitions for RAID devices.
|
# Scan /proc/partitions for RAID devices.
|
||||||
${mdadm}/sbin/mdadm --examine --brief --scan -c partitions > ${tempConf}
|
${mdadm}/sbin/mdadm --examine --brief --scan -c partitions > ${tempConf}
|
||||||
|
|
||||||
if ! -q ${diffutils}/bin/diff ${tempConf} ${tempConf}.old > /dev/null; then
|
if ! ${diffutils}/bin/diff ${tempConf} ${tempConf}.old > /dev/null; then
|
||||||
|
# Activate each device found.
|
||||||
try=0
|
${mdadm}/sbin/mdadm --assemble -c ${tempConf} --scan
|
||||||
while ! test -e /proc/mdstat || ! ${diffutils}/bin/diff -q /proc/mdstat ${tempStatus} > /dev/null; do
|
|
||||||
test $try -gt 6 && break
|
|
||||||
test $try -neq 0 && sleep 10
|
|
||||||
|
|
||||||
# Activate each device found.
|
|
||||||
${mdadm}/sbin/mdadm --assemble -c ${tempConf} --scan
|
|
||||||
|
|
||||||
try=$(($try + 1))
|
|
||||||
done
|
|
||||||
|
|
||||||
# Register the new status
|
|
||||||
cp /proc/mdstat ${tempStatus}
|
|
||||||
|
|
||||||
# Send notifications.
|
# Send notifications.
|
||||||
initctl emit -n new-devices
|
initctl emit -n new-devices
|
||||||
@ -77,7 +64,6 @@ in
|
|||||||
|
|
||||||
postStart = ''
|
postStart = ''
|
||||||
echo > ${tempConf}
|
echo > ${tempConf}
|
||||||
echo > ${tempStatus}
|
|
||||||
|
|
||||||
# Assemble early raid devices.
|
# Assemble early raid devices.
|
||||||
initctl emit -n new-raid-array
|
initctl emit -n new-raid-array
|
||||||
|
Loading…
Reference in New Issue
Block a user