summaryrefslogtreecommitdiffstats
path: root/rc.d/rc.sysinit
diff options
context:
space:
mode:
authorBill Nottingham <notting@redhat.com>2002-10-18 19:31:10 +0000
committerBill Nottingham <notting@redhat.com>2002-10-18 19:31:10 +0000
commitc5a800e319e4b0793da011aad9d56476cb19c155 (patch)
treea8d1b27f41471ce6e9fdcc8edd997e3c3d9de7cf /rc.d/rc.sysinit
parent0d352689830440f0109038e80f23dee09e38d43f (diff)
merge removal of ICE locks
Diffstat (limited to 'rc.d/rc.sysinit')
-rwxr-xr-xrc.d/rc.sysinit198
1 files changed, 108 insertions, 90 deletions
diff --git a/rc.d/rc.sysinit b/rc.d/rc.sysinit
index 909be0e4..1d1c0c9e 100755
--- a/rc.d/rc.sysinit
+++ b/rc.d/rc.sysinit
@@ -1,34 +1,42 @@
#!/bin/bash
#
-# /etc/rc.d/rc.sysinit - run once at boot time
+# /etc/rc.sysinit - run once at boot time
#
# Taken in part from Miquel van Smoorenburg's bcheckrc.
#
# Rerun ourselves through initlog
-if [ -z "$IN_INITLOG" -a -x /sbin/initlog ]; then
- exec /sbin/initlog $INITLOG_ARGS -r /etc/rc.d/rc.sysinit
+if [ -z "$IN_INITLOG" ]; then
+ [ -f /sbin/initlog ] && exec /sbin/initlog $INITLOG_ARGS -r /etc/rc.sysinit
fi
# If we're using devfs, start devfsd now - we need the old device names
[ -e /dev/.devfsd -a -x /sbin/devfsd ] && /sbin/devfsd /dev
+# Set the path
+PATH=/bin:/sbin:/usr/bin:/usr/sbin
+export PATH
+
HOSTNAME=`/bin/hostname`
+
+# Read in config data.
if [ -f /etc/sysconfig/network ]; then
. /etc/sysconfig/network
else
NETWORKING=no
fi
+
if [ -z "$HOSTNAME" -o "$HOSTNAME" = "(none)" ]; then
HOSTNAME=localhost
fi
+# Source functions
. /etc/init.d/functions
# Print a banner. ;)
echo -en $"\t\tWelcome to "
if grep -q "Red Hat" /etc/redhat-release ; then
- [ "$BOOTUP" = "color" ] && echo -en $"\\033[0;31m"
+ [ "$BOOTUP" = "color" ] && echo -en $"\\033[1;31m"
echo -en "Red Hat"
[ "$BOOTUP" = "color" ] && echo -en $"\\033[0;39m"
PRODUCT=`sed "s/Red Hat \(.*\) release.*/\1/" /etc/redhat-release`
@@ -47,6 +55,7 @@ fi
/bin/dmesg -n $LOGLEVEL
# Mount /proc (done here so volume labels can work with fsck)
+
action $"Mounting proc filesystem: " mount -n -t proc /proc /proc
# Unmount the initrd, if necessary
@@ -59,6 +68,7 @@ if grep -q /initrd /proc/mounts && ! grep -q /initrd/loopfs /proc/mounts ; then
fi
# Configure kernel parameters
+
action $"Configuring kernel parameters: " sysctl -e -p /etc/sysctl.conf
# Set the system clock.
@@ -108,7 +118,9 @@ esac
action $"Setting clock $CLOCKDEF: `date`" date
-if [ "`/sbin/consoletype`" = "vt" -a -x /bin/loadkeys ]; then
+if [ "`/sbin/consoletype`" = "vt" ]; then
+ # Load keymap
+ if [ -x /bin/loadkeys ]; then
KEYTABLE=
KEYMAP=
if [ -f /etc/sysconfig/console/default.kmap ]; then
@@ -117,7 +129,7 @@ if [ "`/sbin/consoletype`" = "vt" -a -x /bin/loadkeys ]; then
if [ -f /etc/sysconfig/keyboard ]; then
. /etc/sysconfig/keyboard
fi
- if [ -n "$KEYTABLE" -a -d "/lib/kbd/keymaps" ]; then
+ if [ -n "$KEYTABLE" -a -d "/usr/lib/kbd/keymaps" -o -d "/lib/kbd/keymaps" ]; then
KEYMAP=$KEYTABLE
fi
fi
@@ -131,25 +143,26 @@ if [ "`/sbin/consoletype`" = "vt" -a -x /bin/loadkeys ]; then
loadkeys $KEYMAP < /dev/tty0 > /dev/tty0 2>/dev/null && \
success $"Loading default keymap" || failure $"Loading default keymap"
echo
+ fi
fi
# Load system font
if [ -x /sbin/setsysfont ]; then
[ -f /etc/sysconfig/i18n ] && . /etc/sysconfig/i18n
- for i in 2 3 4 5 6; do
- > /dev/tty$i
- done
- case "$LANG" in
- *.utf8*|*.UTF-8*)
- action $"Setting default font ($SYSFONT): " /bin/unicode_start $SYSFONT
- ;;
- *)
- action $"Setting default font ($SYSFONT): " /sbin/setsysfont
- ;;
- esac
+ if [ -f /etc/sysconfig/console/$SYSFONT.psf.gz -o \
+ -f /usr/lib/kbd/consolefonts/$SYSFONT.psf.gz -o \
+ -f /etc/sysconfig/console/$SYSFONT.gz -o \
+ -f /usr/lib/kbd/consolefonts/$SYSFONT.gz -o \
+ -f /lib/kbd/consolefonts/$SYSFONT.gz -o \
+ -f /lib/kbd/consolefonts/$SYSFONT.psf.gz ]; then
+ action $"Setting default font ($SYSFONT): " /sbin/setsysfont
+ fi
fi
fi
+# Start up swapping.
+action $"Activating swap partitions: " swapon -a -e
+
# Set the hostname.
action $"Setting hostname ${HOSTNAME}: " hostname ${HOSTNAME}
@@ -157,8 +170,9 @@ action $"Setting hostname ${HOSTNAME}: " hostname ${HOSTNAME}
usb=0
if ! grep -iq "nousb" /proc/cmdline 2>/dev/null && ! grep -q "usb" /proc/devices 2>/dev/null ; then
aliases=`/sbin/modprobe -c | awk '/^alias usb-controller/ { print $3 }'`
- if [ -n "$aliases" -a "$aliases" != "off" ]; then
+ if [ -n "$aliases" -a "$aliases" != "off" ] ; then
modprobe usbcore
+ action $"Mounting USB filesystem: " mount -t usbdevfs usbdevfs /proc/bus/usb
for alias in $aliases ; do
[ "$alias" != "off" ] && action $"Initializing USB controller ($alias): " modprobe $alias
done
@@ -170,24 +184,33 @@ if ! grep -iq "nousb" /proc/cmdline 2>/dev/null && grep -q "usb" /proc/devices 2
usb=1
fi
-if [ $usb = 1 -a ! -f /proc/bus/usb/devices ]; then
- action $"Mounting USB filesystem: " mount -t usbdevfs usbdevfs /proc/bus/usb
-fi
-
needusbstorage=
if [ $usb = "1" ]; then
- needusbstorage=`grep -e "^I.*Cls=08" /proc/bus/usb/devices 2>/dev/null`
- action $"Initializing USB HID interface: " modprobe hid 2> /dev/null
- action $"Initializing USB keyboard: " modprobe keybdev
- action $"Initializing USB mouse: " modprobe mousedev
+ sleep 5
+ mouseoutput=`cat /proc/bus/usb/devices 2>/dev/null|grep -E "^I.*Cls=03.*Prot=02"`
+ kbdoutput=`cat /proc/bus/usb/devices 2>/dev/null|grep -E "^I.*Cls=03.*Prot=01"`
+ needusbstorage=`cat /proc/bus/usb/devices 2>/dev/null|grep -e "^I.*Cls=08"`
+ if [ -n "$kbdoutput" ] || [ -n "$mouseoutput" ]; then
+ action $"Initializing USB HID interface: " modprobe hid 2> /dev/null
+ fi
+ if [ -n "$kbdoutput" ]; then
+ action $"Initializing USB keyboard: " modprobe keybdev
+ fi
+ if [ -n "$mouseoutput" ]; then
+ action $"Initializing USB mouse: " modprobe mousedev
+ fi
fi
if [ -f /fastboot ] || grep -iq "fastboot" /proc/cmdline 2>/dev/null ; then
fastboot=yes
+ else
+ fastboot=
fi
if [ -f /fsckoptions ]; then
fsckoptions=`cat /fsckoptions`
+ else
+ fsckoptions=
fi
if [ -f /forcefsck ]; then
@@ -195,13 +218,16 @@ if [ -f /forcefsck ]; then
elif [ -f /.autofsck ]; then
echo $"Your system appears to have shut down uncleanly"
AUTOFSCK_TIMEOUT=5
+ AUTOFSCK_DEF_CHECK=no
[ -f /etc/sysconfig/autofsck ] && . /etc/sysconfig/autofsck
- if [ "$AUTOFSCK_DEF_CHECK" = "yes" ]; then
+ if [ "$AUTOFSCK_DEF_CHECK" = "yes" ] ; then
AUTOFSCK_OPT=-f
+ else
+ AUTOFSCK_OPT=
fi
if [ "$PROMPT" != "no" ]; then
- if [ "$AUTOFSCK_DEF_CHECK" = "yes" ]; then
+ if [ "$AUTOFSCK_DEF_CHECK" = "yes" ] ; then
if /sbin/getkey -c $AUTOFSCK_TIMEOUT -m $"Press N within %d seconds to not force file system integrity check..." n ; then
AUTOFSCK_OPT=
fi
@@ -213,7 +239,7 @@ elif [ -f /.autofsck ]; then
echo
else
# PROMPT not allowed
- if [ "$AUTOFSCK_DEF_CHECK" = "yes" ]; then
+ if [ "$AUTOFSCK_DEF_CHECK" = "yes" ] ; then
echo $"Forcing file system integrity check due to default setting"
else
echo $"Not forcing file system integrity check due to default setting"
@@ -230,8 +256,8 @@ fi
_RUN_QUOTACHECK=0
-ROOTFSTYPE=`awk '/ \/ / { print $3 }' /proc/mounts`
-if [ -z "$fastboot" -a "X$ROOTFSTYPE" != "Xnfs" ]; then
+ROOTFSTYPE=`grep " / " /proc/mounts | awk '{ print $3 }'`
+if [ -z "$fastboot" -a "$ROOTFSTYPE" != "nfs" ]; then
STRING=$"Checking root filesystem"
echo $STRING
@@ -242,7 +268,7 @@ if [ -z "$fastboot" -a "X$ROOTFSTYPE" != "Xnfs" ]; then
success "$STRING"
echo
elif [ "$rc" = "1" ]; then
- passed "$STRING"
+ passed $"$STRING"
echo
fi
@@ -289,11 +315,16 @@ if [ X"$_RUN_QUOTACHECK" = X1 -a \
action $"Checking root filesystem quotas: " /sbin/quotacheck -nug /
fi
+# check for arguments passed from kernel
+
+if grep -iq nopnp /proc/cmdline >/dev/null 2>&1 ; then
+ PNP=
+else
+ PNP=yes
+fi
+
+# set up pnp
if [ -x /sbin/isapnp -a -f /etc/isapnp.conf -a ! -f /proc/isapnp ]; then
- # check for arguments passed from kernel
- if ! grep -iq nopnp /proc/cmdline >/dev/null 2>&1 ; then
- PNP=yes
- fi
if [ -n "$PNP" ]; then
action $"Setting up ISA PNP devices: " /sbin/isapnp /etc/isapnp.conf
else
@@ -311,9 +342,6 @@ if [ -e /proc/lvm -a -x /sbin/vgchange -a -f /etc/lvmtab ]; then
action $"Setting up Logical Volume Management:" /sbin/vgscan && /sbin/vgchange -a y
fi
-# Start up swapping.
-action $"Activating swap partitions: " swapon -a -e
-
# Clear mtab
>/etc/mtab
@@ -328,19 +356,21 @@ mount -f /proc
-# The root filesystem is now read-write, so we can now log
-# via syslog() directly..
+# The root filesystem is now read-write, so we can now log via syslog() directly..
if [ -n "$IN_INITLOG" ]; then
IN_INITLOG=
fi
-if ! grep -iq nomodules /proc/cmdline 2>/dev/null && [ -f /proc/ksyms ]; then
+if ! grep -iq nomodules /proc/cmdline >/dev/null 2>&1 && [ -f /proc/ksyms ]; then
USEMODULES=y
+else
+ USEMODULES=
fi
# Our modutils don't support it anymore, so we might as well remove
# the preferred link.
-rm -f /lib/modules/preferred /lib/modules/default
+rm -f /lib/modules/preferred
+rm -f /lib/modules/default
if [ -x /sbin/depmod -a -n "$USEMODULES" ]; then
# If they aren't using a recent sane kernel, make a link for them
if [ ! -n "`uname -r | grep -- "-"`" ]; then
@@ -365,16 +395,16 @@ if [ -n "$PNP" -a -f /proc/isapnp -a -x /sbin/sndconfig ]; then
/sbin/sndconfig --mungepnp >/dev/null 2>&1
fi
-# Load sound modules if and only if they need persistent DMA buffers
+# Load sound modules iff they need persistent DMA buffers
if grep -q "options sound dmabuf=1" /etc/modules.conf 2>/dev/null ; then
RETURN=0
alias=`/sbin/modprobe -c | awk '/^alias sound / { print $3 }'`
- if [ -n "$alias" -a "$alias" != "off" ]; then
+ if [ -n "$alias" -a "$alias" != "off" ] ; then
action $"Loading sound module ($alias): " modprobe sound
RETURN=$?
fi
alias=`/sbin/modprobe -c | awk '/^alias sound-slot-0 / { print $3 }'`
- if [ -n "$alias" -a "$alias" != "off" ]; then
+ if [ -n "$alias" -a "$alias" != "off" ] ; then
action $"Loading sound module ($alias): " modprobe sound-slot-0
RETURN=$?
fi
@@ -396,12 +426,12 @@ if [ -f /etc/rc.modules ]; then
/etc/rc.modules
fi
-if [ -f /etc/raidtab ]; then
- # Add raid devices
- [ -f /proc/mdstat ] || modprobe md >/dev/null 2>&1
-fi
-if [ -f /etc/raidtab -a -f /proc/mdstat ]; then
+# Add raid devices
+if [ ! -f /proc/mdstat ]; then
+ modprobe md >/dev/null 2>&1
+fi
+if [ -f /proc/mdstat -a -f /etc/raidtab ]; then
echo -n $"Starting up RAID devices: "
rc=0
@@ -516,7 +546,7 @@ action $"Mounting local filesystems: " mount -a -t nonfs,smbfs,ncpfs -O no_netde
if [ X"$_RUN_QUOTACHECK" = X1 -a -x /sbin/quotacheck ]; then
if [ -x /sbin/convertquota ]; then
# try to convert old quotas
- for mountpt in `awk '$4 ~ /quota/{print $2}' /etc/mtab` ; do
+ for mountpt in `cat /etc/mtab | awk '$4 ~ /quota/{print $2}'`; do
if [ -f "$mountpt/quota.user" ]; then
action $"Converting old user quota files: " \
/sbin/convertquota -u $mountpt && \
@@ -575,16 +605,14 @@ rm -f /fastboot /fsckoptions /forcefsck /.autofsck /halt /poweroff
_NEED_XFILES=
[ -f /var/run/utmpx -o -f /var/log/wtmpx ] && _NEED_XFILES=1
-# Clean up /var. I'd use find, but /usr may not be mounted.
-for afile in /var/lock/* /var/run/* ; do
- if [ -d "$afile" ]; then
- case "`basename $afile`" in
- news|sudo|mon) ;;
- *) rm -f $afile/* ;;
- esac
- else
- rm -f $afile
- fi
+# Clean up /var
+# I'd use find, but /usr may not be mounted.
+for afile in /var/lock/* /var/run/*; do
+ if [ -d "$afile" ]; then
+ [ "`basename $afile`" != "news" -a "`basename $afile`" != "sudo" -a "`basename $afile`" != "mon" ] && rm -f $afile/*
+ else
+ rm -f $afile
+ fi
done
rm -f /var/lib/rpm/__db*
@@ -628,8 +656,11 @@ fi
# If a SCSI tape has been detected, load the st module unconditionally
# since many SCSI tapes don't deal well with st being loaded and unloaded
if [ -f /proc/scsi/scsi ] && grep -q 'Type: Sequential-Access' /proc/scsi/scsi 2>/dev/null ; then
- if grep -qv ' 9 st' /proc/devices && [ -n "$USEMODULES" ]; then
- modprobe st >/dev/null 2>&1
+ if grep -qv ' 9 st' /proc/devices ; then
+ if [ -n "$USEMODULES" ] ; then
+ # Try to load the module. If it fails, ignore it...
+ insmod -p st >/dev/null 2>&1 && modprobe st >/dev/null 2>&1
+ fi
fi
fi
@@ -638,21 +669,19 @@ if [ -n "$needusbstorage" ]; then
modprobe usb-storage >/dev/null 2>&1
fi
-# Ooh, firewire too.
-aliases=`/sbin/modprobe -c | awk '/^alias ieee1394-controller/ { print $3 }'`
-if [ -n "$aliases" -a "$aliases" != "off" ]; then
- for alias in $aliases ; do
- [ "$alias" != "off" ] && action $"Initializing firewire controller ($alias): " modprobe $alias
- done
- grep -q "SBP2" /proc/bus/ieee1394/devices 2>/dev/null && modprobe sbp2 >/dev/null 2>&1
-fi
-
# If they asked for ide-scsi, load it
if grep -q "ide-scsi" /proc/cmdline ; then
modprobe ide-cd >/dev/null 2>&1
modprobe ide-scsi >/dev/null 2>&1
fi
+# Turn off DMA on CD-ROMs. It more often than not causes problems.
+if [ -x /sbin/hdparm -a -e /proc/ide ]; then
+ for N in `grep -v ide-disk /proc/ide/*/*/driver 2>/dev/null | awk -F / '{ print $5 }'`; do
+ hdparm -q -d0 /dev/$N >/dev/null 2>&1
+ done
+fi
+
# Turn on harddisk optimization
# There is only one file /etc/sysconfig/harddisks for all disks
# after installing the hdparm-RPM. If you need different hdparm parameters
@@ -672,7 +701,7 @@ disk[17]=hdq; disk[18]=hdr; disk[19]=hds; disk[20]=hdt;
if [ -x /sbin/hdparm ]; then
for device in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20; do
- unset MULTIPLE_IO USE_DMA EIDE_32BIT LOOKAHEAD EXTRA_PARAMS
+ unset MULTIPLE_IO USE_DMA EIDE_32BIT LOOKAHEAD EXTRA_PARAMS
if [ -f /etc/sysconfig/harddisk${disk[$device]} ]; then
. /etc/sysconfig/harddisk${disk[$device]}
HDFLAGS[$device]=
@@ -694,7 +723,7 @@ if [ -x /sbin/hdparm ]; then
else
HDFLAGS[$device]="${HDFLAGS[0]}"
fi
- if [ -e "/proc/ide/${disk[$device]}/media" ]; then
+ if [ -e "/proc/ide/${disk[$device]}/media" ] ; then
hdmedia=`cat /proc/ide/${disk[$device]}/media`
if [ "$hdmedia" = "disk" -o -f "/etc/sysconfig/harddisk${disk[$device]}" ]; then
if [ -n "${HDFLAGS[$device]}" ]; then
@@ -705,27 +734,16 @@ if [ -x /sbin/hdparm ]; then
done
fi
-# Boot time profiles. Yes, this should be somewhere else.
-if grep -q "netprofile=" /proc/cmdline ; then
- cmdline=`cat /proc/cmdline`
- for arg in cmdline ; do
- if [ "${arg##netprofile=}" != "${arg}" ]; then
- [ -x /usr/sbin/redhat-config-network-cmd ] &&
- /usr/sbin/redhat-config-network-cmd --profile ${arg##netprofile=}
- fi
- done
-fi
-
# Generate a header that defines the boot kernel.
/sbin/mkkerneldoth
# Adjust symlinks as necessary in /boot to keep system services from
# spewing messages about mismatched System maps and so on.
if [ -L /boot/System.map -a -r /boot/System.map-`uname -r` -a \
- ! /boot/System.map -ef /boot/System.map-`uname -r` ]; then
+ ! /boot/System.map -ef /boot/System.map-`uname -r` ] ; then
ln -s -f System.map-`uname -r` /boot/System.map
fi
-if [ ! -e /boot/System.map -a -r /boot/System.map-`uname -r` ]; then
+if [ ! -e /boot/System.map -a -r /boot/System.map-`uname -r` ] ; then
ln -s -f System.map-`uname -r` /boot/System.map
fi
@@ -744,8 +762,8 @@ shopt -u nullglob
dmesg -s 131072 > /var/log/dmesg
# Also keep kernel symbols around in case we need them for debugging
i=5
-while [ $i -ge 0 ]; do
- if [ -f /var/log/ksyms.$i ]; then
+while [ $i -ge 0 ] ; do
+ if [ -f /var/log/ksyms.$i ] ; then
mv /var/log/ksyms.$i /var/log/ksyms.$(($i+1))
fi
i=$(($i-1))