]> git.ipfire.org Git - thirdparty/dracut.git/blobdiff - dracut-init.sh
Fix 98dracut-systemd/dracut-emergency.sh
[thirdparty/dracut.git] / dracut-init.sh
index 53e6f13a257d1b99a97682c09a1d61616533b85e..50d23e2d110dd1f220eb134e7a5cb5adf3211277 100644 (file)
@@ -267,6 +267,18 @@ inst_fsck_help() {
     (($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l}  ${DRACUT_FIPS_MODE:+-f} "$2" $_helper || :
 }
 
+# Use with form hostonly="$(optional_hostonly)" inst_xxxx <args>
+# If hosotnly mode is set to "strict", hostonly restrictions will still
+# be applied, else will ignore hostonly mode and try to install all
+# given modules.
+optional_hostonly() {
+    if [[ $hostonly_mode = "strict" ]]; then
+        printf -- "$hostonly"
+    else
+        printf ""
+    fi
+}
+
 mark_hostonly() {
     for i in "$@"; do
         echo "$i" >> "$initdir/lib/dracut/hostonly-files"
@@ -942,7 +954,7 @@ for_each_kmod_dep() {
 
 dracut_kernel_post() {
     for _f in modules.builtin.bin modules.builtin modules.order; do
-        [[ $srcmods/$_f ]] && inst_simple "$srcmods/$_f" "/lib/modules/$kernel/$_f"
+        [[ -e $srcmods/$_f ]] && inst_simple "$srcmods/$_f" "/lib/modules/$kernel/$_f"
     done
 
     # generate module dependencies for the initrd
@@ -981,6 +993,10 @@ instmods() {
         set -- "${args[@]}"
     fi
 
+    if (($# == 0)); then
+        return 0
+    fi
+
     $DRACUT_INSTALL \
         ${initdir:+-D "$initdir"} \
         ${loginstall:+-L "$loginstall"} \