If we build initramfs without modules, instead of adding modprobe and
rmmod, create symlinks to /bin/true to don't produce unnecessary errors.
Anyway it's a workaround for following desired behaviour:
modprobe tries to insert module only if it's not built into kernel
---
 modules.d/99base/install |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/modules.d/99base/install b/modules.d/99base/install
index 6ba9e7e..0fd84ed 100755
--- a/modules.d/99base/install
+++ b/modules.d/99base/install
@@ -1,6 +1,13 @@
 #!/bin/bash
-dracut_install mount mknod mkdir modprobe pidof sleep chroot \
-    sed ls flock cp mv dmesg rm ln rmmod mkfifo less 
+dracut_install mount mknod mkdir pidof sleep chroot \
+    sed ls flock cp mv dmesg rm ln mkfifo less
+if [[ $no_kernel ]]; then
+    inst /bin/true
+    ln -s /bin/true "${initdir}"/sbin/modprobe
+    ln -s /bin/true "${initdir}"/sbin/rmmod
+else
+    dracut_install modprobe rmmod
+fi
 if [ ! -e "${initdir}/bin/sh" ]; then
     dracut_install bash
     (ln -s bash "${initdir}/bin/sh" || :)
@@ -18,7 +25,7 @@ if which switch_root >/dev/null 2>&1; then
     dracut_install switch_root 
 else
     inst "$moddir/switch_root" "/sbin/switch_root" \
-       || derror "Failed to install switch_root"
+            || derror "Failed to install switch_root"
 fi
 inst "$moddir/dracut-lib.sh" "/lib/dracut-lib.sh"
 inst_hook cmdline 10 "$moddir/parse-root-opts.sh"
-- 
1.7.1.1

Attachment: signature.asc
Description: PGP signature

Reply via email to