]> git.ipfire.org Git - thirdparty/dracut-ng.git/commitdiff
Revert "chore: remove unused function"
authorAdam Williamson <awilliam@redhat.com>
Thu, 10 Jul 2025 17:33:21 +0000 (10:33 -0700)
committerNeal Gompa (ニール・ゴンパ) <ngompa13@gmail.com>
Fri, 11 Jul 2025 15:31:45 +0000 (11:31 -0400)
This reverts commit 81ddde54051351ea17dbb84ef6232820f96740af.
dracut itself may not use inst_library, but external modules do,
at least anaconda's does.

dracut-init.sh

index 89d80fd8d7e043ab1c98ab002b0e0c516f0c1b38..538dd6e2f032c3275aab033743a6a5fd45cc56bd 100755 (executable)
@@ -342,6 +342,25 @@ dracut_instmods() {
     fi
 }
 
+# this is not used within dracut itself, but external modules use it,
+# do not remove it!
+inst_library() {
+    local _ret _hostonly_install
+    if [[ $1 == "-H" ]]; then
+        _hostonly_install="-H"
+        shift
+    fi
+    [[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there
+    [[ -e $1 ]] || return 1                    # no source
+    if $DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@"; then
+        return 0
+    else
+        _ret=$?
+        derror FAILED: "$DRACUT_INSTALL" ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@"
+        return $_ret
+    fi
+}
+
 inst_binary() {
     local _ret
     if $DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@"; then