|
|
@ -48,79 +48,68 @@ case "$1" in |
|
|
|
title "Creating valid /etc/mtab ..." |
|
|
|
grep -v "^rootfs " /proc/mounts > /etc/mtab || error=$? |
|
|
|
status |
|
|
|
if [ -f /etc/conf/hardware ] ; then |
|
|
|
. /etc/conf/hardware |
|
|
|
fi |
|
|
|
|
|
|
|
if [ -f /etc/conf/devfs ] ; then |
|
|
|
title "Configuring the /dev filesystem ..." |
|
|
|
sh /etc/conf/devfs || error=$? |
|
|
|
status |
|
|
|
fi |
|
|
|
|
|
|
|
title "Running depmod ..." |
|
|
|
/sbin/depmod -a -n > /etc/modules.dep || error=$? |
|
|
|
status |
|
|
|
|
|
|
|
title "Mounting /sys, /dev/shm and /dev/pts." |
|
|
|
mount -n /sys 2> /dev/null |
|
|
|
mount -n /dev/shm || error=$? |
|
|
|
mount -n /dev/pts 2> /dev/null |
|
|
|
if [ -f /etc/conf/hardware ] ; then |
|
|
|
. /etc/conf/hardware |
|
|
|
fi |
|
|
|
status |
|
|
|
|
|
|
|
title "Configuring the /dev filesystem ..." |
|
|
|
sh /etc/conf/devfs || error=$? |
|
|
|
status |
|
|
|
|
|
|
|
title "Configuring hardware by activating rockplug." |
|
|
|
echo "/sbin/rockplug" > /proc/sys/kernel/hotplug |
|
|
|
for file in /etc/rockplug/*.init ; do |
|
|
|
[ -f $file ] && $file start |
|
|
|
done |
|
|
|
if [ -d /etc/hotplug ] ; then |
|
|
|
title "Configuring hardware by activating hotplug." |
|
|
|
[ -f /proc/sys/kernel/hotplug ] && \ |
|
|
|
echo "/sbin/hotplug" > /proc/sys/kernel/hotplug |
|
|
|
for RC in /etc/hotplug/*.rc; do |
|
|
|
echo -n "[$( basename ${RC%.rc} )] " |
|
|
|
$RC start || error=$?; |
|
|
|
done ; echo |
|
|
|
mkdir -p /var/lock/subsys |
|
|
|
touch /var/lock/subsys/hotplug |
|
|
|
status |
|
|
|
fi |
|
|
|
|
|
|
|
title "Loading kernel modules and configuring the kernel." |
|
|
|
sh /etc/conf/kernel || error=$? |
|
|
|
if [ -f /etc/conf/kernel ] ; then |
|
|
|
sh /etc/conf/kernel || error=$? |
|
|
|
fi |
|
|
|
|
|
|
|
[ -f /etc/conf/clock ] && . /etc/conf/clock |
|
|
|
if [ "$clock_tz" = localtime ] ; then |
|
|
|
status |
|
|
|
[ -f /etc/conf/clock ] && . /etc/conf/clock |
|
|
|
if [ "$clock_tz" = localtime ] ; then |
|
|
|
status |
|
|
|
|
|
|
|
title "Setting kernel clock to local time." |
|
|
|
hwclock --hctosys --localtime || error=$? |
|
|
|
fi |
|
|
|
if [ "$clock_rtc" ] ; then |
|
|
|
status |
|
|
|
title "Setting kernel clock to local time." |
|
|
|
hwclock --hctosys --localtime || error=$? |
|
|
|
fi |
|
|
|
status |
|
|
|
|
|
|
|
title "Setting enhanced real time clock precision to $clock_rtc." |
|
|
|
if [ -w /proc/sys/dev/rtc/max-user-freq ] ; then |
|
|
|
echo $clock_rtc > /proc/sys/dev/rtc/max-user-freq || error=$? |
|
|
|
else |
|
|
|
echo "No /proc/sys/dev/rtc/max-user-freq found." |
|
|
|
if [ "$clock_rtc" ] ; then |
|
|
|
if [ -w /proc/sys/dev/rtc/max-user-freq ] ; then |
|
|
|
title "Setting enhanced real time clock precision to $clock_rtc." |
|
|
|
echo $clock_rtc > /proc/sys/dev/rtc/max-user-freq || error=$? |
|
|
|
status |
|
|
|
fi |
|
|
|
fi |
|
|
|
fi |
|
|
|
status |
|
|
|
|
|
|
|
title "Setting hostname to $(cat /etc/HOSTNAME)." |
|
|
|
hostname "$(cat /etc/HOSTNAME)" || error=$? |
|
|
|
status |
|
|
|
|
|
|
|
title "Refresh utmp, delete lock and tmp files and other stuff." |
|
|
|
find /var/lock /var/run /tmp -mindepth 1 -print0 2> /dev/null | xargs --null rm -rf |
|
|
|
rm -f /etc/nologin /nologin /fastboot ; touch /var/run/utmp |
|
|
|
chmod 664 /var/run/utmp ; chown root:tty /var/run/utmp |
|
|
|
mkdir /tmp/.ICE-unix |
|
|
|
chmod 1777 /tmp/.ICE-unix |
|
|
|
status |
|
|
|
|
|
|
|
title "Writing /var/log/boot.msg." |
|
|
|
klogd -f /var/log/boot.msg -o ; dmesg -n 3 |
|
|
|
dmesg > /var/log/boot.msg || error=$? |
|
|
|
status |
|
|
|
|
|
|
|
title "Setting keyboard keymappings." |
|
|
|
if [ -L /etc/default.keymap ] ; then |
|
|
|
mapfile=$(ls -l /etc/default.keymap | sed 's,.* -> ,,') |
|
|
|
if [ -e /etc/default.keymap ] ; then |
|
|
|
title "Setting keyboard mappings." |
|
|
|
mapfile=$( readlink -f /etc/default.keymap ) |
|
|
|
loadkeys $mapfile || error=$? |
|
|
|
elif [ -f /etc/default.keymap ] ; then |
|
|
|
loadkeys /etc/default.keymap || error=$? |
|
|
|
else |
|
|
|
echo "No /etc/default.keymap found." |
|
|
|
status |
|
|
|
fi |
|
|
|
status |
|
|
|
|
|
|
|
title "Setting keyboard repeat rate and delay time." |
|
|
|
kbd_rate=30; kbd_delay=250 |
|
|
@ -128,16 +117,12 @@ case "$1" in |
|
|
|
/usr/bin/kbdrate -r $kbd_rate -d $kbd_delay < /dev/console || error=$? |
|
|
|
status |
|
|
|
|
|
|
|
title "Setting console screen font." |
|
|
|
if [ -L /etc/default.vcfont ] ; then |
|
|
|
fontfile=$(ls -l /etc/default.vcfont | sed 's,.* -> ,,') |
|
|
|
if [ -e /etc/default.vcfont ] ; then |
|
|
|
title "Setting console screen font." |
|
|
|
fontfile=$( readlink -f /etc/default.vcfont ) |
|
|
|
setfont $fontfile || error=$? |
|
|
|
elif [ -f /etc/default.vcfont ] ; then |
|
|
|
setfont /etc/default.vcfont || error=$? |
|
|
|
else |
|
|
|
echo "No /etc/default.vcfont found." |
|
|
|
status |
|
|
|
fi |
|
|
|
status |
|
|
|
|
|
|
|
title "Setting console terminal type and blank interval." |
|
|
|
con_term=linux; con_blank=0 |
|
|
@ -156,15 +141,17 @@ case "$1" in |
|
|
|
sysctl -w kernel.overflowgid=$(id -g nobody) > /dev/null || error=$? |
|
|
|
status |
|
|
|
|
|
|
|
title "Reading /etc/sysctl.conf file." |
|
|
|
sysctl -p || error=$? |
|
|
|
status |
|
|
|
if [ -e /etc/sysctl.conf ] ; then |
|
|
|
title "Reading /etc/sysctl.conf file." |
|
|
|
sysctl -p || error=$? |
|
|
|
status |
|
|
|
fi |
|
|
|
|
|
|
|
title "Initializing kernel random number generator." |
|
|
|
if [ -e /var/state/random-seed ] ; then |
|
|
|
title "Initializing kernel random number generator." |
|
|
|
cat /var/state/random-seed >/dev/urandom || error=$? |
|
|
|
status |
|
|
|
fi |
|
|
|
status |
|
|
|
|
|
|
|
title "Setting mixer devices Master and PCM to 65%." |
|
|
|
/usr/bin/amixer sset PCM 20 >/dev/null 2>&1 || error=$? |
|
|
@ -172,23 +159,17 @@ case "$1" in |
|
|
|
/usr/bin/amixer sset Master 20 >/dev/null 2>&1 || error=$? |
|
|
|
/usr/bin/amixer sset Master unmute >/dev/null 2>&1 || error=$? |
|
|
|
status |
|
|
|
|
|
|
|
;; |
|
|
|
|
|
|
|
stop) |
|
|
|
title "Saving /var/log/init.msg and /var/log/boot.msg." |
|
|
|
touch /var/log/init.msg /var/log/boot.msg || error=$? |
|
|
|
mv /var/log/init.msg /var/log/init.old || error=$? |
|
|
|
mv /var/log/boot.msg /var/log/boot.old || error=$? |
|
|
|
status |
|
|
|
|
|
|
|
title "Writing a wtmp record." |
|
|
|
if [ "$RUNLEVEL" = 0 ] ; then halt -w || error=$? |
|
|
|
else reboot -w || error=$? ; fi |
|
|
|
status |
|
|
|
|
|
|
|
title "Saving kernel random seed." |
|
|
|
dd if=/dev/urandom of=/var/state/random-seed count=1 2> /dev/null |
|
|
|
status |
|
|
|
title "Unconfiguring hardware by de-activating hotplug." |
|
|
|
for RC in /etc/hotplug/*.rc; do |
|
|
|
echo -n "[$( basename ${RC%.rc} )] " |
|
|
|
$RC stop || error=$?; |
|
|
|
done ; echo |
|
|
|
rm -f /var/lock/subsys/hotplug |
|
|
|
status |
|
|
|
|
|
|
|
title "Sending all processes a SIGTERM (15)." |
|
|
|
killall5 -15 || error=$? ; sleep 5 |
|
|
@ -220,6 +201,7 @@ case "$1" in |
|
|
|
mount -o remount,sync $dir |
|
|
|
mount -o remount,ro $dir |
|
|
|
umount -d $dir |
|
|
|
bash |
|
|
|
done |
|
|
|
status |
|
|
|
|
|
|
@ -247,8 +229,9 @@ case "$1" in |
|
|
|
;; |
|
|
|
|
|
|
|
*) |
|
|
|
echo "Usage: $0 { start | stop }" |
|
|
|
exit 1 ;; |
|
|
|
echo "Usage: $0 { start | stop | restart }" |
|
|
|
exit 1 |
|
|
|
;; |
|
|
|
|
|
|
|
esac |
|
|
|
|
|
|
|