From 1f2db38e9ae5ec5d39257cacfd0f51940dd2ae4f Mon Sep 17 00:00:00 2001 From: Nicolas Pierron Date: Sun, 16 May 2010 16:36:01 +0000 Subject: [PATCH] Fix swraid for config which do not have any raid devices. svn path=/nixos/trunk/; revision=21800 --- modules/tasks/swraid.nix | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/tasks/swraid.nix b/modules/tasks/swraid.nix index 0c4a91db225..de9b6858006 100644 --- a/modules/tasks/swraid.nix +++ b/modules/tasks/swraid.nix @@ -45,8 +45,9 @@ in # Scan /proc/partitions for RAID devices. ${mdadm}/sbin/mdadm --examine --brief --scan -c partitions > ${tempConf} - # If the status has changed. - if ! ${diffutils}/bin/diff -q /proc/mdstat ${tempStatus} > /dev/null; then + # If there is some array to assemble and if the status has changed. + if test -e /proc/mdstat -a -s ${tempConf} && + ! ${diffutils}/bin/diff -q /proc/mdstat ${tempStatus} > /dev/null; then # Keep the previous status to watch changes. cp ${tempStatus} ${tempStatus}.old