#!/bin/sh # # /etc/rc.d/rc.sysinit - run once at boot time # # Taken in part from Miquel van Smoorenburg's bcheckrc. # Changes: Arkadiusz Mi¶kiewicz # # Set the path PATH=/bin:/sbin:/usr/bin:/usr/sbin export PATH # Read functions . /etc/rc.d/init.d/functions # Read network config data. if [ -f /etc/sysconfig/network ]; then . /etc/sysconfig/network else NETWORKING=no HOSTNAME=localhost fi # Read system config data. if [ -f /etc/sysconfig/system ]; then . /etc/sysconfig/system else RUN_SULOGIN_ON_ERR=yes RUN_ISAPNP=yes PANIC_REBOOT_TIME=0 DELAY_LOGIN=yes CLEAN_TMP=no CONSOLE_LOGLEVEL=1 LOAD_SOUND=yes fi # Set console loglevel /sbin/loglevel $CONSOLE_LOGLEVEL # Start up swapping. run_cmd "Activating swap partitions" swapon -a # Set the hostname. run_cmd "Host: ${HOSTNAME}" hostname ${HOSTNAME} # Set the NIS domain name if [ -n "$NISDOMAIN" ]; then run_cmd "NIS Domain: ${NISDOMAIN}" domainname $NISDOMAIN else domainname "" fi if [ -f /fsckoptions ]; then fsckoptions=`cat /fsckoptions` else fsckoptions='' fi if [ -f /forcefsck ]; then fsckoptions="-f $fsckoptions" fi _RUN_QUOTACHECK=0 if [ ! -f /fastboot ]; then show "Checking root filesystems."; started initlog -c "fsck -T -a $fsckoptions /" rc=$? # A return of 2 or higher means there were serious problems. if [ $rc -gt 1 ]; then 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 if [ "$RUN_SULOGIN_ON_ERR" == "yes" ]; then sulogin else /bin/sh fi run_cmd "Unmounting file systems" umount -a mount -n -o remount,ro / run_cmd "Automatic reboot in progress." reboot elif [ "$rc" == "1" -a -x /sbin/quotacheck ]; then _RUN_QUOTACHECK=1 fi fi if [ -x /sbin/quotaon ]; then run_cmd "Turning on quotas on root filesystem" /sbin/quotaon / fi # check for arguments mount -t proc /proc /proc if grep -i nopnp /proc/cmdline >/dev/null ; then PNP= else PNP=yes fi # set up pnp if [ -x /sbin/isapnp -a -f /etc/isapnp/isapnp.conf ]; then if [ -n "$PNP" ] && [ "$RUN_ISAPNP" == "yes" ]; then run_cmd "Setting up ISA PNP devices"/sbin/isapnp /etc/isapnp/isapnp.conf else show "Skipping ISA PNP configuration"; ok fi fi # Remount the root filesystem read-write. run_cmd "Remounting root filesystem in rw mode" mount -n -o remount,rw / # Update quotas if fsck was run on /. if [ X"$_RUN_QUOTACHECK" == "X1" -a -x /sbin/quotacheck ]; then run_cmd "Checking root filesystem quotas" /sbin/quotacheck -v / fi # /etc/nologin when starting system if [ "$DELAY_LOGIN" == "yes" ] && [ ! -f /etc/nologin ]; then show "Enabling Delay Login"; busy echo > /etc/nologin echo "[EN] System bootup in progress - please wait" >> /etc/nologin echo "[PL] Startowanie systemu w toku - proszę czekać" >> /etc/nologin echo >> /etc/nologin chmod 644 /etc/nologin cp -fp /etc/nologin /etc/nologin.boot deltext; ok fi # Clear mtab >/etc/mtab # Enter root and /proc into mtab. mount -f / mount -f /proc if ! grep -i nomodules /proc/cmdline >/dev/null && [ -f /proc/ksyms ]; then USEMODULES=y else USEMODULES= fi # Set up kernel version-dependent symlinks. rm -f /lib/modules/preferred if [ -n "$USEMODULES" ]; then ktag="`cat /proc/version`" mtag="`grep -l "$ktag" /lib/modules/*/.rhkmvtag 2> /dev/null`" if [ -n "$mtag" ]; then mver="`echo $mtag | sed -e 's,/lib/modules/,,' -e 's,/.rhkmvtag,,' -e 's,[ ].*$,,'`" ln -sf /lib/modules/$mver /lib/modules/preferred ln -sf /boot/System.map-$mver /boot/System.map ln -sf /boot/module-info-$mver /boot/module-info fi fi if [ -x /sbin/depmod -a -n "$USEMODULES" ]; then # Get ready for kerneld if module support in the kernel if [ -e /lib/modules/preferred ]; then run_cmd "Finding module dependencies" depmod -a preferred else run_cmd "Finding module dependencies" depmod -a fi fi # load sound modules if (! grep -i nomodules /proc/cmdline >/dev/null) && [ "$LOAD_SOUND" == "yes" ]; then if [ -n "$USEMODULES" ]; then if grep -s "alias sound" /etc/modules.conf > /dev/null ; then run_cmd "Loading sound module" modprobe sound if grep -s "alias midi" /etc/conf.modules > /dev/null ; then run_cmd "Loading midi module" modprobe midi fi fi fi fi if [ -f /proc/sys/kernel/modprobe ]; then # /proc/sys/kernel/modprobe indicates built-in kmod instead echo "/sbin/modprobe" > /proc/sys/kernel/modprobe fi # Add raid devices if [ -f /proc/mdstat -a -f /etc/raidtab -a -x /sbin/raidstart ]; then show "Starting up RAID devices."; started initlog -c "raidstart -a" rc=$? # A non-zero return means there were problems. if [ $rc -gt 0 ]; then echo echo echo "*** An error occurred during the RAID startup" echo "*** Dropping you to a shell; the system will reboot" echo "*** when you leave the shell." PS1='(RAID Repair) #'; export PS1 if [ "$RUN_SULOGIN_ON_ERR" == "yes" ]; then sulogin else /bin/sh fi run_cmd "Unmounting file systems" umount -a run_cmd "Remounting root filesystem in ro mode" mount -n -o remount,ro / run_cmd "Automatic reboot in progress" reboot fi fi # Check filesystems if [ ! -f /fastboot ]; then show "Checking filesystems."; started initlog -c "fsck -T -R -A -a $fsckoptions" rc=$? # A return of 2 or higher means there were serious problems. if [ $rc -gt 1 ]; then 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 if [ "$RUN_SULOGIN_ON_ERR" == "yes" ]; then sulogin else /bin/sh fi run_cmd "Unmounting file systems" umount -a run_cmd "Remounting root filesystem in ro mode" mount -n -o remount,ro / run_cmd "Automatic reboot in progress." reboot elif [ "$rc" == "1" -a -x /sbin/quotacheck ]; then run_cmd "Checking filesystem quotas"/sbin/quotacheck -v -R -a 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. run_cmd "Mounting local filesystems." mount -a -t nonfs,smbfs,ncpfs,proc # set the console font if [ -x /sbin/setsysfont ]; then show "Loading default system font"; busy if (/sbin/setsysfont > /dev/null 2>&1); then deltext; ok; else deltext; fail; fi fi if [ -x /sbin/quotaon ]; then run_cmd "Turning on quotas for local filesystems" /sbin/quotaon -a fi # Clean out /etc & /var/{run/*,log/{b,w}tmpx}}. rm -f /etc/mtab~ /fastboot /fsckoptions /forcefsck rm -f /var/run/utmp :>/var/run/utmpx chown root.utmpx /var/run/utmpx chmod 0664 /var/run/utmpx /var/log/wtmpx # Clean /tmp if [ "$CLEAN_TMP" == "yes" ]; then rm -rf /tmp/* fi # Delete UUCP lock files. rm -f /var/lock/LCK* # Delete stale subsystem files. rm -f /var/lock/subsys/* # Delete stale pam_console locks. rm -f /var/lock/console/* rm -f /var/lock/console.lock # Delete stale pid files rm -f /var/run/*.pid rm -f /var/spool/postoffice/.pid.* # Delete X locks rm -f /tmp/.X*-lock # Delete Postgres sockets rm -f /tmp/.s.PGSQL.* # Set the system clock. show "Setting clock"; busy ARC=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 [ -x /sbin/hwclock ]; then CLOCKFLAGS="--hctosys" CLOCK=/sbin/hwclock else CLOCKFLAGS="-a" CLOCK=/sbin/clock fi case "$UTC" in yes|true) CLOCKFLAGS="$CLOCKFLAGS -u"; # echo -n " (utc)" ;; esac case "$ARC" in yes|true) CLOCKFLAGS="$CLOCKFLAGS -A"; # echo -n " (arc)" ;; esac #echo -n ": " if ($CLOCK $CLOCKFLAGS); then deltext; ok; else deltext; fail; fi show "Date set to `date`"; ok # Right, now turn on swap in case we swap to files. show "Enabling swap space"; busy if [ "`LANG=C swapon -a 2>&1 | grep -v "busy"`" == "" ]; then deltext; ok else deltext; fail fi # Initialize the serial ports. if [ -f /etc/rc.d/rc.serial ]; then . /etc/rc.d/rc.serial 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 ] && cat /proc/scsi/scsi | grep -q 'Type: Sequential-Access' 2>/dev/null ; then if cat /proc/devices | grep -qv ' 9 st' ; 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 # there could be a new kernel version. reinit /etc/psdevtab, to be sure. rm -f /etc/psdevtab #if [ -x /bin/ps ]; then #show "Rebuilding /etc/psdevtab database"; busy #if (ps > /dev/null 2>&1); then deltext; ok; else deltext; fail; fi #fi if [ -x /sbin/ldconfig ]; then run_cmd "Setting up /etc/ld.so.cache" /sbin/ldconfig -X fi if ([ -f /proc/sys/kernel/panic ] && [ "$PANIC_REBOOT_TIME" -gt "0" ] 2>/dev/null); then show "Sending val. $PANIC_REBOOT_TIME to /proc/sys/kernel/panic"; busy if (echo $PANIC_REBOOT_TIME > /proc/sys/kernel/panic); then deltext; ok; else deltext; fail; fi fi # Now that we have all of our basic modules loaded and the kernel going, # let's dump the syslog ring somewhere so we can find it later dmesg > /var/log/dmesg chmod 640 /var/log/dmesg # Feed entropy into the entropy pool /etc/rc.d/init.d/random start