--- /etc/rc.d/rc.sysinit.DIST Fri Sep 24 06:52:45 1999 +++ /etc/rc.d/rc.sysinit Thu Oct 12 17:21:57 2000 @@ -7,6 +7,10 @@ # Rerun ourselves through initlog if [ -z "$IN_INITLOG" ]; then + # Patch to make devfs start as soon as possible + if [ -f /etc/devfsd.conf -a -c /dev/.devfsd ]; then + /sbin/devfsd /dev + fi [ -f /sbin/initlog ] && exec /sbin/initlog $INITLOG_ARGS -r /etc/rc.d/rc.sysinit fi @@ -14,6 +18,13 @@ PATH=/bin:/sbin:/usr/bin:/usr/sbin export PATH +# Source functions +. /etc/rc.d/init.d/functions + +# Mount /proc (done here so volume labels can work with fsck) +# And so /proc/cmdline can be read for the hostname -Sidik. +action "Mounting proc filesystem" mount -n -t proc /proc /proc + # Read in config data. if [ -f /etc/sysconfig/network ]; then . /etc/sysconfig/network @@ -22,92 +33,62 @@ HOSTNAME=localhost fi -# Source functions -. /etc/rc.d/init.d/functions +# %%% SI hack. Read global configuration. This is optional, +# but can be used to set timezone, DNS, hostname, and other +# parameters from a single file. +if [ -f /Config ]; then + . /Config +fi # Print a banner. ;) -echo -en "\t\t\tWelcome to " -[ "$BOOTUP" != "serial" ] && echo -en "\\033[1;31m" -echo -en "Red Hat" -[ "$BOOTUP" != "serial" ] && echo -en "\\033[0;39m" -echo " Linux" -if [ "$PROMPT" != "no" ]; then - echo -en "\t\tPress 'I' to enter interactive startup." - echo - sleep 1 -fi +#echo -en "\t\t\tWelcome to " +#[ "$BOOTUP" != "serial" ] && echo -en "\\033[1;31m" +#echo -en "Red Hat" +#[ "$BOOTUP" != "serial" ] && echo -en "\\033[0;39m" +#echo " Linux" +#if [ "$PROMPT" != "no" ]; then +# echo -en "\t\tPress 'I' to enter interactive startup." +# echo +# sleep 1 +#fi # Fix console loglevel /sbin/loglevel $LOGLEVEL -# Mount /proc (done here so volume labels can work with fsck) - -action "Mounting proc filesystem" mount -n -t proc /proc /proc - # Turn off sysrq if [ "$MAGIC_SYSRQ" = "no" ]; then echo "0" > /proc/sys/kernel/sysrq fi # Set the system clock. -ARC=0 -SRM=0 -UTC=0 - - -if [ -f /etc/sysconfig/clock ]; then - . /etc/sysconfig/clock - - # convert old style clock config to new values - if [ "${CLOCKMODE}" = "GMT" ]; then - UTC=true - elif [ "${CLOCKMODE}" = "ARC" ]; then - ARC=true - fi -fi - -if grep "system serial" /proc/cpuinfo | grep -q MILO ; then - ARC=true +# Note: Removed a bunch of stuff. This works as long as TZ is exported +# from /etc/initscript +if [ "$CMOS_CLOCK" = "UTC" ]; then + : # Nothing to do if CMOS clock is set to UTC. else - SRM=true + /sbin/clock -s fi -CLOCKDEF="" -if [ -x /sbin/hwclock ]; then - CLOCKFLAGS="--hctosys" - CLOCK=/sbin/hwclock -else - CLOCKFLAGS="-a" - CLOCK=/sbin/clock -fi +action "Setting clock and timezone: `date`" date -case "$UTC" in - yes|true) - CLOCKFLAGS="$CLOCKFLAGS -u"; - CLOCKDEF="$CLOCKDEF (utc)"; - ;; -esac - -if [ "$CLOCK" = "/sbin/clock" ]; then - case "$ARC" in - yes|true) - CLOCKFLAGS="$CLOCKFLAGS -A"; - CLOCKDEF="$CLOCKDEF (arc)"; - ;; - esac - case "$SRM" in - yes|true) - CLOCKFLAGS="$CLOCKFLAGS -S"; - CLOCKDEF="$CLOCKDEF (srm)"; - ;; - esac -fi +# Start devfsd if needed +#if [ -f /etc/devfsd.conf -a -c /dev/.devfsd ]; then +# action "Starting devfsd for compatibility: " devfsd /dev +#fi -$CLOCK $CLOCKFLAGS +# Load keymap -action "Setting clock $CLOCKDEF: `date`" date +# %%% SI: Make BackSpace and Delete send the right codes. +# You can't win this one. If you log on to a remote system +# and the backspace echos ^H, type the command: +# +# stty erase ^H +# +# or use the Delete key as a BackSpace on that window. +# +echo "keycode 14 = BackSpace" | loadkeys +echo "keycode 111 = Delete" | loadkeys -# Load keymap KEYMAP= if [ -f /etc/sysconfig/console/default.kmap ]; then KEYMAP=/etc/sysconfig/console/default.kmap @@ -157,7 +138,7 @@ fi _RUN_QUOTACHECK=0 -if [ ! -f /fastboot ]; then +#if [ ! -f /fastboot ]; then STRING="Checking root filesystem" echo $STRING initlog -c "fsck -C -T -a $fsckoptions /" @@ -191,7 +172,7 @@ elif [ "$rc" = "1" ]; then _RUN_QUOTACHECK=1 fi -fi +#fi # check for arguments @@ -231,6 +212,39 @@ IN_INITLOG= fi +# %%% Sidik's stuff. +# Fix /etc/localtime based on /Config settings if needed. +for i in /usr/share/zoneinfo /etc/zoneinfo; do + if [ -f $i/$TZ ]; then + if [ /etc/localtime -ef $i/$TZ ]; then + : # Timezone already set correctly + else + echo "Updating /etc/localtime link to point to $i/$TZ..." + ln -fs $i/$TZ /etc/localtime + fi + break + fi +done + +# %%% Sidik's stuff. +# Create a new /etc/resolv.conf if needed. +if [ -f /Config ]; then + . /Config + + if [ "$DNSSERVER" != "" ]; then + ( echo "domain $DNSDOMAIN" + for i in $DNSSERVER; do + echo "nameserver $i" + done + [ "$DNSSEARCH" ] && echo "search $DNSSEARCH" ) > /tmp/resolv.conf + # Make sure it is different before replacing it. + if ( cmp -s /etc/resolv.conf /tmp/resolv.conf ); then + /bin/rm -f /tmp/resolv.conf + else + /bin/mv -f /tmp/resolv.conf /etc/resolv.conf + fi + fi +fi echo ${HOSTNAME} > /etc/HOSTNAME # Clear mtab @@ -246,10 +260,16 @@ USEMODULES= fi +# Not using RedHat's way of loading modules, and dependencies have +# to be generated on the machine with write access to /lib/modules/. +# At this stage, for CFHT's diskless machines, it points to a directory +# that hasn't even been mounted yet anyway, so all this would fail. +USEMODULES= + # Our modutils don't support it anymore, so we might as well remove # the preferred link. -rm -f /lib/modules/preferred -rm -f /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 @@ -297,7 +317,11 @@ fi # Add raid devices -if [ -f /proc/mdstat -a -f /etc/raidtab ]; then +if [ -f /proc/mdstat -a -f /etc/mdtab ]; then + action "Starting RAID devices" /sbin/oldraid/mdadd -ar +fi + +if [ -f /proc/mdstat -a -f /etc/raidtab.AFTERBOOT ]; then echo -n "Starting up RAID devices: " rc=0 @@ -353,7 +377,7 @@ fi # Check filesystems -if [ ! -f /fastboot ]; then +#if [ ! -f /fastboot ]; then STRING="Checking filesystems" echo $STRING initlog -c "fsck -C -T -R -A -a $fsckoptions" @@ -372,26 +396,28 @@ echo echo echo "*** An error occurred during the file system check." - echo "*** Dropping you to a shell; the system will reboot" - echo "*** when you leave the shell." - - PS1="(Repair filesystem) \#"; export PS1 - sulogin - - echo "Unmounting file systems" - umount -a - mount -n -o remount,ro / - echo "Automatic reboot in progress." - reboot + echo "*** Mounting all non-root filesystems READ-ONLY." + MOUNTOPTS="-o ro" +# echo "*** Dropping you to a shell; the system will reboot" +# echo "*** when you leave the shell." + +# PS1="(Repair filesystem) \#"; export PS1 +# sulogin + +# echo "Unmounting file systems" +# umount -a +# mount -n -o remount,ro / +# echo "Automatic reboot in progress." +# reboot elif [ "$rc" = "1" -a -x /sbin/quotacheck ]; then action "Checking filesystem quotas" /sbin/quotacheck -v -R -a fi -fi +#fi # Mount all other filesystems (except for NFS and /proc, which is already # mounted). Contrary to standard usage, # filesystems are NOT unmounted in single user mode. -action "Mounting local filesystems" mount -a -t nonfs,smbfs,ncpfs,proc +action "Mounting local filesystems $MOUNTOPTS" mount -a -t nonfs,smbfs,ncpfs,proc $MOUNTOPTS # Configure machine if necessary. if [ -f /.unconfigured ]; then @@ -462,6 +488,10 @@ chgrp utmp /var/run/utmpx /var/log/wtmpx chmod 0664 /var/run/utmpx /var/log/wtmpx fi + +# Sidik: Make sure /tmp is the right mode +chmod 777 /tmp +chmod +t /tmp # Delete X locks rm -f /tmp/.X*-lock