Blame 0012-dracut-functions.sh-removed-non-dracut-install-shell.patch

Harald Hoyer f8c4a0
From 55a0b3abc7b8da4f3714cfcb5d34f7aa4e78e5bc Mon Sep 17 00:00:00 2001
Harald Hoyer f8c4a0
From: Harald Hoyer <harald@redhat.com>
Harald Hoyer f8c4a0
Date: Mon, 5 Aug 2013 11:47:54 +0200
Harald Hoyer f8c4a0
Subject: [PATCH] dracut-functions.sh: removed non dracut-install shell
Harald Hoyer f8c4a0
 functions
Harald Hoyer f8c4a0
Harald Hoyer f8c4a0
---
Harald Hoyer f8c4a0
 dracut-functions.sh | 315 ++++++++++------------------------------------------
Harald Hoyer f8c4a0
 1 file changed, 56 insertions(+), 259 deletions(-)
Harald Hoyer f8c4a0
Harald Hoyer f8c4a0
diff --git a/dracut-functions.sh b/dracut-functions.sh
Harald Hoyer f8c4a0
index dee53bb..c0a12cd 100755
Harald Hoyer f8c4a0
--- a/dracut-functions.sh
Harald Hoyer f8c4a0
+++ b/dracut-functions.sh
Harald Hoyer f8c4a0
@@ -55,14 +55,6 @@ if ! [[ $dracutbasedir ]]; then
Harald Hoyer f8c4a0
     dracutbasedir="$(readlink -f $dracutbasedir)"
Harald Hoyer f8c4a0
 fi
Harald Hoyer f8c4a0
 
Harald Hoyer f8c4a0
-if ! [[ $DRACUT_INSTALL ]]; then
Harald Hoyer f8c4a0
-    DRACUT_INSTALL=$(find_binary dracut-install)
Harald Hoyer f8c4a0
-fi
Harald Hoyer f8c4a0
-
Harald Hoyer f8c4a0
-if ! [[ $DRACUT_INSTALL ]] && [[ -x $dracutbasedir/dracut-install ]]; then
Harald Hoyer f8c4a0
-    DRACUT_INSTALL=$dracutbasedir/dracut-install
Harald Hoyer f8c4a0
-fi
Harald Hoyer f8c4a0
-
Harald Hoyer f8c4a0
 # Detect lib paths
Harald Hoyer f8c4a0
 if ! [[ $libdirs ]] ; then
Harald Hoyer f8c4a0
     if [[ "$(ldd /bin/sh)" == */lib64/* ]] &>/dev/null \
Harald Hoyer f8c4a0
@@ -588,268 +580,73 @@ fs_get_option() {
Harald Hoyer f8c4a0
     done
Harald Hoyer f8c4a0
 }
Harald Hoyer f8c4a0
 
Harald Hoyer f8c4a0
-if [[ $DRACUT_INSTALL ]]; then
Harald Hoyer f8c4a0
-    [[ $DRACUT_RESOLVE_LAZY ]] || export DRACUT_RESOLVE_DEPS=1
Harald Hoyer f8c4a0
-    inst_dir() {
Harald Hoyer f8c4a0
-        [[ -e ${initdir}/"$1" ]] && return 0  # already there
Harald Hoyer f8c4a0
-        $DRACUT_INSTALL ${initdir+-D "$initdir"} -d "$@"
Harald Hoyer f8c4a0
-        (($? != 0)) && derror $DRACUT_INSTALL ${initdir+-D "$initdir"} -d "$@" || :
Harald Hoyer f8c4a0
-    }
Harald Hoyer f8c4a0
-
Harald Hoyer f8c4a0
-    inst() {
Harald Hoyer f8c4a0
-        [[ -e ${initdir}/"${2:-$1}" ]] && return 0  # already there
Harald Hoyer f8c4a0
-        #dinfo "$DRACUT_INSTALL -l $@"
Harald Hoyer f8c4a0
-        $DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@"
Harald Hoyer f8c4a0
-        (($? != 0)) && derror $DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@" || :
Harald Hoyer f8c4a0
-    }
Harald Hoyer f8c4a0
-
Harald Hoyer f8c4a0
-    inst_simple() {
Harald Hoyer f8c4a0
-        [[ -e ${initdir}/"${2:-$1}" ]] && return 0  # already there
Harald Hoyer f8c4a0
-        [[ -e $1 ]] || return 1  # no source
Harald Hoyer f8c4a0
-        $DRACUT_INSTALL ${initdir+-D "$initdir"} "$@"
Harald Hoyer f8c4a0
-        (($? != 0)) && derror $DRACUT_INSTALL ${initdir+-D "$initdir"} "$@" || :
Harald Hoyer f8c4a0
-    }
Harald Hoyer f8c4a0
-
Harald Hoyer f8c4a0
-    inst_symlink() {
Harald Hoyer f8c4a0
-        [[ -e ${initdir}/"${2:-$1}" ]] && return 0  # already there
Harald Hoyer f8c4a0
-        [[ -L $1 ]] || return 1
Harald Hoyer f8c4a0
-        $DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l}  ${DRACUT_FIPS_MODE+-H} "$@"
Harald Hoyer f8c4a0
-        (($? != 0)) && derror $DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l}  ${DRACUT_FIPS_MODE+-H} "$@" || :
Harald Hoyer f8c4a0
-    }
Harald Hoyer f8c4a0
-
Harald Hoyer f8c4a0
-    dracut_install() {
Harald Hoyer f8c4a0
-        local ret
Harald Hoyer f8c4a0
-        #dinfo "initdir=$initdir $DRACUT_INSTALL -l $@"
Harald Hoyer f8c4a0
-        $DRACUT_INSTALL ${initdir+-D "$initdir"} -a ${DRACUT_RESOLVE_DEPS+-l}  ${DRACUT_FIPS_MODE+-H} "$@"
Harald Hoyer f8c4a0
-        ret=$?
Harald Hoyer f8c4a0
-        (($ret != 0)) && derror $DRACUT_INSTALL ${initdir+-D "$initdir"} -a ${DRACUT_RESOLVE_DEPS+-l}  ${DRACUT_FIPS_MODE+-H} "$@" || :
Harald Hoyer f8c4a0
-        return $ret
Harald Hoyer f8c4a0
-    }
Harald Hoyer f8c4a0
-
Harald Hoyer f8c4a0
-    inst_library() {
Harald Hoyer f8c4a0
-        [[ -e ${initdir}/"${2:-$1}" ]] && return 0  # already there
Harald Hoyer f8c4a0
-        [[ -e $1 ]] || return 1  # no source
Harald Hoyer f8c4a0
-        $DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l}  ${DRACUT_FIPS_MODE+-H} "$@"
Harald Hoyer f8c4a0
-        (($? != 0)) && derror $DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l}  ${DRACUT_FIPS_MODE+-H} "$@" || :
Harald Hoyer f8c4a0
-    }
Harald Hoyer f8c4a0
-
Harald Hoyer f8c4a0
-    inst_binary() {
Harald Hoyer f8c4a0
-        $DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l}  ${DRACUT_FIPS_MODE+-H} "$@"
Harald Hoyer f8c4a0
-        (($? != 0)) && derror $DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l}  ${DRACUT_FIPS_MODE+-H} "$@" || :
Harald Hoyer f8c4a0
-    }
Harald Hoyer f8c4a0
-
Harald Hoyer f8c4a0
-    inst_script() {
Harald Hoyer f8c4a0
-        $DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l}  ${DRACUT_FIPS_MODE+-H} "$@"
Harald Hoyer f8c4a0
-        (($? != 0)) && derror $DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l}  ${DRACUT_FIPS_MODE+-H} "$@" || :
Harald Hoyer f8c4a0
-    }
Harald Hoyer f8c4a0
-
Harald Hoyer f8c4a0
-else
Harald Hoyer f8c4a0
-
Harald Hoyer f8c4a0
-    # Install a directory, keeping symlinks as on the original system.
Harald Hoyer f8c4a0
-    # Example: if /lib points to /lib64 on the host, "inst_dir /lib/file"
Harald Hoyer f8c4a0
-    # will create ${initdir}/lib64, ${initdir}/lib64/file,
Harald Hoyer f8c4a0
-    # and a symlink ${initdir}/lib -> lib64.
Harald Hoyer f8c4a0
-    inst_dir() {
Harald Hoyer f8c4a0
-        [[ -e ${initdir}/"$1" ]] && return 0  # already there
Harald Hoyer f8c4a0
-
Harald Hoyer f8c4a0
-        local _dir="$1" _part="${1%/*}" _file
Harald Hoyer f8c4a0
-        while [[ "$_part" != "${_part%/*}" ]] && ! [[ -e "${initdir}/${_part}" ]]; do
Harald Hoyer f8c4a0
-            _dir="$_part $_dir"
Harald Hoyer f8c4a0
-            _part=${_part%/*}
Harald Hoyer f8c4a0
-        done
Harald Hoyer f8c4a0
-
Harald Hoyer f8c4a0
-        # iterate over parent directories
Harald Hoyer f8c4a0
-        for _file in $_dir; do
Harald Hoyer f8c4a0
-            [[ -e "${initdir}/$_file" ]] && continue
Harald Hoyer f8c4a0
-            if [[ -L $_file ]]; then
Harald Hoyer f8c4a0
-                inst_symlink "$_file"
Harald Hoyer f8c4a0
-            else
Harald Hoyer f8c4a0
-            # create directory
Harald Hoyer f8c4a0
-                mkdir -m 0755 -p "${initdir}/$_file" || return 1
Harald Hoyer f8c4a0
-                [[ -e "$_file" ]] && chmod --reference="$_file" "${initdir}/$_file"
Harald Hoyer f8c4a0
-                chmod u+w "${initdir}/$_file"
Harald Hoyer f8c4a0
-            fi
Harald Hoyer f8c4a0
-        done
Harald Hoyer f8c4a0
-    }
Harald Hoyer f8c4a0
 
Harald Hoyer f8c4a0
-    # $1 = file to copy to ramdisk
Harald Hoyer f8c4a0
-    # $2 (optional) Name for the file on the ramdisk
Harald Hoyer f8c4a0
-    # Location of the image dir is assumed to be $initdir
Harald Hoyer f8c4a0
-    # We never overwrite the target if it exists.
Harald Hoyer f8c4a0
-    inst_simple() {
Harald Hoyer f8c4a0
-        [[ -f "$1" ]] || return 1
Harald Hoyer f8c4a0
-        [[ "$1" == */* ]] || return 1
Harald Hoyer f8c4a0
-        local _src=$1 _target="${2:-$1}"
Harald Hoyer f8c4a0
-
Harald Hoyer f8c4a0
-        [[ -L $_src ]] && { inst_symlink $_src $_target; return $?; }
Harald Hoyer f8c4a0
-
Harald Hoyer f8c4a0
-        if ! [[ -d ${initdir}/$_target ]]; then
Harald Hoyer f8c4a0
-            [[ -e ${initdir}/$_target ]] && return 0
Harald Hoyer f8c4a0
-            [[ -L ${initdir}/$_target ]] && return 0
Harald Hoyer f8c4a0
-            [[ -d "${initdir}/${_target%/*}" ]] || inst_dir "${_target%/*}"
Harald Hoyer f8c4a0
-        fi
Harald Hoyer f8c4a0
-        if [[ $DRACUT_FIPS_MODE ]]; then
Harald Hoyer f8c4a0
-            # install checksum files also
Harald Hoyer f8c4a0
-            if [[ -e "${_src%/*}/.${_src##*/}.hmac" ]]; then
Harald Hoyer f8c4a0
-                inst "${_src%/*}/.${_src##*/}.hmac" "${_target%/*}/.${_target##*/}.hmac"
Harald Hoyer f8c4a0
-            fi
Harald Hoyer f8c4a0
-            if [[ -e "/lib/fipscheck/${_src##*/}.hmac" ]]; then
Harald Hoyer f8c4a0
-                inst "/lib/fipscheck/${_src##*/}.hmac" "/lib/fipscheck/${_target##*/}.hmac"
Harald Hoyer f8c4a0
-            fi
Harald Hoyer f8c4a0
-            if [[ -e "/lib64/fipscheck/${_src##*/}.hmac" ]]; then
Harald Hoyer f8c4a0
-                inst "/lib64/fipscheck/${_src##*/}.hmac" "/lib64/fipscheck/${_target##*/}.hmac"
Harald Hoyer f8c4a0
-            fi
Harald Hoyer f8c4a0
-        fi
Harald Hoyer f8c4a0
-        ddebug "Installing $_src"
Harald Hoyer f8c4a0
-        cp --reflink=auto --sparse=auto -pfL "$_src" "${initdir}/$_target"
Harald Hoyer f8c4a0
-    }
Harald Hoyer f8c4a0
+if ! [[ $DRACUT_INSTALL ]]; then
Harald Hoyer f8c4a0
+    DRACUT_INSTALL=$(find_binary dracut-install)
Harald Hoyer f8c4a0
+fi
Harald Hoyer f8c4a0
 
Harald Hoyer f8c4a0
-    # same as above, but specialized for symlinks
Harald Hoyer f8c4a0
-    inst_symlink() {
Harald Hoyer f8c4a0
-        local _src=$1 _target=${2:-$1} _realsrc
Harald Hoyer f8c4a0
-        [[ "$1" == */* ]] || return 1
Harald Hoyer f8c4a0
-        [[ -L $1 ]] || return 1
Harald Hoyer f8c4a0
-        [[ -L $initdir/$_target ]] && return 0
Harald Hoyer f8c4a0
-        _realsrc=$(readlink -f "$_src")
Harald Hoyer f8c4a0
-        if ! [[ -e $initdir/$_realsrc ]]; then
Harald Hoyer f8c4a0
-            if [[ -d $_realsrc ]]; then
Harald Hoyer f8c4a0
-                inst_dir "$_realsrc"
Harald Hoyer f8c4a0
-            else
Harald Hoyer f8c4a0
-                inst "$_realsrc"
Harald Hoyer f8c4a0
-            fi
Harald Hoyer f8c4a0
-        fi
Harald Hoyer f8c4a0
-        [[ ! -e $initdir/${_target%/*} ]] && inst_dir "${_target%/*}"
Harald Hoyer f8c4a0
+if ! [[ $DRACUT_INSTALL ]] && [[ -x $dracutbasedir/dracut-install ]]; then
Harald Hoyer f8c4a0
+    DRACUT_INSTALL=$dracutbasedir/dracut-install
Harald Hoyer f8c4a0
+fi
Harald Hoyer f8c4a0
 
Harald Hoyer f8c4a0
-        ln_r "${_realsrc}" "${_target}"
Harald Hoyer f8c4a0
-    }
Harald Hoyer f8c4a0
+if ! [[ -x $DRACUT_INSTALL ]]; then
Harald Hoyer f8c4a0
+    dfatal "dracut-install not found!"
Harald Hoyer f8c4a0
+    exit 10
Harald Hoyer f8c4a0
+fi
Harald Hoyer f8c4a0
 
Harald Hoyer f8c4a0
-    # Same as above, but specialized to handle dynamic libraries.
Harald Hoyer f8c4a0
-    # It handles making symlinks according to how the original library
Harald Hoyer f8c4a0
-    # is referenced.
Harald Hoyer f8c4a0
-    inst_library() {
Harald Hoyer f8c4a0
-        local _src="$1" _dest=${2:-$1} _lib _reallib _symlink
Harald Hoyer f8c4a0
-        [[ "$1" == */* ]] || return 1
Harald Hoyer f8c4a0
-        [[ -e $initdir/$_dest ]] && return 0
Harald Hoyer f8c4a0
-        if [[ -L $_src ]]; then
Harald Hoyer f8c4a0
-            if [[ $DRACUT_FIPS_MODE ]]; then
Harald Hoyer f8c4a0
-                # install checksum files also
Harald Hoyer f8c4a0
-                if [[ -e "${_src%/*}/.${_src##*/}.hmac" ]]; then
Harald Hoyer f8c4a0
-                    inst "${_src%/*}/.${_src##*/}.hmac" "${_dest%/*}/.${_dest##*/}.hmac"
Harald Hoyer f8c4a0
-                fi
Harald Hoyer f8c4a0
-                if [[ -e "/lib/fipscheck/${_src##*/}.hmac" ]]; then
Harald Hoyer f8c4a0
-                    inst "/lib/fipscheck/${_src##*/}.hmac" "/lib/fipscheck/${_dest##*/}.hmac"
Harald Hoyer f8c4a0
-                fi
Harald Hoyer f8c4a0
-                if [[ -e "/lib64/fipscheck/${_src##*/}.hmac" ]]; then
Harald Hoyer f8c4a0
-                    inst "/lib64/fipscheck/${_src##*/}.hmac" "/lib64/fipscheck/${_dest##*/}.hmac"
Harald Hoyer f8c4a0
-                fi
Harald Hoyer f8c4a0
-            fi
Harald Hoyer f8c4a0
-            _reallib=$(readlink -f "$_src")
Harald Hoyer f8c4a0
-            inst_simple "$_reallib" "$_reallib"
Harald Hoyer f8c4a0
-            inst_dir "${_dest%/*}"
Harald Hoyer f8c4a0
-            ln_r "${_reallib}" "${_dest}"
Harald Hoyer f8c4a0
-        else
Harald Hoyer f8c4a0
-            inst_simple "$_src" "$_dest"
Harald Hoyer f8c4a0
-        fi
Harald Hoyer f8c4a0
+[[ $DRACUT_RESOLVE_LAZY ]] || export DRACUT_RESOLVE_DEPS=1
Harald Hoyer f8c4a0
+inst_dir() {
Harald Hoyer f8c4a0
+    [[ -e ${initdir}/"$1" ]] && return 0  # already there
Harald Hoyer f8c4a0
+    $DRACUT_INSTALL ${initdir+-D "$initdir"} -d "$@"
Harald Hoyer f8c4a0
+    (($? != 0)) && derror $DRACUT_INSTALL ${initdir+-D "$initdir"} -d "$@" || :
Harald Hoyer f8c4a0
+}
Harald Hoyer f8c4a0
 
Harald Hoyer f8c4a0
-        # Create additional symlinks.  See rev_symlinks description.
Harald Hoyer f8c4a0
-        for _symlink in $(rev_lib_symlinks $_src) $(rev_lib_symlinks $_reallib); do
Harald Hoyer f8c4a0
-            [[ ! -e $initdir/$_symlink ]] && {
Harald Hoyer f8c4a0
-                ddebug "Creating extra symlink: $_symlink"
Harald Hoyer f8c4a0
-                inst_symlink $_symlink
Harald Hoyer f8c4a0
-            }
Harald Hoyer f8c4a0
-        done
Harald Hoyer f8c4a0
-    }
Harald Hoyer f8c4a0
+inst() {
Harald Hoyer f8c4a0
+    [[ -e ${initdir}/"${2:-$1}" ]] && return 0  # already there
Harald Hoyer f8c4a0
+        #dinfo "$DRACUT_INSTALL -l $@"
Harald Hoyer f8c4a0
+    $DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@"
Harald Hoyer f8c4a0
+    (($? != 0)) && derror $DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l} ${DRACUT_FIPS_MODE+-H} "$@" || :
Harald Hoyer f8c4a0
+}
Harald Hoyer f8c4a0
 
Harald Hoyer f8c4a0
-    # Same as above, but specialized to install binary executables.
Harald Hoyer f8c4a0
-    # Install binary executable, and all shared library dependencies, if any.
Harald Hoyer f8c4a0
-    inst_binary() {
Harald Hoyer f8c4a0
-        local _bin _target
Harald Hoyer f8c4a0
-        _bin=$(find_binary "$1") || return 1
Harald Hoyer f8c4a0
-        _target=${2:-$_bin}
Harald Hoyer f8c4a0
-        [[ -e $initdir/$_target ]] && return 0
Harald Hoyer f8c4a0
-        local _file _line
Harald Hoyer f8c4a0
-        local _so_regex='([^ ]*/lib[^/]*/[^ ]*\.so[^ ]*)'
Harald Hoyer f8c4a0
-        # I love bash!
Harald Hoyer f8c4a0
-        LC_ALL=C ldd "$_bin" 2>/dev/null | while read _line; do
Harald Hoyer f8c4a0
-            [[ $_line = 'not a dynamic executable' ]] && break
Harald Hoyer f8c4a0
-
Harald Hoyer f8c4a0
-            if [[ $_line =~ $_so_regex ]]; then
Harald Hoyer f8c4a0
-                _file=${BASH_REMATCH[1]}
Harald Hoyer f8c4a0
-                [[ -e ${initdir}/$_file ]] && continue
Harald Hoyer f8c4a0
-                inst_library "$_file"
Harald Hoyer f8c4a0
-                continue
Harald Hoyer f8c4a0
-            fi
Harald Hoyer f8c4a0
+inst_simple() {
Harald Hoyer f8c4a0
+    [[ -e ${initdir}/"${2:-$1}" ]] && return 0  # already there
Harald Hoyer f8c4a0
+    [[ -e $1 ]] || return 1  # no source
Harald Hoyer f8c4a0
+    $DRACUT_INSTALL ${initdir+-D "$initdir"} "$@"
Harald Hoyer f8c4a0
+    (($? != 0)) && derror $DRACUT_INSTALL ${initdir+-D "$initdir"} "$@" || :
Harald Hoyer f8c4a0
+}
Harald Hoyer f8c4a0
 
Harald Hoyer f8c4a0
-            if [[ $_line == *not\ found* ]]; then
Harald Hoyer f8c4a0
-                dfatal "Missing a shared library required by $_bin."
Harald Hoyer f8c4a0
-                dfatal "Run \"ldd $_bin\" to find out what it is."
Harald Hoyer f8c4a0
-                dfatal "$_line"
Harald Hoyer f8c4a0
-                dfatal "dracut cannot create an initrd."
Harald Hoyer f8c4a0
-                exit 1
Harald Hoyer f8c4a0
-            fi
Harald Hoyer f8c4a0
-        done
Harald Hoyer f8c4a0
-        inst_simple "$_bin" "$_target"
Harald Hoyer f8c4a0
-    }
Harald Hoyer f8c4a0
+inst_symlink() {
Harald Hoyer f8c4a0
+    [[ -e ${initdir}/"${2:-$1}" ]] && return 0  # already there
Harald Hoyer f8c4a0
+    [[ -L $1 ]] || return 1
Harald Hoyer f8c4a0
+    $DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l}  ${DRACUT_FIPS_MODE+-H} "$@"
Harald Hoyer f8c4a0
+    (($? != 0)) && derror $DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l}  ${DRACUT_FIPS_MODE+-H} "$@" || :
Harald Hoyer f8c4a0
+}
Harald Hoyer f8c4a0
 
Harald Hoyer f8c4a0
-    # same as above, except for shell scripts.
Harald Hoyer f8c4a0
-    # If your shell script does not start with shebang, it is not a shell script.
Harald Hoyer f8c4a0
-    inst_script() {
Harald Hoyer f8c4a0
-        local _bin
Harald Hoyer f8c4a0
-        _bin=$(find_binary "$1") || return 1
Harald Hoyer f8c4a0
-        shift
Harald Hoyer f8c4a0
-        local _line _shebang_regex
Harald Hoyer f8c4a0
-        read -r -n 80 _line <"$_bin"
Harald Hoyer f8c4a0
-        # If debug is set, clean unprintable chars to prevent messing up the term
Harald Hoyer f8c4a0
-        [[ $debug ]] && _line=$(echo -n "$_line" | tr -c -d '[:print:][:space:]')
Harald Hoyer f8c4a0
-        _shebang_regex='(#! *)(/[^ ]+).*'
Harald Hoyer f8c4a0
-        [[ $_line =~ $_shebang_regex ]] || return 1
Harald Hoyer f8c4a0
-        inst "${BASH_REMATCH[2]}" && inst_simple "$_bin" "$@"
Harald Hoyer f8c4a0
-    }
Harald Hoyer f8c4a0
+dracut_install() {
Harald Hoyer f8c4a0
+    local ret
Harald Hoyer f8c4a0
+        #dinfo "initdir=$initdir $DRACUT_INSTALL -l $@"
Harald Hoyer f8c4a0
+    $DRACUT_INSTALL ${initdir+-D "$initdir"} -a ${DRACUT_RESOLVE_DEPS+-l}  ${DRACUT_FIPS_MODE+-H} "$@"
Harald Hoyer f8c4a0
+    ret=$?
Harald Hoyer f8c4a0
+    (($ret != 0)) && derror $DRACUT_INSTALL ${initdir+-D "$initdir"} -a ${DRACUT_RESOLVE_DEPS+-l}  ${DRACUT_FIPS_MODE+-H} "$@" || :
Harald Hoyer f8c4a0
+    return $ret
Harald Hoyer f8c4a0
+}
Harald Hoyer f8c4a0
 
Harald Hoyer f8c4a0
-    # general purpose installation function
Harald Hoyer f8c4a0
-    # Same args as above.
Harald Hoyer f8c4a0
-    inst() {
Harald Hoyer f8c4a0
-        local _x
Harald Hoyer f8c4a0
-
Harald Hoyer f8c4a0
-        case $# in
Harald Hoyer f8c4a0
-            1) ;;
Harald Hoyer f8c4a0
-            2) [[ ! $initdir && -d $2 ]] && export initdir=$2
Harald Hoyer f8c4a0
-                [[ $initdir = $2 ]] && set $1;;
Harald Hoyer f8c4a0
-            3) [[ -z $initdir ]] && export initdir=$2
Harald Hoyer f8c4a0
-                set $1 $3;;
Harald Hoyer f8c4a0
-            *) dfatal "inst only takes 1 or 2 or 3 arguments"
Harald Hoyer f8c4a0
-                exit 1;;
Harald Hoyer f8c4a0
-        esac
Harald Hoyer f8c4a0
-        for _x in inst_symlink inst_script inst_binary inst_simple; do
Harald Hoyer f8c4a0
-            $_x "$@" && return 0
Harald Hoyer f8c4a0
-        done
Harald Hoyer f8c4a0
-        return 1
Harald Hoyer f8c4a0
-    }
Harald Hoyer f8c4a0
+inst_library() {
Harald Hoyer f8c4a0
+    [[ -e ${initdir}/"${2:-$1}" ]] && return 0  # already there
Harald Hoyer f8c4a0
+    [[ -e $1 ]] || return 1  # no source
Harald Hoyer f8c4a0
+    $DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l}  ${DRACUT_FIPS_MODE+-H} "$@"
Harald Hoyer f8c4a0
+    (($? != 0)) && derror $DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l}  ${DRACUT_FIPS_MODE+-H} "$@" || :
Harald Hoyer f8c4a0
+}
Harald Hoyer f8c4a0
 
Harald Hoyer f8c4a0
-    # dracut_install [-o ] <file> [<file> ... ]
Harald Hoyer f8c4a0
-    # Install <file> to the initramfs image
Harald Hoyer f8c4a0
-    # -o optionally install the <file> and don't fail, if it is not there
Harald Hoyer f8c4a0
-    dracut_install() {
Harald Hoyer f8c4a0
-        local _optional=no
Harald Hoyer f8c4a0
-        if [[ $1 = '-o' ]]; then
Harald Hoyer f8c4a0
-            _optional=yes
Harald Hoyer f8c4a0
-            shift
Harald Hoyer f8c4a0
-        fi
Harald Hoyer f8c4a0
-        while (($# > 0)); do
Harald Hoyer f8c4a0
-            if ! inst "$1" ; then
Harald Hoyer f8c4a0
-                if [[ $_optional = yes ]]; then
Harald Hoyer f8c4a0
-                    dinfo "Skipping program $1 as it cannot be found and is" \
Harald Hoyer f8c4a0
-                        "flagged to be optional"
Harald Hoyer f8c4a0
-                else
Harald Hoyer f8c4a0
-                    dfatal "Failed to install $1"
Harald Hoyer f8c4a0
-                    exit 1
Harald Hoyer f8c4a0
-                fi
Harald Hoyer f8c4a0
-            fi
Harald Hoyer f8c4a0
-            shift
Harald Hoyer f8c4a0
-        done
Harald Hoyer f8c4a0
-    }
Harald Hoyer f8c4a0
+inst_binary() {
Harald Hoyer f8c4a0
+    $DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l}  ${DRACUT_FIPS_MODE+-H} "$@"
Harald Hoyer f8c4a0
+    (($? != 0)) && derror $DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l}  ${DRACUT_FIPS_MODE+-H} "$@" || :
Harald Hoyer f8c4a0
+}
Harald Hoyer f8c4a0
 
Harald Hoyer f8c4a0
-fi
Harald Hoyer f8c4a0
+inst_script() {
Harald Hoyer f8c4a0
+    $DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l}  ${DRACUT_FIPS_MODE+-H} "$@"
Harald Hoyer f8c4a0
+    (($? != 0)) && derror $DRACUT_INSTALL ${initdir+-D "$initdir"} ${DRACUT_RESOLVE_DEPS+-l}  ${DRACUT_FIPS_MODE+-H} "$@" || :
Harald Hoyer f8c4a0
+}
Harald Hoyer f8c4a0
 
Harald Hoyer f8c4a0
 # find symlinks linked to given library file
Harald Hoyer f8c4a0
 # $1 = library file