[readonly/geninitrd/BUSYBOX: 8/113] - generate initrd for 2.4.0 kernel too (but find is used) - use mktemp - fix one typo (mount -> umou

draenog draenog at pld-linux.org
Sat Nov 2 19:10:42 CET 2013


commit 526ea24a96d34ed90cb9747dc59d15c71e473dcc
Author: Artur Frysiak <artur at frysiak.net>
Date:   Wed Nov 15 13:55:01 2000 +0000

    - generate initrd for 2.4.0 kernel too (but find is used)
    - use mktemp
    - fix one typo (mount -> umount)
    
    
    svn-id: @1160

 geninitrd | 45 +++++++++++++++++++--------------------------
 1 file changed, 19 insertions(+), 26 deletions(-)
---
diff --git a/geninitrd b/geninitrd
index 67893e5..4ebeb06 100755
--- a/geninitrd
+++ b/geninitrd
@@ -4,7 +4,7 @@
 #
 #	by Jacek Konieczny <jajcus at pld.org.pl>
 #
-# based on geninitrd written by Erik Troan <ewt at redhat.com>
+# based on mkinitrd written by Erik Troan <ewt at redhat.com>
 # and contributors:
 #	Elliot Lee <sopwith at cuc.edu>
 #	Miguel de Icaza <miguel at nuclecu.unam.mx>
@@ -58,29 +58,22 @@ usage () {
 
 findmodule() {
     skiperrors=""
-    modName=$2
+    modName=$1
     if [ $(echo $modName | cut -b1) = "-" ]; then
 	skiperrors=1
 	modName=$(echo $modName | cut -b2-)
     fi
 
     if [ "$modName" = "pluto" ]; then
-	findmodule "" fc4
-	findmodule "" soc
+	findmodule fc4
+	findmodule soc
     fi
     if [ "$modName" = "fcal" ]; then
-	findmodule "" fc4
-	findmodule "" socal
-    fi
-    if [ -n "$1" ]; then
-	fmPath="$1"/"$modName".o
-    else
-	fmPath=`(cd /lib/modules/$kernel; echo */$modName.o)`
+	findmodule fc4
+	findmodule socal
     fi
 
-    if [ "$1" = "fs" ] && [ ! -f /lib/modules/$kernel/$fmPath ]; then
-	fmPath="$1"/"${modName}fs".o
-    fi
+    fmPath=`(cd /lib/modules/$kernel; find -type f -name $modName.o)`
 
     if [ ! -f /lib/modules/$kernel/$fmPath ]; then
 	if [ -n "$skiperrors" ]; then
@@ -250,7 +243,7 @@ if [ ! -d /lib/modules/$kernel ]; then
 fi
 
 for n in $PREMODS; do
-	findmodule "" $n
+	findmodule $n
 done
 
 rootdev=$(awk '{ if ($2 == "/") { print $1; }}' $fstab)
@@ -266,11 +259,11 @@ if is_yes "$PROBESCSI" && echo "$rootdev" | grep -q "^/dev/sd" ; then
 			for n in $scsimodules; do
     		# for now allow scsi modules to come from anywhere.  There are some
     		# RAID controllers with drivers in block/
-	    		findmodule "" $n
+	    		findmodule $n
 			done
     		fi
 	else
-	    findmodule scsi $n
+	    findmodule $n
 	fi
     done
 
@@ -278,7 +271,7 @@ fi
 
 if is_yes "$PROBEIDE" && echo "$rootdev" | grep -q "^/dev/hd" ; then
     for n in $PREIDEMODS; do
-	    findmodule block $n
+	    findmodule $n
     done
 fi
 
@@ -289,7 +282,7 @@ if is_yes "$PROBERAID" ; then
 			  awk '{print $2}' | LC_ALL=C sort -u) ; do
 	    case $number in
 	    [0145])
-		findmodule "" raid$number
+		findmodule raid$number
 		;;
 	    *)
 		echo "raid level $number (in /etc/raidtab) not recognized" >&2
@@ -314,15 +307,15 @@ if echo $rootdev | cut -d/ -f3 | grep loop >/dev/null; then
     loopFile=$(echo $line | awk '{print $5}')
 
     BASICMODULES="$BASICMODULES -loop"
-    findmodule fs "-$loopFs"
+    findmodule "-$loopFs"
     BASICMODULES="$BASICMODULES -${loopFs}"
 else # Check for other filesystems
     rootFs=`awk '{if ($2 == "/") {print $3}}' $fstab`
-    findmodule fs "-$rootFs"
+    findmodule "-$rootFs"
 fi
 
 for n in $BASICMODULES; do 
-    findmodule "" $n
+    findmodule $n
 done
 
 if [ -n "$ifneeded" -a -z "$MODULES" ]; then
@@ -336,9 +329,9 @@ if [ -n "$verbose" ]; then
     echo "Using modules: $MODULES"
 fi
 
-MNTIMAGE=/tmp/initrd.$$
-IMAGE=/tmp/initrd.img-$$
-MNTPOINT=/tmp/initrd.mnt-$$
+MNTIMAGE=`mktemp -d /tmp/initrd.XXXXXX`
+IMAGE=`mktemp /tmp/initrd.img-XXXXXX`
+MNTPOINT=`mktemp -d /tmp/initrd.mnt-XXXXXX`
 RCFILE=$MNTIMAGE/linuxrc
 
 if [ -f $MNTIMAGE ]; then
@@ -447,7 +440,7 @@ chmod +x $RCFILE
 
 case "$FS" in
 	ext2)
-		mount $MNTPOINT
+		umount $MNTPOINT
 		losetup -d $LODEV
 		;;
 	rom)
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/readonly/geninitrd.git/commitdiff/0999a53e93eedcf489380684b998ce04aaddf11c



More information about the pld-cvs-commit mailing list