122 lines
2.4 KiB
Bash
122 lines
2.4 KiB
Bash
#!/bin/sh
|
|
#
|
|
# /etc/rc: system boot script
|
|
#
|
|
|
|
echo "The system is coming up. Please wait."
|
|
|
|
# Load configuration
|
|
. /etc/rc.conf
|
|
|
|
# Mount the dev filesystem
|
|
. /etc/rc.dev
|
|
|
|
# Activate swap
|
|
/sbin/swapon -a
|
|
|
|
# Mount root read-only
|
|
/bin/mount -n -o remount,ro /
|
|
|
|
# Check filesystems
|
|
/sbin/fsck -A -T -C -a
|
|
if [ $? -gt 1 ]; then
|
|
cat << EOF
|
|
*************** FILESYSTEM CHECK FAILED ******************
|
|
* *
|
|
* Please repair manually and reboot. Note that the root *
|
|
* file system is currently mounted read-only. To remount *
|
|
* it read-write type: mount -n -o remount,rw / *
|
|
* When you exit the maintainance shell the system will *
|
|
* reboot automatically. *
|
|
* *
|
|
************************************************************
|
|
EOF
|
|
/sbin/sulogin -p
|
|
echo "Automatic reboot in progress..."
|
|
/bin/umount -a -r
|
|
/sbin/reboot -f
|
|
exit 0
|
|
fi
|
|
|
|
# Mount local filesystems
|
|
/bin/mount -n -o remount,rw /
|
|
/bin/rm -f /etc/mtab*
|
|
|
|
# Run module initialization script
|
|
if [ -r /etc/rc.modules ]; then
|
|
. /etc/rc.modules
|
|
fi
|
|
|
|
/bin/mount -a -O no_netdev
|
|
|
|
# Clean up misc files
|
|
: > /var/run/utmp
|
|
|
|
# Remove scratch files.
|
|
/bin/rm -rf \
|
|
/forcefsck \
|
|
/fastboot \
|
|
/etc/nologin \
|
|
/etc/shutdownpid \
|
|
/var/run/*.pid \
|
|
/var/lock/*
|
|
|
|
cd /tmp && \
|
|
/usr/bin/find . \
|
|
-depth \
|
|
! -name . \
|
|
-exec rm -rf -- "{}" \;
|
|
echo done.
|
|
|
|
/bin/mkdir -m 1777 /tmp/.ICE-unix
|
|
|
|
# Set kernel variables
|
|
/sbin/sysctl -p > /dev/null
|
|
|
|
# Update shared library links
|
|
/sbin/ldconfig
|
|
|
|
# Configure host name
|
|
if [ "$HOSTNAME" ]; then
|
|
echo "hostname: $HOSTNAME"
|
|
/bin/hostname $HOSTNAME
|
|
fi
|
|
|
|
# Load random seed
|
|
if [ -f /var/run/random-seed ]; then
|
|
/bin/cat /var/run/random-seed > /dev/urandom
|
|
fi
|
|
|
|
# Configure system clock
|
|
if [ ! -f /etc/adjtime ]; then
|
|
echo "0.0 0 0.0" > /etc/adjtime
|
|
fi
|
|
|
|
if [ "$TIMEZONE" ]; then
|
|
/bin/ln -sf /usr/share/zoneinfo/$TIMEZONE /etc/localtime
|
|
fi
|
|
|
|
/sbin/hwclock --hctosys
|
|
|
|
# Start log daemons
|
|
/usr/sbin/syslogd
|
|
/usr/sbin/klogd -c 4
|
|
|
|
# Load console font
|
|
if [ "$FONT" ]; then
|
|
echo "font: $FONT"
|
|
/usr/bin/setfont $FONT
|
|
fi
|
|
|
|
# Load console keymap
|
|
if [ "$KEYMAP" ]; then
|
|
echo "keyboard: $KEYMAP"
|
|
/bin/loadkeys -q $KEYMAP
|
|
fi
|
|
|
|
# Screen blanks after 15 minutes idle time
|
|
/usr/bin/setterm -blank 15
|
|
|
|
dmesg > /var/log/bootlog
|
|
# End of file
|