martin f. krafft: only store MD_HOMEHOST if config does not
Martin F. Krafft
madduck at alioth.debian.org
Tue Jul 21 11:55:45 UTC 2009
Module: mdadm
Branch: build
Commit: 2e0548313b4259d0fb70ef9605cf26a7f10a2616
URL: http://git.debian.org/?p=pkg-mdadm/mdadm.git;a=commit;h=2e0548313b4259d0fb70ef9605cf26a7f10a2616
Author: martin f. krafft <madduck at debian.org>
Date: Tue Jul 21 10:19:43 2009 +0200
only store MD_HOMEHOST if config does not
Signed-off-by: martin f. krafft <madduck at debian.org>
---
debian/initramfs/hook | 12 ++++--------
debian/initramfs/script.local-top | 2 +-
2 files changed, 5 insertions(+), 9 deletions(-)
diff --git a/debian/initramfs/hook b/debian/initramfs/hook
index 6e6066d..24a0a14 100644
--- a/debian/initramfs/hook
+++ b/debian/initramfs/hook
@@ -90,21 +90,17 @@ INITRDSTART=all
DESTMDADMCONF=$DESTDIR/etc/mdadm/mdadm.conf
DESTCONFIG=$DESTDIR/conf/conf.d/md
-# save the homehost for now, even if we don't use it yet
-if [ -f $CONFIG ]; then
- homehost="$(sed -ne 's,^[[:space:]]*HOMEHOST[[:space:]]*,,p' $CONFIG)"
-fi
+homehost="$(sed -ne 's,^[[:space:]]*HOMEHOST[[:space:]]*,,p' $CONFIG)"
if [ -z "${homehost:-}" ] || [ "${homehost:-}" = '<system>' ]; then
- homehost="$(hostname)"
+ echo "MD_HOMEHOST='$(hostname)'" > $DESTCONFIG
fi
-echo "MD_HOMEHOST='$homehost'" > $DESTCONFIG
install_config()
{
# install the configuration file
mkdir -p ${2%/*}
- # only copy ARRAY and DEVICE lines, and merge continuation lines into one
- sed -e :a -re '$!N;s/\n[[:space:]]+/ /;ta' -ne '/^(ARRAY|DEVICE)/P;D' $1 > $2
+ # only copy ARRAY/DEVICE/HOMEHOST lines, and merge continuation lines into one
+ sed -e :a -re '$!N;s/\n[[:space:]]+/ /;ta' -ne '/^(ARRAY|DEVICE|HOMEHOST)/P;D' $1 > $2
}
if [ ! -f $CONFIG ]; then
diff --git a/debian/initramfs/script.local-top b/debian/initramfs/script.local-top
index db89fac..0148f24 100644
--- a/debian/initramfs/script.local-top
+++ b/debian/initramfs/script.local-top
@@ -76,7 +76,7 @@ if [ "$MD_DEVS" = all ]; then
verbose && log_begin_msg "Assembling all MD arrays"
extra_args=''
- [ -n "$MD_HOMEHOST" ] && extra_args="--homehost='$MD_HOMEHOST'"
+ [ -n "${MD_HOMEHOST:-}" ] && extra_args="--homehost='$MD_HOMEHOST'"
if $MDADM --assemble --scan --run --auto=yes $extra_args; then
verbose && log_success_msg "assembled all arrays."
else
More information about the pkg-mdadm-commits
mailing list