]> git.ipfire.org Git - thirdparty/dracut-ng.git/commitdiff
chore: eliminate overlapping functions
authorJo Zzsi <jozzsicsataban@gmail.com>
Tue, 15 Jul 2025 02:06:42 +0000 (22:06 -0400)
committerLaszlo <laszlo.gombos@gmail.com>
Tue, 15 Jul 2025 13:55:55 +0000 (09:55 -0400)
In its current form inst_library function executes the same set of
commands as the inst function.

Copying (instead of reusing code) is usually preferred, especially
in this particular case where inst_library function is not used by
dracut, so it is not tested by dracut CI.

After this commit, inst_library would just call inst, and inst
is being used and as such tested by dracut CI, so it makes it
less likely to egress out-of tree coide depending on dracut.

dracut-init.sh

index 538dd6e2f032c3275aab033743a6a5fd45cc56bd..82dcdf05429f4abdfc36318cfdfbf50793fe1c27 100755 (executable)
@@ -345,20 +345,7 @@ dracut_instmods() {
 # 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 "$@"
 }
 
 inst_binary() {