Blame 0011-dracut-functions.sh-dracut.sh-use-xargs-with-r.patch

Harald Hoyer c4a5a0
From 73575f11a9255704643b47ad0494cd2aabdce04c Mon Sep 17 00:00:00 2001
Harald Hoyer c4a5a0
From: Harald Hoyer <harald@redhat.com>
Harald Hoyer c4a5a0
Date: Sat, 30 Jun 2012 11:34:13 +0200
Harald Hoyer c4a5a0
Subject: [PATCH] dracut-functions.sh,dracut.sh: use xargs with "-r"
Harald Hoyer c4a5a0
Harald Hoyer c4a5a0
---
Harald Hoyer c4a5a0
 dracut-functions.sh |   17 ++++++++---------
Harald Hoyer c4a5a0
 dracut.sh           |    2 +-
Harald Hoyer c4a5a0
 2 files changed, 9 insertions(+), 10 deletions(-)
Harald Hoyer c4a5a0
Harald Hoyer c4a5a0
diff --git a/dracut-functions.sh b/dracut-functions.sh
Harald Hoyer c4a5a0
index cd9426e..80b022f 100755
Harald Hoyer c4a5a0
--- a/dracut-functions.sh
Harald Hoyer c4a5a0
+++ b/dracut-functions.sh
Harald Hoyer c4a5a0
@@ -1197,7 +1197,7 @@ dracut_kernel_post() {
Harald Hoyer c4a5a0
     local _moddirname=${srcmods%%/lib/modules/*}
Harald Hoyer c4a5a0
 
Harald Hoyer c4a5a0
     if [[ $DRACUT_KERNEL_LAZY_HASHDIR ]] && [[ -f "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist" ]]; then
Harald Hoyer c4a5a0
-        xargs modprobe -a ${_moddirname+-d ${_moddirname}/} --ignore-install --show-depends \
Harald Hoyer c4a5a0
+        xargs -r modprobe -a ${_moddirname+-d ${_moddirname}/} --ignore-install --show-depends \
Harald Hoyer c4a5a0
             < "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist" 2>/dev/null \
Harald Hoyer c4a5a0
             | sort -u \
Harald Hoyer c4a5a0
             | while read _cmd _modpath _options; do
Harald Hoyer c4a5a0
@@ -1206,8 +1206,8 @@ dracut_kernel_post() {
Harald Hoyer c4a5a0
         done > "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist.dep"
Harald Hoyer c4a5a0
 
Harald Hoyer c4a5a0
         (
Harald Hoyer c4a5a0
-            if [[ -x $DRACUT_INSTALL ]] && [[ -z $_moddirname ]]; then
Harald Hoyer c4a5a0
-                xargs $DRACUT_INSTALL ${initdir+-D "$initdir"} -a < "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist.dep"
Harald Hoyer c4a5a0
+            if [[ $DRACUT_INSTALL ]] && [[ -z $_moddirname ]]; then
Harald Hoyer c4a5a0
+                xargs -r $DRACUT_INSTALL ${initdir+-D "$initdir"} -a < "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist.dep"
Harald Hoyer c4a5a0
             else
Harald Hoyer c4a5a0
                 while read _modpath; do
Harald Hoyer c4a5a0
                     local _destpath=$_modpath
Harald Hoyer c4a5a0
@@ -1218,16 +1218,15 @@ dracut_kernel_post() {
Harald Hoyer c4a5a0
             fi
Harald Hoyer c4a5a0
         ) &
Harald Hoyer c4a5a0
 
Harald Hoyer c4a5a0
-
Harald Hoyer c4a5a0
-        if [[ -x $DRACUT_INSTALL ]]; then
Harald Hoyer c4a5a0
-            xargs modinfo -k $kernel -F firmware < "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist.dep" \
Harald Hoyer c4a5a0
+        if [[ $DRACUT_INSTALL ]]; then
Harald Hoyer c4a5a0
+            xargs -r modinfo -k $kernel -F firmware < "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist.dep" \
Harald Hoyer c4a5a0
                 | while read line; do
Harald Hoyer c4a5a0
                 for _fwdir in $fw_dir; do
Harald Hoyer c4a5a0
                     echo $_fwdir/$line;
Harald Hoyer c4a5a0
                 done;
Harald Hoyer c4a5a0
-            done |xargs $DRACUT_INSTALL ${initdir+-D "$initdir"} -a -o
Harald Hoyer c4a5a0
+            done | xargs -r $DRACUT_INSTALL ${initdir+-D "$initdir"} -a -o
Harald Hoyer c4a5a0
         else
Harald Hoyer c4a5a0
-            for _fw in $(xargs modinfo -k $kernel -F firmware < "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist.dep"); do
Harald Hoyer c4a5a0
+            for _fw in $(xargs -r modinfo -k $kernel -F firmware < "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist.dep"); do
Harald Hoyer c4a5a0
                 for _fwdir in $fw_dir; do
Harald Hoyer c4a5a0
                     if [[ -d $_fwdir && -f $_fwdir/$_fw ]]; then
Harald Hoyer c4a5a0
                         inst_simple "$_fwdir/$_fw" "/lib/firmware/$_fw"
Harald Hoyer c4a5a0
@@ -1273,7 +1272,7 @@ find_kernel_modules_by_path () (
Harald Hoyer c4a5a0
         IFS=$_OLDIFS
Harald Hoyer c4a5a0
     else
Harald Hoyer c4a5a0
         ( cd /sys/module; echo *; ) \
Harald Hoyer c4a5a0
-        | xargs modinfo -F filename -k $kernel 2>/dev/null
Harald Hoyer c4a5a0
+        | xargs -r modinfo -F filename -k $kernel 2>/dev/null
Harald Hoyer c4a5a0
     fi
Harald Hoyer c4a5a0
     return 0
Harald Hoyer c4a5a0
 )
Harald Hoyer c4a5a0
diff --git a/dracut.sh b/dracut.sh
Harald Hoyer c4a5a0
index c4562e6..7ca3e8d 100755
Harald Hoyer c4a5a0
--- a/dracut.sh
Harald Hoyer c4a5a0
+++ b/dracut.sh
Harald Hoyer c4a5a0
@@ -879,7 +879,7 @@ if [[ $do_strip = yes ]] ; then
Harald Hoyer c4a5a0
     find "$initdir" -type f \
Harald Hoyer c4a5a0
         '(' -perm -0100 -or -perm -0010 -or -perm -0001 \
Harald Hoyer c4a5a0
         -or -path '*/lib/modules/*.ko' ')' -print0 \
Harald Hoyer c4a5a0
-        | xargs -0 strip -g 2>/dev/null
Harald Hoyer c4a5a0
+        | xargs -r -0 strip -g 2>/dev/null
Harald Hoyer c4a5a0
     dinfo "*** Stripping files done ***"
Harald Hoyer c4a5a0
 fi
Harald Hoyer c4a5a0