diff options
author | madduck <madduck@3cfab66f-1918-0410-86b3-c06b76f9a464> | 2006-10-06 12:55:44 +0000 |
---|---|---|
committer | madduck <madduck@3cfab66f-1918-0410-86b3-c06b76f9a464> | 2006-10-06 12:55:44 +0000 |
commit | f2069785ca56ac86cba36fdb40f04d84ffefc031 (patch) | |
tree | 5dc82effce9cb8eae9ed131d87927621d5e1b8c5 /debian/initramfs | |
parent | ef626bb2bcda35b81b2055d1966b134ad910a3a7 (diff) |
try to create temporary file when the mdadm.conf defines no ARRAYs
Diffstat (limited to 'debian/initramfs')
-rw-r--r-- | debian/initramfs/hook | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/debian/initramfs/hook b/debian/initramfs/hook index 965c894e..bcf9b2c2 100644 --- a/debian/initramfs/hook +++ b/debian/initramfs/hook @@ -97,6 +97,7 @@ if [ ! -f $CONFIG ]; then 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 @@ else 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 @@ else 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 |