diff options
Diffstat (limited to 'packages/initscripts/initscripts-1.0')
18 files changed, 651 insertions, 46 deletions
diff --git a/packages/initscripts/initscripts-1.0/checkroot.sh b/packages/initscripts/initscripts-1.0/checkroot.sh index 8a02aa7b58..f3b8a0cd45 100755 --- a/packages/initscripts/initscripts-1.0/checkroot.sh +++ b/packages/initscripts/initscripts-1.0/checkroot.sh @@ -193,7 +193,7 @@ ROOTFSDEV="/dev/root" if ! grep -q "^$ROOTFSDEV\w" /proc/mounts; then ROOTFSDEV="rootfs" fi -if [ $(grep "^$ROOTFSDEV\w" /proc/mounts | awk '{print $4}') = rw ]; then +if [ x$(grep "^$ROOTFSDEV\w" /proc/mounts | awk '{print $4}') = "xrw" ]; then echo "Root filesystem already read-write, not remounting" exit 0 fi diff --git a/packages/initscripts/initscripts-1.0/angstrom/.mtn2git_empty b/packages/initscripts/initscripts-1.0/fic-gta01/.mtn2git_empty index e69de29bb2..e69de29bb2 100644 --- a/packages/initscripts/initscripts-1.0/angstrom/.mtn2git_empty +++ b/packages/initscripts/initscripts-1.0/fic-gta01/.mtn2git_empty diff --git a/packages/initscripts/initscripts-1.0/fic-gta01/inittab b/packages/initscripts/initscripts-1.0/fic-gta01/inittab new file mode 100644 index 0000000000..8d313b2a58 --- /dev/null +++ b/packages/initscripts/initscripts-1.0/fic-gta01/inittab @@ -0,0 +1,48 @@ +# /etc/inittab: init(8) configuration. +# $Id: inittab,v 1.91 2002/01/25 13:35:21 miquels Exp $ + +# The default runlevel. +id:5:initdefault: + +# Boot-time system configuration/initialization script. +# This is run first except when booting in emergency (-b) mode. +si::sysinit:/etc/init.d/rcS + +# What to do in single-user mode. +~~:S:wait:/sbin/sulogin + +# Shut down if kernel sends us SIGINT or SIGPWR +ca::ctrlaltdel:/sbin/halt -p +pf::powerfailnow:/sbin/halt -p + +# /etc/init.d executes the S and K scripts upon change +# of runlevel. +# +# Runlevel 0 is halt. +# Runlevel 1 is single-user. +# Runlevels 2-5 are multi-user. +# Runlevel 6 is reboot. + +l0:0:wait:/etc/init.d/rc 0 +l1:1:wait:/etc/init.d/rc 1 +l2:2:wait:/etc/init.d/rc 2 +l3:3:wait:/etc/init.d/rc 3 +l4:4:wait:/etc/init.d/rc 4 +l5:5:wait:/etc/init.d/rc 5 +l6:6:wait:/etc/init.d/rc 6 +# Normally not reached, but fallthrough in case of emergency. +z6:6:respawn:/sbin/sulogin + +# /sbin/getty invocations for the runlevels. +# +# The "id" field MUST be the same as the last +# characters of the device (after "tty"). +# +# Format: +# <id>:<runlevels>:<action>:<process> + +# NOTE: FIC GTA01 has this odd multiplexer on ttySAC0 since +# GSM shares it with the serial output. We only allow +# the getty in runlevel 2 to cope with that. gsmd gets +# started in runlevel 3. -- mickey@openmoko.org +S:2:respawn:/sbin/getty 115200 ttySAC0 diff --git a/packages/initscripts/initscripts-1.0/openzaurus/.mtn2git_empty b/packages/initscripts/initscripts-1.0/foonas/.mtn2git_empty index e69de29bb2..e69de29bb2 100644 --- a/packages/initscripts/initscripts-1.0/openzaurus/.mtn2git_empty +++ b/packages/initscripts/initscripts-1.0/foonas/.mtn2git_empty diff --git a/packages/initscripts/initscripts-1.0/foonas/checkroot.sh b/packages/initscripts/initscripts-1.0/foonas/checkroot.sh new file mode 100755 index 0000000000..c69a773482 --- /dev/null +++ b/packages/initscripts/initscripts-1.0/foonas/checkroot.sh @@ -0,0 +1,212 @@ +# +# checkroot.sh Check to root filesystem. +# +# Version: @(#)checkroot.sh 2.84 25-Jan-2002 miquels@cistron.nl +# + +. /etc/default/rcS + +# +# Set SULOGIN in /etc/default/rcS to yes if you want a sulogin to be spawned +# from this script *before anything else* with a timeout, like SCO does. +# +test "$SULOGIN" = yes && sulogin -t 30 $CONSOLE + +# +# Ensure that bdflush (update) is running before any major I/O is +# performed (the following fsck is a good example of such activity :). +# +test -x /sbin/update && update + +# +# Read /etc/fstab. +# +exec 9>&0 </etc/fstab +rootmode=rw +rootopts=rw +test "$ENABLE_ROOTFS_FSCK" = yes && rootcheck="yes" || rootcheck="no" +swap_on_md=no +devfs= +while read fs mnt type opts dump pass junk +do + case "$fs" in + ""|\#*) + continue; + ;; + /dev/md*) + # Swap on md device. + test "$type" = swap && swap_on_md=yes + ;; + /dev/*) + ;; + *) + # Might be a swapfile. + test "$type" = swap && swap_on_md=yes + ;; + esac + + test "$type" = devfs && devfs="$fs" + + # Currently we do not care about the other entries + if test "$mnt" = "/" + then + #echo "[$fs] [$mnt] [$type] [$opts] [$dump] [$pass] [$junk]" + + rootopts="$opts" + roottype="$type" + + #The "spinner" is broken on busybox sh + TERM=dumb + + test "$pass" = 0 -o "$pass" = "" && rootcheck=no + + # Enable fsck for ext2 and ext3 rootfs, disable for everything else + case "$type" in + ext2|ext3) rootcheck=yes;; + *) rootcheck=no;; + esac + + if test "$rootcheck" = yes + then + if ! test -x "/sbin/fsck.${roottype}" + then + echo -e "\n * * * WARNING: /sbin/fsck.${roottype} is missing! * * *\n" + rootcheck=no + fi + fi + + case "$opts" in + ro|ro,*|*,ro|*,ro,*) + rootmode=ro + ;; + esac + fi +done +exec 0>&9 9>&- + +# +# Activate the swap device(s) in /etc/fstab. This needs to be done +# before fsck, since fsck can be quite memory-hungry. +# +doswap=no +test -d /proc/1 || mount -n /proc +case "`uname -r`" in + 2.[0123].*) + if test $swap_on_md = yes && grep -qs resync /proc/mdstat + then + test "$VERBOSE" != no && echo "Not activating swap - RAID array resyncing" + else + doswap=yes + fi + ;; + *) + doswap=yes + ;; +esac +if test $doswap = yes +then + test "$VERBOSE" != no && echo "Activating swap" + swapon -a 2> /dev/null +fi + +# +# Check the root filesystem. +# +if test -f /fastboot || test $rootcheck = no +then + test $rootcheck = yes && echo "Fast boot, no filesystem check" +else + # + # Ensure that root is quiescent and read-only before fsck'ing. + # + mount -n -o remount,ro / + if test $? = 0 + then + if test -f /forcefsck + then + force="-f" + else + force="" + fi + if test "$FSCKFIX" = yes + then + fix="-y" + else + fix="-a" + fi + spinner="-C" + case "$TERM" in + dumb|network|unknown|"") spinner="" ;; + esac + test `uname -m` = s390 && spinner="" # This should go away + test "$VERBOSE" != no && echo "Checking root filesystem..." + fsck $spinner $force $fix / + # + # If there was a failure, drop into single-user mode. + # + # NOTE: "failure" is defined as exiting with a return code of + # 2 or larger. A return code of 1 indicates that filesystem + # errors were corrected but that the boot may proceed. + # + + echo "RETURNCODE: [$RTC]" + + if test "$RTC" -gt 3 + then + + # Since this script is run very early in the boot-process, it should be safe to assume that the + # output is printed to VT1. However, some distributions use a bootsplash to hide the "ugly" boot + # messages and having the bootsplash "hang" due to a waiting fsck prompt is less than ideal + chvt 1 + + # Surprise! Re-directing from a HERE document (as in + # "cat << EOF") won't work, because the root is read-only. + echo + echo "fsck failed. Please repair manually and reboot. " + echo "Please note that the root filesystem is currently " + echo "mounted read-only. To remount it read-write:" + echo + echo " # mount -n -o remount,rw /" + echo + echo "CONTROL-D will exit from this shell" + echo "and REBOOT the system." + echo + # Start a single user shell on the console + /sbin/sulogin $CONSOLE + reboot -f + fi + else + echo "*** ERROR! Cannot fsck root fs because it is not mounted read-only!" + echo + fi +fi + +devrootfound=$(grep "/dev/root" /proc/mounts | \ + awk '{if ($4 = /rw/) print "found";}' ) + +if [ -n "$devrootfound" -a "$devrootfound" = "found" ]; then + echo "Read/write /dev/root found." + exit 0 +fi + +if mount -vf -o remount / 2> /dev/null | \ + awk '{if ($6 ~ /rw/) exit 0; else exit 1; }' && \ + ! touch -c / 2> /dev/null + then + echo " Remounting root filesystem read/write" + mount -n -o remount,$rootmode / +fi + +if test "$rootmode" = rw +then + if test ! -L /etc/mtab + then + rm -f /etc/mtab~ /etc/nologin + : > /etc/mtab + fi + mount -f -o remount / + mount -f /proc + test "$devfs" && grep -q '^devfs /dev' /proc/mounts && mount -f "$devfs" +fi + +: exit 0 diff --git a/packages/initscripts/initscripts-1.0/foonas/devices b/packages/initscripts/initscripts-1.0/foonas/devices new file mode 100755 index 0000000000..f83ea63598 --- /dev/null +++ b/packages/initscripts/initscripts-1.0/foonas/devices @@ -0,0 +1,70 @@ +#!/bin/sh +# +# Devfs handling script. Since we arent running devfsd due to various reasons +# which I will not lay out here, we need to create some links for compatibility. + +. /etc/default/rcS + +# exit without doing anything if udev is active +if test -e /dev/.udev -o -e /dev/.udevdb; then + exit 0 +fi + +if test -e /dev/.devfsd +then + if test "$VERBOSE" != "no"; then echo -n "Setting up device links for devfs: "; fi + [ -e /dev/.linksmade ] && exit 0 + + ln -s /dev/tts/0 /dev/ttySA0 + ln -s /dev/tts/1 /dev/ttySA1 + + ln -s /dev/sound/dsp /dev/dsp + ln -s /dev/sound/mixer /dev/mixer + + ln -s /dev/misc/rtc /dev/rtc + + # + # some friendly disk links + # + ln -s /dev/discs/disc0/disc /dev/hda + ln -s /dev/discs/disc1/disc /dev/hdb + for i in 1 2 3 4; do + ln -s /dev/discs/disc0/part$i /dev/hda$i + ln -s /dev/discs/disc1/part$i /dev/hdb$i + done + + ## need this so that ppp will autoload the ppp modules + mknod /dev/ppp c 108 0 + ln -s /dev/zero /dev/.linksmade + + if test "$VERBOSE" != "no"; then echo "done"; fi +else + if test "$VERBOSE" != "no"; then echo -n "Mounting /dev ramdisk: "; fi + mount -t ramfs ramfs /dev || mount -t tmpfs ramfs /dev + if test $? -ne 0; then + if test "$VERBOSE" != "no"; then echo "failed"; fi + else + if test "$VERBOSE" != "no"; then echo "done"; fi + fi + if test "$VERBOSE" != "no"; then echo -n "Populating /dev: "; fi + cd / + mkdir -p dev/input + mkdir -p dev/msys + mkdir -p dev/pts + mkdir -p dev/vc + mkdir -p dev/snd + mkdir -p dev/tts + for i in 0 1 2 3 4 5 6 7 8 9; do + ln -s /dev/tty$i /dev/vc/$i + done + ln -sf /proc/self/fd /dev/fd + ln -sf /proc/kcore /dev/core + /sbin/makedevs -r / -D /etc/device_table + if test $? -ne 0; then + if test "$VERBOSE" != "no"; then echo "failed"; fi + else + if test "$VERBOSE" != "no"; then echo "done"; fi + fi +fi + +exit 0 diff --git a/packages/initscripts/initscripts-1.0/foonas/domainname.sh b/packages/initscripts/initscripts-1.0/foonas/domainname.sh new file mode 100644 index 0000000000..7113467d8c --- /dev/null +++ b/packages/initscripts/initscripts-1.0/foonas/domainname.sh @@ -0,0 +1,5 @@ +# +# domainname.sh Set the domainname. +# +test -r /etc/defaultdomain && + cat /etc/defaultdomain >/proc/sys/kernel/domainname diff --git a/packages/initscripts/initscripts-1.0/foonas/halt b/packages/initscripts/initscripts-1.0/foonas/halt new file mode 100755 index 0000000000..f22d892d46 --- /dev/null +++ b/packages/initscripts/initscripts-1.0/foonas/halt @@ -0,0 +1,27 @@ +#! /bin/sh +# +# halt Execute the halt command. +# +# Version: @(#)halt 2.84-2 07-Jan-2002 miquels@cistron.nl +# + +PATH=/sbin:/bin:/usr/sbin:/usr/bin + +# See if we need to cut the power. +if test -x /etc/init.d/ups-monitor +then + /etc/init.d/ups-monitor poweroff +fi + +# Don't shut down drives if we're using RAID. +hddown="-h" +if grep -qs '^md.*active' /proc/mdstat +then + hddown="" +fi + +echo "Powering down..." +scc -p off +halt -d -f -i -p $hddown + +: exit 0 diff --git a/packages/initscripts/initscripts-1.0/foonas/reboot b/packages/initscripts/initscripts-1.0/foonas/reboot new file mode 100755 index 0000000000..05a82be4c0 --- /dev/null +++ b/packages/initscripts/initscripts-1.0/foonas/reboot @@ -0,0 +1,12 @@ +#! /bin/sh +# +# reboot Execute the reboot command. +# +# Version: @(#)reboot 2.75 22-Jun-1998 miquels@cistron.nl +# + +PATH=/sbin:/bin:/usr/sbin:/usr/bin + +echo -n "Rebooting... " +scc -p restart +reboot -d -f -i diff --git a/packages/initscripts/initscripts-1.0/mountall.sh b/packages/initscripts/initscripts-1.0/mountall.sh index b5cb85a1e9..53bff0fbce 100755 --- a/packages/initscripts/initscripts-1.0/mountall.sh +++ b/packages/initscripts/initscripts-1.0/mountall.sh @@ -4,6 +4,9 @@ # Version: @(#)mountall.sh 2.83-2 01-Nov-2001 miquels@cistron.nl # . /etc/default/rcS +if test -f /etc/default/mountall; then + . /etc/default/mountall +fi # # Mount local filesystems in /etc/fstab. For some reason, people @@ -11,7 +14,7 @@ # about this. So we mount "proc" filesystems without -v. # test "$VERBOSE" != no && echo "Mounting local filesystems..." -mount -at nonfs,nosmbfs,noncpfs 2>/dev/null +mount -a $MOUNTALL 2>&1 | logger -s -p user.err # # We might have mounted something over /dev, see if /dev/initctl is there. @@ -41,5 +44,17 @@ then swapon -a 2> /dev/null fi +# A missing homedirectory for root can cause all sorts of problems. +# This can happen after user formats his /home partition for example + +if test -e /etc/passwd +then + ROOT_HOME="`cat /etc/passwd|grep ^root | awk '{split($0,x,":");printf("%s\n",x[6])}'`" + + if test -n "$ROOT_HOME" + then + ! test -d "$ROOT_HOME" && mkdir -p "$ROOT_HOME" + fi +fi : exit 0 diff --git a/packages/initscripts/initscripts-1.0/openzaurus/checkversion b/packages/initscripts/initscripts-1.0/openzaurus/checkversion deleted file mode 100755 index 0c8be4fc2d..0000000000 --- a/packages/initscripts/initscripts-1.0/openzaurus/checkversion +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/sh - -found=`cat /proc/version | cut -d ' ' -f3` -echo "$found" | grep -q "snapshot" && exit 0 - -if [ "VERSION" != "$found" ] ; then - echo -e >/dev/tty1 - echo -e "\033[31;1m ******************************************* \033[0m" >/dev/tty1 - echo -e "\033[31;1m * \033[0mW A R N I N G ! \033[31;1m* \033[0m" >/dev/tty1 - echo -e "\033[31;1m ******************************************* \033[0m" >/dev/tty1 - echo >/dev/tty1 - echo -e "\033[31;1m ******************************************* \033[0m" >/dev/tty1 - echo -e "\033[31;1m * \033[0mYou are running the wrong kernel! \033[31;1m* \033[0m" >/dev/tty1 - echo -e "\033[31;1m ******************************************* \033[0m" >/dev/tty1 - echo >/dev/tty1 - echo -e "You are running '" $found "'" >/dev/tty1 - echo -e "I expect kernel '" VERSION "'" >/dev/tty1 - echo >/dev/tty1 - echo -e "\033[31;1m ******************************************* \033[0m" >/dev/tty1 - echo -e "\033[31;1m * \033[0mRunning this combination is unsupported \033[31;1m* \033[0m" >/dev/tty1 - echo -e "\033[31;1m ******************************************* \033[0m" >/dev/tty1 - echo >/dev/tty1 - echo "I will sleep for 1 minute now. Use this chance to " >/dev/tty1 - echo "reboot the device and flash the proper kernel now! " >/dev/tty1 - echo -e >/dev/tty1 - echo -e "\033[31;1m ******************************************* \033[0m" >/dev/tty1 - echo -e "\033[31;1m * \033[0mW A R N I N G ! \033[31;1m* \033[0m" >/dev/tty1 - echo -e "\033[31;1m ******************************************* \033[0m" >/dev/tty1 - echo >/dev/tty1 - sleep 60 -fi diff --git a/packages/initscripts/initscripts-1.0/oplinux-uclibc/.mtn2git_empty b/packages/initscripts/initscripts-1.0/oplinux-uclibc/.mtn2git_empty new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/packages/initscripts/initscripts-1.0/oplinux-uclibc/.mtn2git_empty diff --git a/packages/initscripts/initscripts-1.0/angstrom/checkroot.sh b/packages/initscripts/initscripts-1.0/oplinux-uclibc/checkroot.sh index e5fc6ed8b5..e5fc6ed8b5 100755 --- a/packages/initscripts/initscripts-1.0/angstrom/checkroot.sh +++ b/packages/initscripts/initscripts-1.0/oplinux-uclibc/checkroot.sh diff --git a/packages/initscripts/initscripts-1.0/oplinux-uclibc/mountall.sh b/packages/initscripts/initscripts-1.0/oplinux-uclibc/mountall.sh new file mode 100755 index 0000000000..33d7065275 --- /dev/null +++ b/packages/initscripts/initscripts-1.0/oplinux-uclibc/mountall.sh @@ -0,0 +1,45 @@ +# +# mountall.sh Mount all filesystems. +# +# Version: @(#)mountall.sh 2.83-2 01-Nov-2001 miquels@cistron.nl +# +. /etc/default/rcS + +# +# Mount local filesystems in /etc/fstab. For some reason, people +# might want to mount "proc" several times, and mount -v complains +# about this. So we mount "proc" filesystems without -v. +# +test "$VERBOSE" != no && echo "Mounting local filesystems..." +mount -a 2>/dev/null + +# +# We might have mounted something over /dev, see if /dev/initctl is there. +# +if test ! -p /dev/initctl +then + rm -f /dev/initctl + mknod -m 600 /dev/initctl p +fi +kill -USR1 1 + +# +# Execute swapon command again, in case we want to swap to +# a file on a now mounted filesystem. +# +doswap=yes +case "`uname -r`" in + 2.[0123].*) + if grep -qs resync /proc/mdstat + then + doswap=no + fi + ;; +esac +if test $doswap = yes +then + swapon -a 2> /dev/null +fi + +: exit 0 + diff --git a/packages/initscripts/initscripts-1.0/oplinux/.mtn2git_empty b/packages/initscripts/initscripts-1.0/oplinux/.mtn2git_empty new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/packages/initscripts/initscripts-1.0/oplinux/.mtn2git_empty diff --git a/packages/initscripts/initscripts-1.0/oplinux/checkroot.sh b/packages/initscripts/initscripts-1.0/oplinux/checkroot.sh new file mode 100755 index 0000000000..e5fc6ed8b5 --- /dev/null +++ b/packages/initscripts/initscripts-1.0/oplinux/checkroot.sh @@ -0,0 +1,201 @@ +# +# checkroot.sh Check to root filesystem. +# +# Version: @(#)checkroot.sh 2.84 25-Jan-2002 miquels@cistron.nl +# + +. /etc/default/rcS + +# +# Set SULOGIN in /etc/default/rcS to yes if you want a sulogin to be spawned +# from this script *before anything else* with a timeout, like SCO does. +# +test "$SULOGIN" = yes && sulogin -t 30 $CONSOLE + +# +# Ensure that bdflush (update) is running before any major I/O is +# performed (the following fsck is a good example of such activity :). +# +test -x /sbin/update && update + +# +# Read /etc/fstab. +# +exec 9>&0 </etc/fstab +rootmode=rw +rootopts=rw +test "$ENABLE_ROOTFS_FSCK" = yes && rootcheck="yes" || rootcheck="no" +swap_on_md=no +devfs= +while read fs mnt type opts dump pass junk +do + case "$fs" in + ""|\#*) + continue; + ;; + /dev/md*) + # Swap on md device. + test "$type" = swap && swap_on_md=yes + ;; + /dev/*) + ;; + *) + # Might be a swapfile. + test "$type" = swap && swap_on_md=yes + ;; + esac + + test "$type" = devfs && devfs="$fs" + + # Currently we do not care about the other entries + if test "$mnt" = "/" + then + #echo "[$fs] [$mnt] [$type] [$opts] [$dump] [$pass] [$junk]" + + rootopts="$opts" + roottype="$type" + + #The "spinner" is broken on busybox sh + TERM=dumb + + test "$pass" = 0 -o "$pass" = "" && rootcheck=no + + # Enable fsck for ext2 and ext3 rootfs, disable for everything else + case "$type" in + ext2|ext3) rootcheck=yes;; + *) rootcheck=no;; + esac + + if test "$rootcheck" = yes + then + if ! test -x "/sbin/fsck.${roottype}" + then + echo -e "\n * * * WARNING: /sbin/fsck.${roottype} is missing! * * *\n" + rootcheck=no + fi + fi + + case "$opts" in + ro|ro,*|*,ro|*,ro,*) + rootmode=ro + ;; + esac + fi +done +exec 0>&9 9>&- + +# +# Activate the swap device(s) in /etc/fstab. This needs to be done +# before fsck, since fsck can be quite memory-hungry. +# +doswap=no +test -d /proc/1 || mount -n /proc +case "`uname -r`" in + 2.[0123].*) + if test $swap_on_md = yes && grep -qs resync /proc/mdstat + then + test "$VERBOSE" != no && echo "Not activating swap - RAID array resyncing" + else + doswap=yes + fi + ;; + *) + doswap=yes + ;; +esac +if test $doswap = yes +then + test "$VERBOSE" != no && echo "Activating swap" + swapon -a 2> /dev/null +fi + +# +# Check the root filesystem. +# +if test -f /fastboot || test $rootcheck = no +then + test $rootcheck = yes && echo "Fast boot, no filesystem check" +else + # + # Ensure that root is quiescent and read-only before fsck'ing. + # + mount -n -o remount,ro / + if test $? = 0 + then + if test -f /forcefsck + then + force="-f" + else + force="" + fi + if test "$FSCKFIX" = yes + then + fix="-y" + else + fix="-a" + fi + spinner="-C" + case "$TERM" in + dumb|network|unknown|"") spinner="" ;; + esac + test `uname -m` = s390 && spinner="" # This should go away + test "$VERBOSE" != no && echo "Checking root filesystem..." + fsck $spinner $force $fix / + # + # If there was a failure, drop into single-user mode. + # + # NOTE: "failure" is defined as exiting with a return code of + # 2 or larger. A return code of 1 indicates that filesystem + # errors were corrected but that the boot may proceed. + # + if test "$?" -gt 1 + then + # Surprise! Re-directing from a HERE document (as in + # "cat << EOF") won't work, because the root is read-only. + echo + echo "fsck failed. Please repair manually and reboot. Please note" + echo "that the root filesystem is currently mounted read-only. To" + echo "remount it read-write:" + echo + echo " # mount -n -o remount,rw /" + echo + echo "CONTROL-D will exit from this shell and REBOOT the system." + echo + # Start a single user shell on the console + /sbin/sulogin $CONSOLE + reboot -f + fi + else + echo "*** ERROR! Cannot fsck root fs because it is not mounted read-only!" + echo + fi +fi + +# +# If the root filesystem was not marked as read-only in /etc/fstab, +# remount the rootfs rw but do not try to change mtab because it +# is on a ro fs until the remount succeeded. Then clean up old mtabs +# and finally write the new mtab. +# This part is only needed if the rootfs was mounted ro. +# + +if [ $(grep "/dev/root" /proc/mounts | awk '{print $4}') = rw ]; then + exit 0 +fi + + +echo "Remounting root file system..." +mount -n -o remount,$rootmode / +if test "$rootmode" = rw +then + if test ! -L /etc/mtab + then + rm -f /etc/mtab~ /etc/nologin + : > /etc/mtab + fi + mount -f -o remount / + mount -f /proc + test "$devfs" && grep -q '^devfs /dev' /proc/mounts && mount -f "$devfs" +fi + +: exit 0 diff --git a/packages/initscripts/initscripts-1.0/ramdisk b/packages/initscripts/initscripts-1.0/ramdisk index 03ac9bd05b..4dfe53cf61 100755 --- a/packages/initscripts/initscripts-1.0/ramdisk +++ b/packages/initscripts/initscripts-1.0/ramdisk @@ -22,6 +22,9 @@ else RAM_MTDBLK=/dev/mtdblock$RAM_MTD_NO fi +if grep -q $RAM_MTDBLK /etc/mtab; then echo "Device $RAM_MTDBLK already mounted"; exit 0; fi +if test ! -e $RAM_MTD; then echo >&2 "Mtdram device $RAM_MTD does not exist!"; exit 1; fi + RAM_MNTPT=/mnt/ram RAM_MTD_SIZE_HEX=`cat /proc/mtd | grep mtdram | tail -n 1 | cut -d" " -f 2` RAM_MTD_SIZE=`dc 0x$RAM_MTD_SIZE_HEX 1024 / p` diff --git a/packages/initscripts/initscripts-1.0/volatiles b/packages/initscripts/initscripts-1.0/volatiles index 4320485663..3c680b2643 100644 --- a/packages/initscripts/initscripts-1.0/volatiles +++ b/packages/initscripts/initscripts-1.0/volatiles @@ -21,18 +21,16 @@ # This explains the order of "link before object" as in the example above, where # a link will be created at /var/test pointing to /tmp/testfile and due to this # link the file defined as /var/test will actually be created as /tmp/testfile. -d root root 0775 /var none -d root root 0755 /var/backups none -d root root 0755 /var/cache none -d root root 0755 /var/lib none -d root root 0755 /var/lib/ipkg none -d root root 0755 /var/lib/misc none -d root root 2775 /var/local none -d root root 1777 /var/lock none +d root root 0755 /var/volatile/cache none +d root root 1777 /var/volatile/lock none +d root root 0755 /var/volatile/log none +d root root 0755 /var/volatile/run none +d root root 1777 /var/volatile/tmp none +l root root 0755 /var/cache /var/volatile/cache +l root root 1777 /var/lock /var/volatile/lock +l root root 0755 /var/log /var/volatile/log +l root root 0755 /var/run /var/volatile/run +l root root 1777 /var/tmp /var/volatile/tmp d root root 0755 /var/lock/subsys none -d root root 0755 /var/log none -d root root 0755 /var/run none -d root root 0755 /var/spool none -d root root 1777 /var/tmp none -f root root 0664 /var/run/utmp none f root root 0664 /var/log/wtmp none +f root root 0664 /var/run/utmp none |