r208 - mdadm/trunk/debian/initramfs

madduck at users.alioth.debian.org madduck at users.alioth.debian.org
Fri Oct 6 12:55:44 UTC 2006


Author: madduck
Date: 2006-10-06 12:55:44 +0000 (Fri, 06 Oct 2006)
New Revision: 208

Modified:
   mdadm/trunk/debian/initramfs/hook
Log:
try to create temporary file when the mdadm.conf defines no ARRAYs

Modified: mdadm/trunk/debian/initramfs/hook
===================================================================
--- mdadm/trunk/debian/initramfs/hook	2006-10-06 12:45:57 UTC (rev 207)
+++ mdadm/trunk/debian/initramfs/hook	2006-10-06 12:55:44 UTC (rev 208)
@@ -97,6 +97,7 @@
   
 else 
   
+  use_temp=0
   if [ -e /var/lib/mdadm/CONF-UNCHECKED ]; then
     # the file comes from an old installation and hence is not guaranteed to
     # work. We thus better create one and start all arrays to be sure.
@@ -104,6 +105,21 @@
     echo "W: mdadm: unchecked configuration file: $CONFIG" >&2
     echo "W: mdadm: please read /usr/share/doc/mdadm/README.upgrading-2.5.3.gz ." >&2
 
+    use_temp=1
+  elif ! grep -q '^ARRAY' $CONFIG; then
+    # the file defines no ARRAYs. We better create a temporary file to be
+    # sure.
+
+    echo "W: mdadm: $CONFIG defines no arrays." >&2
+    use_temp=1
+
+  else
+    # this is the ideal case
+    install_config $CONFIG $DESTMDADMCONF
+    echo "I: mdadm: using configuration file: $CONFIG" >&2
+  fi
+
+  if [ $use_temp -eq 1 ]; then
     tmpfile="${DESTMDADMCONF}.tmp"
     if /usr/share/mdadm/mkconf generate $tmpfile; then
       # all is well, we now have a temporary configuration file
@@ -120,11 +136,6 @@
       fi
     fi
     rm -f $tmpfile
-
-  else
-    # this is the ideal case
-    install_config $CONFIG $DESTMDADMCONF
-    echo "I: mdadm: using configuration file: $CONFIG" >&2
   fi
 
 fi




More information about the pkg-mdadm-commits mailing list