]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
dracut.sh, dracut-functions.sh: add dracut_kernel_post()
authorHarald Hoyer <harald@redhat.com>
Wed, 27 Jun 2012 15:02:49 +0000 (17:02 +0200)
committerHarald Hoyer <harald@redhat.com>
Fri, 29 Jun 2012 10:41:28 +0000 (12:41 +0200)
dracut_kernel_post() does lazy kernel module dependency installation,
depmod and cleans up temporary files

dracut-functions.sh
dracut.sh
test/TEST-30-ISCSI/hosts [new file with mode: 0644]

index 7ec20cb331182dd023db59c3b9779972f16a4579..696f64715528a5facf2771308f16a8facde6e1d6 100755 (executable)
@@ -22,6 +22,7 @@
 
 [[ $initdir ]] || { echo "ERROR: initdir $initdir not set" 2>&1; exit 10; }
 [[ -d $initdir ]] || mkdir -p $initdir
+[[ -d "$initdir/.kernelmodseen" ]] || mkdir -p "$initdir/.kernelmodseen"
 export initdir
 
 # Generic substring function.  If $2 is in $1, return 0.
@@ -1122,7 +1123,7 @@ for_each_kmod_dep() {
     )
 }
 
-do_lazy_kmod_dep() {
+dracut_kernel_post() {
     local _moddirname=${srcmods%%/lib/modules/*}
 
     [[ -f "$initdir/.kernelmodseen/lazylist" ]] || return 0
@@ -1150,6 +1151,26 @@ do_lazy_kmod_dep() {
         done
     done
     wait
+
+    for _f in modules.builtin.bin modules.builtin; do
+        [[ $srcmods/$_f ]] && break
+    done || {
+        dfatal "No modules.builtin.bin and modules.builtin found!"
+        return 1
+    }
+
+    for _f in modules.builtin.bin modules.builtin modules.order; do
+        [[ $srcmods/$_f ]] && inst_simple "$srcmods/$_f" "/lib/modules/$kernel/$_f"
+    done
+
+    # generate module dependencies for the initrd
+    if [[ -d $initdir/lib/modules/$kernel ]] && \
+        ! depmod -a -b "$initdir" $kernel; then
+        dfatal "\"depmod -a $kernel\" failed."
+        exit 1
+    fi
+
+    rm -fr "$initdir/.kernelmodseen"
 }
 
 find_kernel_modules_by_path () (
index 0f475f5af97fd59b144fa5de2641a18ca39ed2f1..1caf351d9f9141e4669b5a160d29e0933a7de325 100755 (executable)
--- a/dracut.sh
+++ b/dracut.sh
@@ -720,8 +720,6 @@ if [[ $kernel_only != yes ]]; then
     fi
 fi
 
-mkdir -p "$initdir/.kernelmodseen"
-
 mods_to_load=""
 # check all our modules to see if they should be sourced.
 # This builds a list of modules that we will install next.
@@ -774,16 +772,9 @@ dinfo "*** Including modules done ***"
 ## final stuff that has to happen
 
 dinfo "*** Installing kernel module dependencies and firmware ***"
-do_lazy_kmod_dep
+dracut_kernel_post
 dinfo "*** Installing kernel module dependencies and firmware done ***"
 
-# generate module dependencies for the initrd
-if [[ -d $initdir/lib/modules/$kernel ]] && \
-    ! depmod -a -b "$initdir" $kernel; then
-    dfatal "\"depmod -a $kernel\" failed."
-    exit 1
-fi
-
 while pop include_src src && pop include_target tgt; do
     if [[ $src && $tgt ]]; then
         if [[ -f $src ]]; then
@@ -837,8 +828,6 @@ if [[ $kernel_only != yes ]]; then
     fi
 fi
 
-rm -fr "$initdir/.kernelmodseen"
-
 if (($maxloglvl >= 5)); then
     ddebug "Listing sizes of included files:"
     du -c "$initdir" | sort -n | ddebug
diff --git a/test/TEST-30-ISCSI/hosts b/test/TEST-30-ISCSI/hosts
new file mode 100644 (file)
index 0000000..f8c18b6
--- /dev/null
@@ -0,0 +1,8 @@
+127.0.0.1      localhost
+192.168.50.1   server
+192.168.50.2   server-ip
+192.168.50.3   server-proto-ip
+192.168.50.100 workstation1
+192.168.50.101 workstation2
+192.168.50.102 workstation3
+192.168.50.103 workstation4