summaryrefslogtreecommitdiff
path: root/debian/initramfs
diff options
context:
space:
mode:
authorMichael Prokop <mika@grml.org>2010-08-07 11:12:58 -0400
committermartin f. krafft <madduck@debian.org>2010-09-02 11:57:51 +0200
commit0c11ed84d14081f75469493e33315fd02f6750dc (patch)
tree959007fa31ac09ccae083558dc514d0d8f8ec3d3 /debian/initramfs
parent1c3856eea930bb8d5c38bda27b436fcc6f55bbfb (diff)
initamfs/hook: make sure configuration file exists before accessing it.
Debian bug: #589836 Signed-off-by: Michael Prokop <mika@grml.org> Signed-off-by: martin f. krafft <madduck@debian.org>
Diffstat (limited to 'debian/initramfs')
-rw-r--r--debian/initramfs/hook8
1 files changed, 6 insertions, 2 deletions
diff --git a/debian/initramfs/hook b/debian/initramfs/hook
index 368b3ae3..b7eab113 100644
--- a/debian/initramfs/hook
+++ b/debian/initramfs/hook
@@ -90,7 +90,9 @@ INITRDSTART=all
DESTMDADMCONF=$DESTDIR/etc/mdadm/mdadm.conf
DESTCONFIG=$DESTDIR/conf/conf.d/md
-homehost="$(sed -ne 's,^[[:space:]]*HOMEHOST[[:space:]]*,,p' $CONFIG)"
+if [ -f $CONFIG ]; then
+ homehost="$(sed -ne 's,^[[:space:]]*HOMEHOST[[:space:]]*,,p' $CONFIG)"
+fi
if [ -z "${homehost:-}" ] || [ "${homehost:-}" = '<system>' ]; then
echo "MD_HOMEHOST='$(hostname)'" > $DESTCONFIG
fi
@@ -100,7 +102,9 @@ install_config()
# install the configuration file
mkdir -p ${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 "$1" ] ; then
+ sed -e :a -re '$!N;s/\n[[:space:]]+/ /;ta' -ne '/^(ARRAY|DEVICE|HOMEHOST)/P;D' $1 > $2
+ fi
}
if [ ! -f $CONFIG ]; then