geninitrd/trunk/geninitrd
glen
cvs at pld-linux.org
Fri May 26 11:06:32 CEST 2006
Author: glen
Date: Fri May 26 11:06:30 2006
New Revision: 7446
Modified:
geninitrd/trunk/geninitrd
Log:
Reindent code with tabs and ts=4.
Modified: geninitrd/trunk/geninitrd
==============================================================================
--- geninitrd/trunk/geninitrd (original)
+++ geninitrd/trunk/geninitrd Fri May 26 11:06:30 2006
@@ -51,16 +51,16 @@
if [ -x /sbin/dmraid-initrd ]; then
USE_DMRAID="yes"
fi
-
+
usage () {
- echo "usage: `basename $0` [--version] [-v] [-f] [--ifneeded] [--preload <module>]"
- echo " [--with=<module>] [--image-version] [--fstab=<fstab>] [--nocompress]"
- echo " [--initrdfs=rom|ext2|cram] [--modules-conf=<modules.conf>]"
- echo " [--with-raidstart] [--without-raidstart] [--with-insmod-static]"
+ echo "usage: `basename $0` [--version] [-v] [-f] [--ifneeded] [--preload <module>]"
+ echo " [--with=<module>] [--image-version] [--fstab=<fstab>] [--nocompress]"
+ echo " [--initrdfs=rom|ext2|cram] [--modules-conf=<modules.conf>]"
+ echo " [--with-raidstart] [--without-raidstart] [--with-insmod-static]"
echo " [--without-bootsplash] [--lvmtoolsversion=1|2] [--without-udev]"
echo " [--without-suspend] [--without-suspend2] [--without-dmraid]"
- echo " <initrd-image> <kernel-version>"
- echo " (ex: `basename $0` /boot/initrd-2.2.5-15.img 2.2.5-15)"
+ echo " <initrd-image> <kernel-version>"
+ echo " (ex: `basename $0` /boot/initrd-2.2.5-15.img 2.2.5-15)"
exit 1
}
@@ -73,21 +73,21 @@
typeset mods module f level depfile first
depfile=/lib/modules/$kernel/modules.dep
-
+
if [ -f $depfile ] ; then
: ok
else
echo "Error: no $depfile ! Run depmod and rerun geninitrd." 1>&2
exit 1
fi
-
+
# prepend / if no path given, append $modext.gz if not given,
# quote /
origmodule="$2"
module=$(echo "$2" | \
- awk '/\// {print;next} {print "/" $0}' | \
- awk '/\./ {print;next} {print $0 "'$modext'.gz"}' |
- awk '{gsub("/","\\/");print}')
+ awk '/\// {print;next} {print "/" $0}' | \
+ awk '/\./ {print;next} {print $0 "'$modext'.gz"}' |
+ awk '{gsub("/","\\/");print}')
mods=$(awk '
BEGIN { here = 0 }
/'"$module"':(.*)/ { gsub(/:/," "); gsub(/\\/," "); print; here = 1; next }
@@ -97,9 +97,9 @@
# fallback to $modext
if [ "$mods" = "" ] ; then
- module=$(echo "$module" | \
- awk '{gsub("\'$modext'\.gz$","\'$modext'",$0);print}')
- fi
+ module=$(echo "$module" | \
+ awk '{gsub("\'$modext'\.gz$","\'$modext'",$0);print}')
+ fi
mods=$(awk '
BEGIN { here = 0 }
/'"$module"':(.*)/ { gsub(/:/," "); gsub(/\\/," "); print; here = 1; next }
@@ -111,13 +111,13 @@
if [ "$1" != silent ] ; then
echo "$origmodule: module not found in $depfile" 1>&2
fi
- if ! is_no "$EXIT_IF_MISSING" ; then
+ if ! is_no "$EXIT_IF_MISSING" ; then
exit 1
else
echo "If $origmodule isn't compiled in kernel then this initrd may not start your system". 1>&2
fi
fi
-
+
level=$3
if [ "$level" = "" ] ; then
level=0
@@ -127,7 +127,7 @@
echo "$origmodule: cycle in $depfile" 1>&2
exit 1
fi
-
+
first=
for f in $mods ; do
if [ "$first" = "" ] ; then
@@ -136,7 +136,7 @@
find_depmod $1 $f $level
fi
done
-
+
echo $first
}
@@ -188,10 +188,9 @@
exit 1
fi
fi
-
+
for mod in $allModulesToFind ; do
- mod=$(echo $mod | \
- awk '{sub(/^\/lib\/modules\/[^\/]*\//,"");print}')
+ mod=$(echo $mod | awk '{sub(/^\/lib\/modules\/[^\/]*\//,"");print}')
addmodule $mod "$skiperrors"
done
}
@@ -330,49 +329,48 @@
}
find_modules_softraid() {
- if [ -f /etc/mdadm.conf ] ; then
- [ -n "$verbose" ] && echo "Finding RAID details using mdadm for rootdev=$1"
- eval `/sbin/mdadm -v --examine --scan --config=/etc/mdadm.conf | \
- awk -v rootdev="$1" '
- BEGIN {
- found = "no";
- dev_list = "";
- raidlevel = ""
- rootdev_devfs = rootdev;
- if (rootdev ~ /\/dev\/md\/[0-9]/) {
- gsub(/\/dev\/md\//,"/dev/md",rootdev_devfs);
+ if [ -f /etc/mdadm.conf ]; then
+ [ -n "$verbose" ] && echo "Finding RAID details using mdadm for rootdev=$1"
+ eval `/sbin/mdadm -v --examine --scan --config=/etc/mdadm.conf | awk -v rootdev="$1" '
+ BEGIN {
+ found = "no";
+ dev_list = "";
+ raidlevel = ""
+ rootdev_devfs = rootdev;
+ if (rootdev ~ /\/dev\/md\/[0-9]/) {
+ gsub(/\/dev\/md\//,"/dev/md",rootdev_devfs);
+ }
}
- }
- /^ARRAY/ {
- if (($2 == rootdev) || ($2 == rootdev_devfs)) {
- raidlevel=$3;
- gsub(/level=/,NUL,raidlevel);
- if (raidlevel ~ /^raid([0-6]|10)/) {
- gsub(/raid/,NUL,raidlevel);
- };
- found="yes";
- getline x;
- if (x ~ /devices=/) {
- dev_list = x;
- gsub(".*devices=", NUL, dev_list);
- gsub(",", " ", dev_list);
+ /^ARRAY/ {
+ if (($2 == rootdev) || ($2 == rootdev_devfs)) {
+ raidlevel=$3;
+ gsub(/level=/,NUL,raidlevel);
+ if (raidlevel ~ /^raid([0-6]|10)/) {
+ gsub(/raid/,NUL,raidlevel);
+ };
+ found="yes";
+ getline x;
+ if (x ~ /devices=/) {
+ dev_list = x;
+ gsub(".*devices=", NUL, dev_list);
+ gsub(",", " ", dev_list);
+ }
+ }
}
- }
- }
-
- END {
- print "raidfound=" found;
- print "raidlevel=" raidlevel;
- print "dev_list=\"" dev_list "\"";
- }'`
- fi
+
+ END {
+ print "raidfound=" found;
+ print "raidlevel=" raidlevel;
+ print "dev_list=\"" dev_list "\"";
+ }'`
+ fi
if [ "$raidfound" != "yes" -a -f /etc/raidtab ]; then
echo "ERROR: raidtools are not longer supported. Please migrate to mdadm setup!" 1>&2
exit 1
fi
-
+
if is_yes "$raidfound" ; then
case "$raidlevel" in
[01456]|10)
@@ -386,14 +384,14 @@
;;
esac
else
- echo "ERROR: RAID devices not found for \"$1\", check your configuration!" 1>&2
+ echo "ERROR: RAID devices not found for \"$1\", check your configuration!" 1>&2
exit 1
fi
rootdev_nr=$(( $rootdev_nr + 1 ))
eval "rootdev${rootdev_nr}=\"$1\""
eval "dev_list${rootdev_nr}=\"${dev_list}\""
-
+
for device in $dev_list; do
find_modules_for $device
done
@@ -417,92 +415,100 @@
}
find_modules_ide() {
- typeset rootdev
+ typeset rootdev
- rootdev="$(echo "$1" | awk ' { gsub(/\/dev\//,NUL); gsub(/[0-9].*/, NUL); print $0 } ')"
- if [ "$pack_version_long" -lt "002004021" ]; then
- [ -n "$verbose" ] && echo "Finding IDE modules for kernels <= 2.4.20"
- for n in $PREIDEMODSOLD; do
- findmodule "$n"
- done
+ rootdev="$(echo "$1" | awk ' { gsub(/\/dev\//,NUL); gsub(/[0-9].*/, NUL); print $0 } ')"
+ if [ "$pack_version_long" -lt "002004021" ]; then
+ [ -n "$verbose" ] && echo "Finding IDE modules for kernels <= 2.4.20"
+ for n in $PREIDEMODSOLD; do
+ findmodule "$n"
+ done
else
- tryauto=1
- for n in $PREIDEMODS; do
- if [ "X$n" = "Xunknown" ] ; then
- if [ -f "$modulefile" ]; then
- [ -n "$verbose" ] && echo "Finding IDE modules using ide_hostadapter"
- idemodules="`awk '/ide_hostadapter/ && ! /^[\t ]*#/ { print $3; }' $modulefile`"
- for na in $idemodules; do
- tryauto=0;
- findmodule "$na"
- done
- fi
+ tryauto=1
+ for n in $PREIDEMODS; do
+ if [ "X$n" = "Xunknown" ] ; then
+ if [ -f "$modulefile" ]; then
+ [ -n "$verbose" ] && echo "Finding IDE modules using ide_hostadapter"
+ idemodules="`awk '/ide_hostadapter/ && ! /^[\t ]*#/ { print $3; }' $modulefile`"
+ for na in $idemodules; do
+ tryauto=0;
+ findmodule "$na"
+ done
+ fi
- if [ "$tryauto" -eq 1 ]; then
- if [ -r /usr/share/pci-database/ide.pci -a -r /proc/bus/pci/devices ]; then
- [ -n "$verbose" ] && echo "Finding IDE modules using PCI ID database"
- if is_yes "${ide_only_root}"; then
- if [ -f /sys/block/${rootdev}/device/../../vendor -a -f /sys/block/${rootdev}/device/../../device ] ; then
- vendorid="$(awk ' { gsub(/0x/,NUL); print $0 } ' /sys/block/${rootdev}/device/../../vendor)"
- deviceid="$(awk ' { gsub(/0x/,NUL); print $0 } ' /sys/block/${rootdev}/device/../../device)"
- searchpciid="${vendorid}${deviceid}"
- elif [ -f /proc/ide/${rootdev}/../config ]; then
- searchpciid="$(awk ' /pci bus/ { print $7$9 } ' /proc/ide/${rootdev}/../config)"
- fi
- fi
- if [ -z "${searchpciid}" ]; then
- searchpciid="$(awk ' { print $2 } ' /proc/bus/pci/devices)"
- fi
- idemodules=""
- for nb in $searchpciid; do
- eval `awk -v pciid="$nb" 'BEGIN {
-}
-
-{
- gsub("\t"," ");
- gsub(" +", " ");
- gsub("^ ","");
- if (/^[\t ]*#/)
- next;
- compmod = $1 ""; # make sure comparison type will be string
- # cause pci IDs are hexadecimal numeric
- if (compmod == pciid) {
- module=$2;
-# min_kernel=$3; # now in ide.pci $3,$4 = vendor and device name
-# max_kernel=$4; #
- exit 0;
- }
-}
-
-END {
- print "module=" module "\nmin_kernel=" min_kernel "\nmax_kernel=\"" max_kernel "\"\n";
-}' /usr/share/pci-database/ide.pci`
- [ -n "$module" ] && idemodules="$idemodules $module"
- done
- if is_yes "$(awk ' /ide=reverse/ { print "yes" } ' /proc/cmdline)"; then
- new_idemodules=""
- for nc in idemodules; do
- new_idemodules="$nc $new_idemodules"
- done
- idemodules="${new_idemodules}"
- fi
- if [ -z "$idemodules" ]; then
- echo "WARNING: rootfs on IDE device but no related modules found, loading ide-generic."
- idemodules="ide-generic"
+ if [ "$tryauto" -eq 1 ]; then
+ # If tryauto {{{
+ if [ -r /usr/share/pci-database/ide.pci -a -r /proc/bus/pci/devices ]; then
+ [ -n "$verbose" ] && echo "Finding IDE modules using PCI ID database"
+ # Finding IDE modules using PCI ID database {{{
+ if is_yes "${ide_only_root}"; then
+ if [ -f /sys/block/${rootdev}/device/../../vendor -a -f /sys/block/${rootdev}/device/../../device ]; then
+ vendorid="$(awk ' { gsub(/0x/,NUL); print $0 } ' /sys/block/${rootdev}/device/../../vendor)"
+ deviceid="$(awk ' { gsub(/0x/,NUL); print $0 } ' /sys/block/${rootdev}/device/../../device)"
+ searchpciid="${vendorid}${deviceid}"
+ elif [ -f /proc/ide/${rootdev}/../config ]; then
+ searchpciid="$(awk ' /pci bus/ { print $7$9 } ' /proc/ide/${rootdev}/../config)"
+ fi
+ fi
+
+ if [ -z "${searchpciid}" ]; then
+ searchpciid="$(awk ' { print $2 } ' /proc/bus/pci/devices)"
+ fi
+
+ idemodules=""
+
+ for nb in $searchpciid; do
+ eval `awk -v pciid="$nb" '{
+ gsub("\t"," ");
+ gsub(" +", " ");
+ gsub("^ ","");
+ if (/^[\t ]*#/)
+ next;
+ compmod = $1 ""; # make sure comparison type will be string
+ # cause pci IDs are hexadecimal numeric
+ if (compmod == pciid) {
+ module=$2;
+ # min_kernel=$3; # now in ide.pci $3,$4 = vendor and device name
+ # max_kernel=$4; #
+ exit 0;
+ }
+ }
+
+ END {
+ print "module=" module "\nmin_kernel=" min_kernel "\nmax_kernel=\"" max_kernel "\"\n";
+ }' /usr/share/pci-database/ide.pci`
+ [ -n "$module" ] && idemodules="$idemodules $module"
+ done
+ if is_yes "$(awk ' /ide=reverse/ { print "yes" } ' /proc/cmdline)"; then
+ new_idemodules=""
+ for nc in idemodules; do
+ new_idemodules="$nc $new_idemodules"
+ done
+ idemodules="${new_idemodules}"
+ fi
+
+ if [ -z "$idemodules" ]; then
+ echo "WARNING: rootfs on IDE device but no related modules found, loading ide-generic."
+ idemodules="ide-generic"
+ fi
+
+ # }}}
+ for nd in $idemodules; do
+ findmodule "-$nd"
+ done
+ # }}}
+ # else tryauto {{{
+ else
+ [ -r /usr/share/pci-database/ide.pci ] || echo "WARNING: /usr/share/pci-database/ide.pci missing."
+ [ -r /proc/bus/pci/devices ] || echo "WARNING: /proc/bus/pci/devices missing."
+ echo "Automatic IDE modules finding not available."
+ fi
+ # }}}
+ fi
+ else
+ findmodule "$n"
fi
- for nd in $idemodules; do
- findmodule "-$nd"
- done
- else
- [ -r /usr/share/pci-database/ide.pci ] || echo "WARNING: /usr/share/pci-database/ide.pci missing."
- [ -r /proc/bus/pci/devices ] || echo "WARNING: /proc/bus/pci/devices missing."
- echo "Automatic IDE modules finding not available."
- fi
- fi
- else
- findmodule "$n"
- fi
- done
+ done
fi
}
@@ -540,24 +546,25 @@
}
find_modules_for() {
- if [ -z "$1" ]; then
- echo "ERROR: no argument passed to find_modules_for() - is your /etc/fstab correct?" >&2
+ if [ -z "$1" ]; then
+ echo "ERROR: no argument passed to find_modules_for() - is your /etc/fstab correct?" >&2
exit
+
elif is_yes "`echo "$1" | awk '/^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+:|\/dev\/nfs)/ { print "yes"; }'`"; then
if [ ! -x /usr/bin/pcidev -a -z "$NFS_ETH_MODULES" ] ; then
- echo "ERROR: root on NFS but /usr/bin/pcidev not found." >&2
- echo "Please install correct pci-database package and rerun $0." >&2
- exit 1
+ echo "ERROR: root on NFS but /usr/bin/pcidev not found." >&2
+ echo "Please install correct pci-database package and rerun $0." >&2
+ exit 1
fi
[ -z "$NFS_ETH_MODULES" ] && NFS_ETH_MODULES=$(/usr/bin/pcidev /m net | xargs)
for m in $NFS_ETH_MODULES; do
- findmodule "$m"
+ findmodule "$m"
done
findmodule "-ipv4"
- findmodule "nfs"
+ findmodule "nfs"
usenfs="yes"
echo "Remember to use \`root=/dev/ram0 init=/linuxrc' when starting kernel" >&2
- echo "or you will have problems like init(xx) being child process of swapper(1)." >&2
+ echo "or you will have problems like init(xx) being child process of swapper(1)." >&2
elif is_yes "`echo "$1" | awk '/^\/dev\/md/ { print "yes"; }'`"; then
find_modules_softraid "$1"
elif is_yes "$(echo "$1" | awk '/^\/dev\/(sd|scsi)/ { print "yes"; }')" ; then
@@ -571,7 +578,7 @@
elif is_yes "`echo "$1" | awk '/\/dev\/cciss\// { print "yes"; }'`" ; then
findmodule "cciss"
elif is_yes "`echo "$1" | awk '/\/dev\/ataraid\// { print "yes"; }'`"; then
- find_modules_ide
+ find_modules_ide
findmodule "ataraid"
ataraidmodules="`awk '/ataraid_hostadapter/ && ! /^[\t ]*#/ { print $3; }' $modulefile`"
if -n "$ataraidmodules" ; then
@@ -613,32 +620,32 @@
echo "Please install lvm(2) and lvm(2)-initrd package and rerun $0." >&2
exit 1
fi
- if [ -z "$LVMTOOLSVERSION" ] ; then
- LVMTOOLSVERSION=$(/sbin/initrd-lvm vgchange --version 2>/dev/null|head -n 1|awk '{gsub("vgchange: Logical Volume Manager ",NIL); gsub("LVM version: ",NIL); gsub(/\..*/,NIL); print $1}')
- if [ -z "$LVMTOOLSVERSION" ] ; then
- echo "ERROR: Can't determine LVM tools version. Please set LVMTOOLSVERSION" >&2
- echo "and rerun $0." >&2
- exit 1
- fi
+ if [ -z "$LVMTOOLSVERSION" ] ; then
+ LVMTOOLSVERSION=$(/sbin/initrd-lvm vgchange --version 2>/dev/null|head -n 1|awk '{gsub("vgchange: Logical Volume Manager ",NIL); gsub("LVM version: ",NIL); gsub(/\..*/,NIL); print $1}')
+ if [ -z "$LVMTOOLSVERSION" ] ; then
+ echo "ERROR: Can't determine LVM tools version. Please set LVMTOOLSVERSION" >&2
+ echo "and rerun $0." >&2
+ exit 1
+ fi
fi
if [ -z "$PVDEVICES" ] ; then
- VGVOLUME=$(/sbin/lvdisplay -c "$1" 2> /dev/null | awk -F":" ' { print $2 } ')
- PVDEVICES=$(/sbin/pvdisplay -c | awk -F":" -v vg="$VGVOLUME" ' BEGIN { devices="" } { if ($2 == vg) { devices = devices " " $1 } } END { print devices } ')
+ VGVOLUME=$(/sbin/lvdisplay -c "$1" 2> /dev/null | awk -F":" ' { print $2 } ')
+ PVDEVICES=$(/sbin/pvdisplay -c | awk -F":" -v vg="$VGVOLUME" ' BEGIN { devices="" } { if ($2 == vg) { devices = devices " " $1 } } END { print devices } ')
fi
if [ -n "$PVDEVICES" ] ; then
for device in $PVDEVICES; do
find_modules_for $device
done
else
- echo "ERROR: I wasn't able to find PV (via lvdisplay and pvdisplay)." >&2
+ echo "ERROR: I wasn't able to find PV (via lvdisplay and pvdisplay)." >&2
echo "You can try to set PVDEVICES in /etc/sysconfig/geninitrd." >&2
exit 1
fi
if [ "$LVMTOOLSVERSION" = "2" ]; then
- findmodule "-dm-mod"
+ findmodule "-dm-mod"
elif [ "$LVMTOOLSVERSION" = "1" ]; then
- findmodule "-lvm"
- findmodule "-lvm-mod"
+ findmodule "-lvm"
+ findmodule "-lvm-mod"
else
echo "ERROR: LVM version $LVMTOOLSVERSION is not supported yet." >&2
exit 1
@@ -652,41 +659,42 @@
modules="$1"
for mod in $modules; do
- MODULEDIR="`my_dirname "$mod"`"
- mkdir -p "$MNTIMAGE/lib/modules/$kernel/$MODULEDIR"
- cp $verbose -a "/lib/modules/$kernel/$mod" "$MNTIMAGE/lib/modules/$kernel/$mod"
- gunzip "$MNTIMAGE/lib/modules/$kernel/$mod" 2> /dev/null
+ MODULEDIR="`my_dirname "$mod"`"
+ mkdir -p "$MNTIMAGE/lib/modules/$kernel/$MODULEDIR"
+ cp $verbose -a "/lib/modules/$kernel/$mod" "$MNTIMAGE/lib/modules/$kernel/$mod"
+ gunzip "$MNTIMAGE/lib/modules/$kernel/$mod" 2> /dev/null
done
}
modules_add_linuxrc() {
modules="$1"
linuxrc="$2"
-
+
for mod in $modules; do
- MODULE2="`my_dirname "$mod"`"
- NAME2=`basename "$mod" .gz`
- MODULE2=$MODULE2/$NAME2
- module="`echo $mod | awk -F/ '{ $0=$NF } /'$modext'.*$/ { gsub(/'$modext'.*/, NIL, $0); } { print $0; }'`"
- options="`awk '{ if($1 == "options" && $2 == "'${module}'") { for(i=3;i<=NF;i++) printf("%s ",$i); }}' "$modulefile"`"
+ MODULE2="`my_dirname "$mod"`"
+ NAME2=`basename "$mod" .gz`
+ MODULE2=$MODULE2/$NAME2
+ module="`echo $mod | awk -F/ '{ $0=$NF } /'$modext'.*$/ { gsub(/'$modext'.*/, NIL, $0); } { print $0; }'`"
+ options="`awk '{ if($1 == "options" && $2 == "'${module}'") { for(i=3;i<=NF;i++) printf("%s ",$i); }}' "$modulefile"`"
sleep_module=$(echo "${module}" | awk ' { gsub("-", "_", $0) } { print $0; } ')
sleep_var="$(eval echo \$MODULE_${sleep_module}_USLEEP)"
- if [ -n "$verbose" ]; then
- echo -n "Loading module [$module] "
- if [ -n "$options" ] ; then
- echo -n "with options [$options]"
- else
- echo -n "without options"
- fi
+ if [ -n "$verbose" ]; then
+ echo -n "Loading module [$module] "
+ if [ -n "$options" ] ; then
+ echo -n "with options [$options]"
+ else
+ echo -n "without options"
+ fi
if [ -n "$sleep_var" ]; then
echo " and $sleep_var usleep."
else
echo "."
fi
- fi
- echo "$insmod /lib/modules/$kernel/$MODULE2 $options" >> "$linuxrc"
+ fi
+
+ echo "$insmod /lib/modules/$kernel/$MODULE2 $options" >> "$linuxrc"
if [ -n "${sleep_var}" ]; then
echo "usleep $sleep_var" >> "$linuxrc"
fi
@@ -701,16 +709,16 @@
. /etc/sysconfig/bootsplash
fi
-if [ ! -x /bin/initrd-busybox ] ; then
+if [ ! -x /bin/initrd-busybox ] ; then
echo "/bin/initrd-busybox is missing !"
exit 1
fi
case "$(uname -m)" in
- ia64|amd64|x86_64|sparc64)
- IMAGESIZE=3000
+ia64|amd64|x86_64|sparc64)
+ IMAGESIZE=3000
;;
- *)
- IMAGESIZE=1500
+*)
+ IMAGESIZE=1500
;;
esac
@@ -842,9 +850,9 @@
# default value
# XXX: initramfs blocked for now
if [ "1" = " 0" -a "$pack_version" -ge "002005" ] ; then
- INITRDFS="initramfs"
+ INITRDFS="initramfs"
else
- INITRDFS="rom"
+ INITRDFS="rom"
fi
else
echo "Warning: FS configuration options is obsoleted. Use INITRDFS instead" 1>&2
@@ -857,7 +865,7 @@
USE_DMRAID=
fi
[ -z "$USE_UDEV" ] && UDEV_TMPFS=
-
+
if [ "$pack_version" -ge "002005" ] ; then
modext=".ko"
insmod="insmod"
@@ -896,11 +904,11 @@
;;
initramfs)
if [ ! -x /bin/cpio ]; then
- echo "/bin/cpio is missing" 1>&2
+ echo "/bin/cpio is missing" 1>&2
exit 1
fi
if [ ! -x /usr/bin/find ]; then
- echo "/usr/bin/find is missing" 1>&2
+ echo "/usr/bin/find is missing" 1>&2
exit 1
fi
;;
@@ -932,7 +940,7 @@
fi
if [ ! -f /proc/mounts ]; then
- echo "WARNING: /proc filesystem not mounted, may cause wrong results or failure." 1>&2
+ echo "WARNING: /proc filesystem not mounted, may cause wrong results or failure." 1>&2
fi
if [ "$pack_version" -lt "002005" ]; then
@@ -943,7 +951,7 @@
else
modulefile=/etc/modprobe.conf
fi
-
+
for n in $PREMODS; do
findmodule "$n"
done
@@ -1075,8 +1083,8 @@
}
initrd_gen_suspend2() {
- mkdir -p $MNTIMAGE/sys
- mkdir -p $MNTIMAGE/proc
+ mkdir -p $MNTIMAGE/sys
+ mkdir -p $MNTIMAGE/proc
cat << 'EOF' >> "$s"
mount -t proc none /proc
if [ "$(awk ' /resume2=/ { print "yes"; } ' /proc/cmdline)" = "yes" ]; then
@@ -1089,11 +1097,11 @@
}
initrd_gen_udev() {
- [ -n "$verbose" ] && echo "Setting up udev..."
+ [ -n "$verbose" ] && echo "Setting up udev..."
mkdir -p $MNTIMAGE/sbin
mkdir -p $MNTIMAGE/proc
mkdir -p $MNTIMAGE/etc/udev
-
+
inst /sbin/initrd-udev $MNTIMAGE/sbin/udev
ln -s udev $MNTIMAGE/sbin/udevstart
inst /etc/udev/udev.conf $MNTIMAGE/etc/udev/udev.conf
@@ -1102,7 +1110,7 @@
if is_yes "$USE_UDEV"; then
if is_yes "$UDEV_TMPFS"; then
- cat >> "$s" <<-EOF
+ cat >> "$s" <<-EOF
echo Creating /dev
mount -o mode=0755 -t tmpfs none /dev
mknod /dev/console c 5 1
@@ -1123,18 +1131,18 @@
}
initrd_gen_dmraid() {
- if [ ! -x /sbin/dmraid-initrd ] ; then
- echo "/sbin/dmraid-initrd is missing missing !"
- exit 1
- fi
-
- if [ ! -x $MNTIMAGE/sbin/udev ]; then
- echo "udev is needed on target initrd for dmraid to work!"
- exit 1
- fi
+ if [ ! -x /sbin/dmraid-initrd ] ; then
+ echo "/sbin/dmraid-initrd is missing missing !"
+ exit 1
+ fi
- mkdir -p "$MNTIMAGE/sbin"
- inst /sbin/dmraid-initrd $MNTIMAGE/sbin/dmraid
+ if [ ! -x $MNTIMAGE/sbin/udev ]; then
+ echo "udev is needed on target initrd for dmraid to work!"
+ exit 1
+ fi
+
+ mkdir -p "$MNTIMAGE/sbin"
+ inst /sbin/dmraid-initrd $MNTIMAGE/sbin/dmraid
cat <<-EOF >> "$s"
mount -t proc none /proc
mount -t sysfs none /sys
@@ -1149,9 +1157,9 @@
initrd_gen_softraid() {
[ -n "$verbose" ] && echo "Setting up mdadm..."
-
+
if [ ! -x /sbin/mdadm -o ! -x /sbin/initrd-mdassemble ] ; then
- echo "/sbin/mdadm or /sbin/initrd-mdassemble is missing !"
+ echo "/sbin/mdadm or /sbin/initrd-mdassemble is missing !"
exit 1
fi
@@ -1162,31 +1170,31 @@
for ex_dev in $dev_list_extra; do
echo "DEVICE $ex_dev" >> "$MNTIMAGE/etc/mdadm.conf"
done
- do_md0=1
+ do_md0=1
for nr in `seq 1 $rootdev_nr`; do
- eval cr_rootdev="\$rootdev${nr}"
- eval cr_dev_list="\$dev_list${nr}"
- [ -n "$verbose" ] && echo "Setting up array ($cr_rootdev = $cr_dev_list)"
-
- [ "$cr_rootdev" = "/dev/md0" ] && do_md0=0
-
- echo "DEVICE $cr_dev_list" >> "$MNTIMAGE/etc/mdadm.conf"
- cr_dev_list_md="$(echo "$cr_dev_list" | xargs | awk ' { gsub(/ +/,",",$0); print $0; }')"
- cr_md_conf=$(/sbin/mdadm --detail --brief --config=/etc/mdadm.conf $cr_rootdev)
- if [ -n "$cr_md_conf" ]; then
- echo "$cr_md_conf" >> "$MNTIMAGE/etc/mdadm.conf"
- else
- echo "ARRAY $cr_rootdev devices=$cr_dev_list_md" >> "$MNTIMAGE/etc/mdadm.conf"
- fi
-
- for f in $cr_dev_list $cr_rootdev $dev_list_extra; do
- # mkdir in case of devfs name
- mkdir -p $MNTIMAGE/`my_dirname $f`
- [ -e "$MNTIMAGE/$f" ] && continue
- [ -n "$verbose" ] && echo "copying $f"
- # this works fine with and without devfs
- cp -HR $f $MNTIMAGE/$f
- done
+ eval cr_rootdev="\$rootdev${nr}"
+ eval cr_dev_list="\$dev_list${nr}"
+ [ -n "$verbose" ] && echo "Setting up array ($cr_rootdev = $cr_dev_list)"
+
+ [ "$cr_rootdev" = "/dev/md0" ] && do_md0=0
+
+ echo "DEVICE $cr_dev_list" >> "$MNTIMAGE/etc/mdadm.conf"
+ cr_dev_list_md="$(echo "$cr_dev_list" | xargs | awk ' { gsub(/ +/,",",$0); print $0; }')"
+ cr_md_conf=$(/sbin/mdadm --detail --brief --config=/etc/mdadm.conf $cr_rootdev)
+ if [ -n "$cr_md_conf" ]; then
+ echo "$cr_md_conf" >> "$MNTIMAGE/etc/mdadm.conf"
+ else
+ echo "ARRAY $cr_rootdev devices=$cr_dev_list_md" >> "$MNTIMAGE/etc/mdadm.conf"
+ fi
+
+ for f in $cr_dev_list $cr_rootdev $dev_list_extra; do
+ # mkdir in case of devfs name
+ mkdir -p $MNTIMAGE/`my_dirname $f`
+ [ -e "$MNTIMAGE/$f" ] && continue
+ [ -n "$verbose" ] && echo "copying $f"
+ # this works fine with and without devfs
+ cp -HR $f $MNTIMAGE/$f
+ done
done
echo "mdassemble" >> "$s"
@@ -1207,7 +1215,7 @@
echo "ifconfig lo 127.0.0.1 up" >> "$s"
echo "route add -net 127.0.0.0 netmask 255.0.0.0 lo" >> "$s"
echo "ifconfig eth0 0.0.0.0 up" >> "$s"
- echo "udhcpc -i eth0 -f -q -s /bin/setdhcp" >> "$s"
+ echo "udhcpc -i eth0 -f -q -s /bin/setdhcp" >> "$s"
cat << 'EOF' > "$MNTIMAGE/bin/setdhcp"
#!/bin/sh
[ "$1" != "bound" ] && exit
@@ -1217,11 +1225,11 @@
ifconfig $interface $ip $BROADCAST $NETMASK up
set +x
if [ -n "$router" ]; then
- for r in $router; do
- set -x
- route add default gw $r dev $interface
- set +x
- done
+ for r in $router; do
+ set -x
+ route add default gw $r dev $interface
+ set +x
+ done
fi
mount -t proc none /proc
@@ -1235,15 +1243,15 @@
umount /proc
if [ -n "$rootpath" ]; then
- set -x
- mount -n -t nfs -o ro,nolock,posix,tcp,wsize=8192,rsize=8192 $rootpath /newroot
- set +x
+ set -x
+ mount -n -t nfs -o ro,nolock,posix,tcp,wsize=8192,rsize=8192 $rootpath /newroot
+ set +x
else
- set +x
- echo "Missing rootpath in what DHCP server sent to us. Failing..."
- echo "All seen variables are listed below:"
- set
- set -x
+ set +x
+ echo "Missing rootpath in what DHCP server sent to us. Failing..."
+ echo "All seen variables are listed below:"
+ set
+ set -x
fi
EOF
chmod 755 "$MNTIMAGE/bin/setdhcp"
@@ -1275,19 +1283,19 @@
echo "lvm vgscan -T" >> "$s"
echo "lvm vgchange -T -a y $VGVOLUME" >> "$s"
echo "umount /tmp" >> "$s"
- # fail to umount
- echo "umount /dev" >> "$s"
- echo "umount /proc" >> "$s"
+ # fail to umount
+ echo "umount /dev" >> "$s"
+ echo "umount /proc" >> "$s"
else
- echo "cat /etc/lvm.conf > /tmp/lvm.conf" >> "$s"
- echo "global {" > "$MNTIMAGE/etc/lvm.conf"
+ echo "cat /etc/lvm.conf > /tmp/lvm.conf" >> "$s"
+ echo "global {" > "$MNTIMAGE/etc/lvm.conf"
echo " locking_type = 0" >> "$MNTIMAGE/etc/lvm.conf"
echo " locking_dir = \"/tmp\"" >> "$MNTIMAGE/etc/lvm.conf"
echo "}" >> "$MNTIMAGE/etc/lvm.conf"
- echo "devices {" >> "$MNTIMAGE/etc/lvm.conf"
+ echo "devices {" >> "$MNTIMAGE/etc/lvm.conf"
echo " sysfs_scan=0" >> "$MNTIMAGE/etc/lvm.conf"
if is_yes "$raidfound"; then
- echo " md_component_detection = 1" >> "$MNTIMAGE/etc/lvm.conf"
+ echo " md_component_detection = 1" >> "$MNTIMAGE/etc/lvm.conf"
fi
lvm dumpconfig | awk '/filter=/' >> "$MNTIMAGE/etc/lvm.conf"
echo "}" >> "$MNTIMAGE/etc/lvm.conf"
@@ -1309,17 +1317,17 @@
}
initrd_gen_procdata() {
- [ -n "$verbose" ] && echo "Adding rootfs finding based on root= option support."
+ [ -n "$verbose" ] && echo "Adding rootfs finding based on root= option support."
mkdir -p $MNTIMAGE/proc
cat << 'EOF' >> "$s"
set +x
mount -t proc none /proc
root="$(busybox awk ' /root=\/dev\// { gsub(/.*root=\/dev\//,NIL,$0); gsub(/ .*/,NIL,$0); print $0; } ' /proc/cmdline)"
if [ -n "$root" ]; then
- rootnr="$(busybox awk -v root="$root" ' { if ($4 == root) { print 256*$1+$2; } } ' /proc/partitions)"
- if [ -n "$rootnr" ]; then
- echo "$rootnr" > /proc/sys/kernel/real-root-dev
- fi
+ rootnr="$(busybox awk -v root="$root" ' { if ($4 == root) { print 256*$1+$2; } } ' /proc/partitions)"
+ if [ -n "$rootnr" ]; then
+ echo "$rootnr" > /proc/sys/kernel/real-root-dev
+ fi
fi
umount /proc
set -x
@@ -1403,20 +1411,22 @@
echo "Please configure your /etc/sysconfig/bootsplash first." 1>&2
echo "Generating bootsplashes skipped." 1>&2
else
- if [ -n "$BOOT_SPLASH_RESOLUTIONS" ]; then
- for res in $BOOT_SPLASH_RESOLUTIONS; do
- if [ -f "/etc/bootsplash/themes/$THEME/config/bootsplash-$res.cfg" ]; then
- /bin/splash.bin -s -f "/etc/bootsplash/themes/$THEME/config/bootsplash-$res.cfg" >> "$target" && \
- [ -n "$verbose" ] && echo "Added $res $THEME theme to initrd."
- else
- echo "/etc/bootsplash/themes/$THEME/config/bootsplash-$res.cfg doesn't exist, skipped" 1>&2
- fi
- done
- else
- echo "No BOOT_SPLASH_RESOLUTIONS specified in /etc/sysconfig/bootsplash." 1>&2
- echo "Not adding bootsplash to initrd." 1>&2
- fi
+ if [ -n "$BOOT_SPLASH_RESOLUTIONS" ]; then
+ for res in $BOOT_SPLASH_RESOLUTIONS; do
+ if [ -f "/etc/bootsplash/themes/$THEME/config/bootsplash-$res.cfg" ]; then
+ /bin/splash.bin -s -f "/etc/bootsplash/themes/$THEME/config/bootsplash-$res.cfg" >> "$target" && \
+ [ -n "$verbose" ] && echo "Added $res $THEME theme to initrd."
+ else
+ echo "/etc/bootsplash/themes/$THEME/config/bootsplash-$res.cfg doesn't exist, skipped" 1>&2
+ fi
+ done
+ else
+ echo "No BOOT_SPLASH_RESOLUTIONS specified in /etc/sysconfig/bootsplash." 1>&2
+ echo "Not adding bootsplash to initrd." 1>&2
+ fi
fi
fi
rm -rf "$MNTIMAGE" "$MNTPOINT" "$IMAGE"
+
+# vim:ts=4:sw=4:noet:fdm=marker
More information about the pld-cvs-commit
mailing list