Blame 0007-dracut-functions.sh-fix-inst-functions-for-H-handlin.patch

Harald Hoyer e09d6b
From 4ef45f13f4d11c86c4c8c3fd8d8a6be2c5b4deef Mon Sep 17 00:00:00 2001
Harald Hoyer e09d6b
From: Harald Hoyer <harald@redhat.com>
Harald Hoyer e09d6b
Date: Mon, 21 Jul 2014 16:58:15 +0200
Harald Hoyer e09d6b
Subject: [PATCH] dracut-functions.sh: fix inst*() functions for "-H" handling
Harald Hoyer e09d6b
Harald Hoyer e09d6b
because some inst*() functions check the existance of the source files
Harald Hoyer e09d6b
and do not know about the "-H" option, some failed to install the
Harald Hoyer e09d6b
hostonly files.
Harald Hoyer e09d6b
---
Harald Hoyer e09d6b
 dracut-functions.sh | 46 ++++++++++++++++++++++++++++++++--------------
Harald Hoyer e09d6b
 1 file changed, 32 insertions(+), 14 deletions(-)
Harald Hoyer e09d6b
Harald Hoyer e09d6b
diff --git a/dracut-functions.sh b/dracut-functions.sh
Harald Hoyer e09d6b
index 9f481b2..6cdfea0 100755
Harald Hoyer e09d6b
--- a/dracut-functions.sh
Harald Hoyer e09d6b
+++ b/dracut-functions.sh
Harald Hoyer e09d6b
@@ -760,33 +760,46 @@ inst_dir() {
Harald Hoyer e09d6b
 }
Harald Hoyer e09d6b
 
Harald Hoyer e09d6b
 inst() {
Harald Hoyer e09d6b
+    local _hostonly_install
Harald Hoyer e09d6b
+    if [[ "$1" == "-H" ]]; then
Harald Hoyer e09d6b
+        _hostonly_install="-H"
Harald Hoyer e09d6b
+        shift
Harald Hoyer e09d6b
+    fi
Harald Hoyer e09d6b
     [[ -e ${initdir}/"${2:-$1}" ]] && return 0  # already there
Harald Hoyer e09d6b
-        #dinfo "$DRACUT_INSTALL -l $@"
Harald Hoyer e09d6b
-    $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@"
Harald Hoyer e09d6b
-    (($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@" || :
Harald Hoyer e09d6b
+    $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@"
Harald Hoyer e09d6b
+    (($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" || :
Harald Hoyer e09d6b
 }
Harald Hoyer e09d6b
 
Harald Hoyer e09d6b
 inst_simple() {
Harald Hoyer e09d6b
+    local _hostonly_install
Harald Hoyer e09d6b
+    if [[ "$1" == "-H" ]]; then
Harald Hoyer e09d6b
+        _hostonly_install="-H"
Harald Hoyer e09d6b
+        shift
Harald Hoyer e09d6b
+    fi
Harald Hoyer e09d6b
     [[ -e ${initdir}/"${2:-$1}" ]] && return 0  # already there
Harald Hoyer e09d6b
     [[ -e $1 ]] || return 1  # no source
Harald Hoyer e09d6b
-    $DRACUT_INSTALL ${initdir:+-D "$initdir"} "$@"
Harald Hoyer e09d6b
-    (($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} "$@" || :
Harald Hoyer e09d6b
+    $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${_hostonly_install:+-H} "$@"
Harald Hoyer e09d6b
+    (($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${_hostonly_install:+-H} "$@" || :
Harald Hoyer e09d6b
 }
Harald Hoyer e09d6b
 
Harald Hoyer e09d6b
 inst_symlink() {
Harald Hoyer e09d6b
+    local _hostonly_install
Harald Hoyer e09d6b
+    if [[ "$1" == "-H" ]]; then
Harald Hoyer e09d6b
+        _hostonly_install="-H"
Harald Hoyer e09d6b
+        shift
Harald Hoyer e09d6b
+    fi
Harald Hoyer e09d6b
     [[ -e ${initdir}/"${2:-$1}" ]] && return 0  # already there
Harald Hoyer e09d6b
     [[ -L $1 ]] || return 1
Harald Hoyer e09d6b
-    $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${DRACUT_RESOLVE_DEPS:+-l}  ${DRACUT_FIPS_MODE:+-f} "$@"
Harald Hoyer e09d6b
-    (($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${DRACUT_RESOLVE_DEPS:+-l}  ${DRACUT_FIPS_MODE:+-f} "$@" || :
Harald Hoyer e09d6b
+    $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${DRACUT_RESOLVE_DEPS:+-l}  ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@"
Harald Hoyer e09d6b
+    (($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${DRACUT_RESOLVE_DEPS:+-l}  ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" || :
Harald Hoyer e09d6b
 }
Harald Hoyer e09d6b
 
Harald Hoyer e09d6b
 inst_multiple() {
Harald Hoyer e09d6b
-    local ret
Harald Hoyer e09d6b
-        #dinfo "initdir=$initdir $DRACUT_INSTALL -l $@"
Harald Hoyer e09d6b
+    local _ret
Harald Hoyer e09d6b
     $DRACUT_INSTALL ${initdir:+-D "$initdir"} -a ${DRACUT_RESOLVE_DEPS:+-l}  ${DRACUT_FIPS_MODE:+-f} "$@"
Harald Hoyer e09d6b
-    ret=$?
Harald Hoyer e09d6b
-    (($ret != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} -a ${DRACUT_RESOLVE_DEPS:+-l}  ${DRACUT_FIPS_MODE:+-f} "$@" || :
Harald Hoyer e09d6b
-    return $ret
Harald Hoyer e09d6b
+    _ret=$?
Harald Hoyer e09d6b
+    (($_ret != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} -a ${DRACUT_RESOLVE_DEPS:+-l}  ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" || :
Harald Hoyer e09d6b
+    return $_ret
Harald Hoyer e09d6b
 }
Harald Hoyer e09d6b
 
Harald Hoyer e09d6b
 dracut_install() {
Harald Hoyer e09d6b
@@ -794,10 +807,15 @@ dracut_install() {
Harald Hoyer e09d6b
 }
Harald Hoyer e09d6b
 
Harald Hoyer e09d6b
 inst_library() {
Harald Hoyer e09d6b
+    local _hostonly_install
Harald Hoyer e09d6b
+    if [[ "$1" == "-H" ]]; then
Harald Hoyer e09d6b
+        _hostonly_install="-H"
Harald Hoyer e09d6b
+        shift
Harald Hoyer e09d6b
+    fi
Harald Hoyer e09d6b
     [[ -e ${initdir}/"${2:-$1}" ]] && return 0  # already there
Harald Hoyer e09d6b
     [[ -e $1 ]] || return 1  # no source
Harald Hoyer e09d6b
-    $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${DRACUT_RESOLVE_DEPS:+-l}  ${DRACUT_FIPS_MODE:+-f} "$@"
Harald Hoyer e09d6b
-    (($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${DRACUT_RESOLVE_DEPS:+-l}  ${DRACUT_FIPS_MODE:+-f} "$@" || :
Harald Hoyer e09d6b
+    $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${DRACUT_RESOLVE_DEPS:+-l}  ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@"
Harald Hoyer e09d6b
+    (($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${DRACUT_RESOLVE_DEPS:+-l}  ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" || :
Harald Hoyer e09d6b
 }
Harald Hoyer e09d6b
 
Harald Hoyer e09d6b
 inst_binary() {