Blob Blame History Raw
From d37ad6aea04932196df06139b27d3869385617f9 Mon Sep 17 00:00:00 2001
From: Will Woods <wwoods@redhat.com>
Date: Wed, 7 Mar 2012 17:21:53 -0500
Subject: [PATCH] write-ifcfg.sh: cleanups

mkdir -p creates intermediate directories and never returns an error, so
we don't need to create the intermediate directories ourself.
---
 modules.d/45ifcfg/write-ifcfg.sh |   15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/modules.d/45ifcfg/write-ifcfg.sh b/modules.d/45ifcfg/write-ifcfg.sh
index d633a96..0f431e3 100755
--- a/modules.d/45ifcfg/write-ifcfg.sh
+++ b/modules.d/45ifcfg/write-ifcfg.sh
@@ -134,11 +134,10 @@ for netif in $IFACES ; do
 done
 
 # Pass network opts
-[ -d /run/initramfs ] || mkdir -m 0755 -p /run/initramfs
-cp /tmp/net.* /run/initramfs/ >/dev/null 2>&1
-for i in /run/initramfs/state /run/initramfs/state/etc/ /run/initramfs/state/etc/sysconfig /run/initramfs/state/etc/sysconfig/network-scripts; do
-    [ -d $i ] || mkdir -m 0755 -p $i
-done
-cp /tmp/net.$netif.resolv.conf /run/initramfs/state/etc/ >/dev/null 2>&1
-echo "files /etc/sysconfig/network-scripts" > /run/initramfs/rwtab
-cp -a -t /run/initramfs/state/etc/sysconfig/network-scripts/ /tmp/ifcfg/* >/dev/null 2>&1
+mkdir -m 0755 -p /run/initramfs/state/etc/sysconfig/network-scripts
+echo "files /etc/sysconfig/network-scripts" >> /run/initramfs/rwtab
+{
+    cp /tmp/net.* /run/initramfs/
+    cp /tmp/net.$netif.resolv.conf /run/initramfs/state/etc/
+    cp -a -t /run/initramfs/state/etc/sysconfig/network-scripts/ /tmp/ifcfg/*
+} > /dev/null 2>&1