diff options
author | Denys Dmytriyenko <denis@denix.org> | 2009-03-17 14:32:59 -0400 |
---|---|---|
committer | Denys Dmytriyenko <denis@denix.org> | 2009-03-17 14:32:59 -0400 |
commit | 709c4d66e0b107ca606941b988bad717c0b45d9b (patch) | |
tree | 37ee08b1eb308f3b2b6426d5793545c38396b838 /recipes/initscripts | |
parent | fa6cd5a3b993f16c27de4ff82b42684516d433ba (diff) |
rename packages/ to recipes/ per earlier agreement
See links below for more details:
http://thread.gmane.org/gmane.comp.handhelds.openembedded/21326
http://thread.gmane.org/gmane.comp.handhelds.openembedded/21816
Signed-off-by: Denys Dmytriyenko <denis@denix.org>
Acked-by: Mike Westerhof <mwester@dls.net>
Acked-by: Philip Balister <philip@balister.org>
Acked-by: Khem Raj <raj.khem@gmail.com>
Acked-by: Marcin Juszkiewicz <hrw@openembedded.org>
Acked-by: Koen Kooi <koen@openembedded.org>
Acked-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
Diffstat (limited to 'recipes/initscripts')
95 files changed, 6163 insertions, 0 deletions
diff --git a/recipes/initscripts/files/arm/alignment.sh b/recipes/initscripts/files/arm/alignment.sh new file mode 100644 index 0000000000..32a9eaace2 --- /dev/null +++ b/recipes/initscripts/files/arm/alignment.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +if [ -e /proc/cpu/alignment ] && ! [ $(uname -m) = "armv7l" ]; then + echo "3" > /proc/cpu/alignment +fi + diff --git a/recipes/initscripts/files/devpts b/recipes/initscripts/files/devpts new file mode 100644 index 0000000000..e10e371662 --- /dev/null +++ b/recipes/initscripts/files/devpts @@ -0,0 +1,5 @@ +# GID of the `tty' group +TTYGRP=5 + +# Set to 600 to have `mesg n' be the default +TTYMODE=620 diff --git a/recipes/initscripts/files/finish.sh b/recipes/initscripts/files/finish.sh new file mode 100644 index 0000000000..4f9f75f47c --- /dev/null +++ b/recipes/initscripts/files/finish.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +if ! test -e /etc/.configured; then + > /etc/.configured +fi + diff --git a/recipes/initscripts/files/functions b/recipes/initscripts/files/functions new file mode 100644 index 0000000000..fb9a914e4d --- /dev/null +++ b/recipes/initscripts/files/functions @@ -0,0 +1,17 @@ +# -*-Shell-script-*- +# +# functions This file contains functions to be used by most or all +# shell scripts in the /etc/init.d directory. +# + +machine_id() { # return the machine ID + awk 'BEGIN { FS=": " } /Hardware/ { gsub(" ", "_", $2); print tolower($2) } ' </proc/cpuinfo +} + +killproc() { # kill the named process(es) + pid=`/bin/ps -e x | + /bin/grep $1 | + /bin/grep -v grep | + /bin/sed -e 's/^ *//' -e 's/ .*//'` + [ "$pid" != "" ] && kill $pid +} diff --git a/recipes/initscripts/files/halt b/recipes/initscripts/files/halt new file mode 100644 index 0000000000..d8cab222ca --- /dev/null +++ b/recipes/initscripts/files/halt @@ -0,0 +1,25 @@ +#! /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 + +halt -d -f -i -p $hddown + +: exit 0 diff --git a/recipes/initscripts/files/hostname.sh b/recipes/initscripts/files/hostname.sh new file mode 100644 index 0000000000..1a3fd2f17e --- /dev/null +++ b/recipes/initscripts/files/hostname.sh @@ -0,0 +1,12 @@ +#!/bin/sh +# +# hostname.sh Set hostname. +# +# Version: @(#)hostname.sh 1.10 26-Feb-2001 miquels@cistron.nl +# + +if test -f /etc/hostname +then + hostname -F /etc/hostname +fi + diff --git a/recipes/initscripts/files/reboot b/recipes/initscripts/files/reboot new file mode 100644 index 0000000000..56278199be --- /dev/null +++ b/recipes/initscripts/files/reboot @@ -0,0 +1,11 @@ +#! /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... " +reboot -d -f -i diff --git a/recipes/initscripts/files/rmnologin b/recipes/initscripts/files/rmnologin new file mode 100644 index 0000000000..444145a26a --- /dev/null +++ b/recipes/initscripts/files/rmnologin @@ -0,0 +1,14 @@ +#! /bin/sh +# +# rmnologin This script removes the /etc/nologin file as the last +# step in the boot process. +# +# Version: @(#)rmnologin 1.00 22-Jun-1998 miquels@cistron.nl +# + +if test -f /etc/nologin.boot +then + rm -f /etc/nologin /etc/nologin.boot +fi + +: exit 0 diff --git a/recipes/initscripts/files/save-rtc.sh b/recipes/initscripts/files/save-rtc.sh new file mode 100644 index 0000000000..e786073051 --- /dev/null +++ b/recipes/initscripts/files/save-rtc.sh @@ -0,0 +1,5 @@ +#! /bin/sh +/etc/init.d/hwclock.sh stop + +# Update the timestamp +date +%2m%2d%2H%2M%Y > /etc/timestamp diff --git a/recipes/initscripts/files/sendsigs b/recipes/initscripts/files/sendsigs new file mode 100644 index 0000000000..c62a5cd37d --- /dev/null +++ b/recipes/initscripts/files/sendsigs @@ -0,0 +1,17 @@ +#! /bin/sh +# +# sendsigs Kill all remaining processes. +# +# Version: @(#)sendsigs 2.75 22-Jun-1998 miquels@cistron.nl +# + +PATH=/sbin:/bin:/usr/sbin:/usr/bin + +# Kill all processes. +echo "Sending all processes the TERM signal..." +killall5 -15 +sleep 5 +echo "Sending all processes the KILL signal..." +killall5 -9 + +: exit 0 diff --git a/recipes/initscripts/files/umountfs b/recipes/initscripts/files/umountfs new file mode 100644 index 0000000000..ec75b0c4a4 --- /dev/null +++ b/recipes/initscripts/files/umountfs @@ -0,0 +1,18 @@ +#! /bin/sh +# +# umountfs Turn off swap and unmount all local filesystems. +# + +PATH=/sbin:/bin:/usr/sbin:/usr/bin + +echo "Deactivating swap..." +swapoff -a + +# We leave /proc mounted. +echo "Unmounting local filesystems..." +mount -o remount,ro /mnt/ram +umount -f -a -r + +mount -o remount,ro / + +: exit 0 diff --git a/recipes/initscripts/files/umountnfs.sh b/recipes/initscripts/files/umountnfs.sh new file mode 100644 index 0000000000..f5fe48aa74 --- /dev/null +++ b/recipes/initscripts/files/umountnfs.sh @@ -0,0 +1,28 @@ +#! /bin/sh +# +# umountnfs.sh Unmount all network filesystems. +# + +PATH=/sbin:/bin:/usr/sbin:/usr/bin + +# Write a reboot record to /var/log/wtmp before unmounting +halt -w + +echo "Unmounting remote filesystems..." + +test -f /etc/fstab && ( + +# +# Read through fstab line by line and unount network file systems +# +while read device mountpt fstype options +do + if test "$fstype" = nfs || test "$fstype" = smbfs || test "$fstype" = ncpfs + then + umount -f $mountpt + fi +done +) < /etc/fstab + +: exit 0 + diff --git a/recipes/initscripts/files/volatiles b/recipes/initscripts/files/volatiles new file mode 100644 index 0000000000..fbcc858226 --- /dev/null +++ b/recipes/initscripts/files/volatiles @@ -0,0 +1,40 @@ +# This configuration file lists filesystem objects that should get verified +# during startup and be created if missing. +# +# Every line must either be a comment starting with # +# or a definition of format: +# <type> <owner> <group> <mode> <path> <linksource> +# where the items are separated by whitespace ! +# +# <type> : d|f|l : (d)irectory|(f)ile|(l)ink +# +# A linking example: +# l root root 0777 /var/test /tmp/testfile +# f root root 0644 /var/test none +# +# Understanding links: +# When populate-volatile is to verify/create a directory or file, it will first +# check it's existence. If a link is found to exist in the place of the target, +# the path of the target is replaced with the target the link points to. +# Thus, if a link is in the place to be verified, the object will be created +# in the place the link points to instead. +# 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 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 +f root root 0664 /var/log/wtmp none +f root root 0644 /var/log/lastlog none +f root root 0664 /var/run/utmp none +l root root 0644 /etc/resolv.conf /var/run/resolv.conf +f root root 0644 /var/run/resolv.conf none + diff --git a/recipes/initscripts/initscripts-1.0/akita/devices b/recipes/initscripts/initscripts-1.0/akita/devices new file mode 100755 index 0000000000..083090ecb9 --- /dev/null +++ b/recipes/initscripts/initscripts-1.0/akita/devices @@ -0,0 +1,68 @@ +#!/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/.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 + ln -s /dev/touchscreen/0 /dev/ts + ln -s /dev/touchscreen/0raw /dev/tsraw + ln -s /dev/vc/0 /dev/tty0 + ln -s /dev/vc/1 /dev/tty1 + ln -s /dev/vc/2 /dev/tty2 + ln -s /dev/vc/3 /dev/tty3 + ln -s /dev/vc/4 /dev/tty4 + ln -s /dev/vc/5 /dev/tty5 + ln -s /dev/fb/0 /dev/fb0 +# ln -s /dev/tts/0 /dev/ttySA0 +# ln -s /dev/tts/1 /dev/ttySA1 +# ln -s /dev/tts/2 /dev/ttySA2 + + ln -s /dev/sound/dsp /dev/dsp + ln -s /dev/sound/mixer /dev/mixer + + ln -s /dev/v4l/video0 /dev/video0 + ln -s /dev/v4l/video0 /dev/video + ln -s /dev/misc/rtc /dev/rtc + + ## need this so that ppp will autoload the ppp modules + mknod /dev/ppp c 108 0 + 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/msys + mkdir -p dev/pts + mkdir -p dev/input + mkdir -p dev/vc + 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 /dev/sharp_ts /dev/ts + ln -sf /dev/sharp_fl /dev/fl + 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/recipes/initscripts/initscripts-1.0/banner b/recipes/initscripts/initscripts-1.0/banner new file mode 100644 index 0000000000..0349ce1954 --- /dev/null +++ b/recipes/initscripts/initscripts-1.0/banner @@ -0,0 +1,17 @@ +#!/bin/sh + +if [ ! -e /dev/tty ]; then + /bin/mknod -m 0666 /dev/tty c 5 0 +fi + +if ( > /dev/tty0 ) 2>/dev/null; then + vtmaster=/dev/tty0 +elif ( > /dev/vc/0 ) 2>/dev/null; then + vtmaster=/dev/vc/0 +elif ( > /dev/console ) 2>/dev/null; then + vtmaster=/dev/console +else + vtmaster=/dev/null +fi +echo > $vtmaster +echo "Please wait: booting..." > $vtmaster diff --git a/recipes/initscripts/initscripts-1.0/bootmisc.sh b/recipes/initscripts/initscripts-1.0/bootmisc.sh new file mode 100755 index 0000000000..dde1209be5 --- /dev/null +++ b/recipes/initscripts/initscripts-1.0/bootmisc.sh @@ -0,0 +1,80 @@ +# +# bootmisc.sh Miscellaneous things to be done during bootup. +# + +. /etc/default/rcS +# +# Put a nologin file in /etc to prevent people from logging in before +# system startup is complete. +# +if test "$DELAYLOGIN" = yes +then + echo "System bootup in progress - please wait" > /etc/nologin + cp /etc/nologin /etc/nologin.boot +fi + +# +# Set pseudo-terminal access permissions. +# +if ( ! grep -q devfs /proc/mounts ) && test -c /dev/ttyp0 +then + chmod 666 /dev/tty[p-za-e][0-9a-f] + chown root:tty /dev/tty[p-za-e][0-9a-f] +fi + +# +# Apply /proc settings if defined +# +SYSCTL_CONF="/etc/sysctl.conf" +if [ -f "${SYSCTL_CONF}" ] +then + if [ -x "/sbin/sysctl" ] + then + /sbin/sysctl -p "${SYSCTL_CONF}" + else + echo "To have ${SYSCTL_CONF} applied during boot, install package <procps>." + fi +fi + +# +# Update /etc/motd. +# +if test "$EDITMOTD" != no +then + uname -a > /etc/motd.tmp + sed 1d /etc/motd >> /etc/motd.tmp + mv /etc/motd.tmp /etc/motd +fi + +# +# This is as good a place as any for a sanity check +# /tmp should be a symlink to /var/tmp to cut down on the number +# of mounted ramdisks. +if test ! -L /tmp && test -d /var/tmp +then + rm -rf /tmp + ln -sf /var/tmp /tmp +fi + +# +# Update dynamic library cache, but only if ld.so.conf is present +# +if [ -e /etc/ld.so.conf ] ; then + /sbin/ldconfig +fi + +# Set the system clock from hardware clock +# If the timestamp is 1 day or more recent than the current time, +# use the timestamp instead. +/etc/init.d/hwclock.sh start +if test -e /etc/timestamp +then + SYSTEMDATE=`date "+%Y%m%d"` + TIMESTAMP=`cat /etc/timestamp | awk '{ print substr($0,9,4) substr($0,1,4);}'` + NEEDUPDATE=`expr \( $TIMESTAMP \> $SYSTEMDATE \)` + if [ $NEEDUPDATE -eq 1 ]; then + date `cat /etc/timestamp` + /etc/init.d/hwclock.sh stop + fi +fi +: exit 0 diff --git a/recipes/initscripts/initscripts-1.0/c7x0/devices b/recipes/initscripts/initscripts-1.0/c7x0/devices new file mode 100755 index 0000000000..083090ecb9 --- /dev/null +++ b/recipes/initscripts/initscripts-1.0/c7x0/devices @@ -0,0 +1,68 @@ +#!/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/.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 + ln -s /dev/touchscreen/0 /dev/ts + ln -s /dev/touchscreen/0raw /dev/tsraw + ln -s /dev/vc/0 /dev/tty0 + ln -s /dev/vc/1 /dev/tty1 + ln -s /dev/vc/2 /dev/tty2 + ln -s /dev/vc/3 /dev/tty3 + ln -s /dev/vc/4 /dev/tty4 + ln -s /dev/vc/5 /dev/tty5 + ln -s /dev/fb/0 /dev/fb0 +# ln -s /dev/tts/0 /dev/ttySA0 +# ln -s /dev/tts/1 /dev/ttySA1 +# ln -s /dev/tts/2 /dev/ttySA2 + + ln -s /dev/sound/dsp /dev/dsp + ln -s /dev/sound/mixer /dev/mixer + + ln -s /dev/v4l/video0 /dev/video0 + ln -s /dev/v4l/video0 /dev/video + ln -s /dev/misc/rtc /dev/rtc + + ## need this so that ppp will autoload the ppp modules + mknod /dev/ppp c 108 0 + 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/msys + mkdir -p dev/pts + mkdir -p dev/input + mkdir -p dev/vc + 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 /dev/sharp_ts /dev/ts + ln -sf /dev/sharp_fl /dev/fl + 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/recipes/initscripts/initscripts-1.0/checkfs.sh b/recipes/initscripts/initscripts-1.0/checkfs.sh new file mode 100755 index 0000000000..7d2d75ef57 --- /dev/null +++ b/recipes/initscripts/initscripts-1.0/checkfs.sh @@ -0,0 +1,46 @@ +# +# checkfs.sh Check all filesystems. +# +# Version: @(#)checkfs 2.83 05-Oct-2001 miquels@cistron.nl +# + +. /etc/default/rcS + +# +# Check the rest of the filesystems. +# +if test ! -f /fastboot +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 all filesystems..." + fsck $spinner -R -A $fix $force + if test "$?" -gt 1 + then + echo + echo "fsck failed. Please repair manually." + echo + echo "CONTROL-D will exit from this shell and continue system startup." + echo + # Start a single user shell on the console + /sbin/sulogin $CONSOLE + fi +fi +rm -f /fastboot /forcefsck + +: exit 0 diff --git a/recipes/initscripts/initscripts-1.0/checkroot b/recipes/initscripts/initscripts-1.0/checkroot new file mode 100755 index 0000000000..e5aa9aaf99 --- /dev/null +++ b/recipes/initscripts/initscripts-1.0/checkroot @@ -0,0 +1,215 @@ +# +# 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 + + # Allow fsck for ext2 and ext3 rootfs, disable for everything else + case "$type" in + ext2|ext3) ;; + *) 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 / </dev/null + RTC=$? + # + # 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 + +# +# 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. +# +ROOTFSDEV="/dev/root" +if ! grep -q "^$ROOTFSDEV\w" /proc/mounts; then + ROOTFSDEV="rootfs" +fi +if [ x$(grep "^$ROOTFSDEV\w" /proc/mounts | awk '{print $4}') = "xrw" ]; then + echo "Root filesystem already read-write, not remounting" + 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 -o remount /proc + test "$devfs" && grep -q '^devfs /dev' /proc/mounts && mount -f "$devfs" +fi + +: exit 0 diff --git a/recipes/initscripts/initscripts-1.0/collie/devices b/recipes/initscripts/initscripts-1.0/collie/devices new file mode 100755 index 0000000000..9d1624428a --- /dev/null +++ b/recipes/initscripts/initscripts-1.0/collie/devices @@ -0,0 +1,67 @@ +#!/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/.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 + ln -s /dev/touchscreen/0 /dev/ts + ln -s /dev/touchscreen/0raw /dev/tsraw + ln -s /dev/vc/0 /dev/tty0 + ln -s /dev/vc/1 /dev/tty1 + ln -s /dev/vc/2 /dev/tty2 + ln -s /dev/vc/3 /dev/tty3 + ln -s /dev/vc/4 /dev/tty4 + ln -s /dev/vc/5 /dev/tty5 + ln -s /dev/fb/0 /dev/fb0 +# ln -s /dev/tts/0 /dev/ttySA0 +# ln -s /dev/tts/1 /dev/ttySA1 +# ln -s /dev/tts/2 /dev/ttySA2 + + ln -s /dev/sound/dsp /dev/dsp + ln -s /dev/sound/mixer /dev/mixer + + ln -s /dev/v4l/video0 /dev/video0 + ln -s /dev/v4l/video0 /dev/video + ln -s /dev/misc/rtc /dev/rtc + + ## need this so that ppp will autoload the ppp modules + mknod /dev/ppp c 108 0 + 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/msys + mkdir -p dev/pts + mkdir -p dev/vc + 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 /dev/sharp_ts /dev/ts + ln -sf /dev/sharp_fl /dev/fl + 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/recipes/initscripts/initscripts-1.0/device_table.txt b/recipes/initscripts/initscripts-1.0/device_table.txt new file mode 100644 index 0000000000..a302c5aca3 --- /dev/null +++ b/recipes/initscripts/initscripts-1.0/device_table.txt @@ -0,0 +1,197 @@ +#/dev/ d 775 0 0 - - - - - +#/dev/msys d 775 0 0 - - - - - +#/dev/pts d 775 0 0 - - - - - +#/var d 775 0 0 - - - - - +/boot/var/empty d 755 0 3 - - - - +/dev/apm_bios c 660 0 46 10 134 - - - +/dev/audio c 660 0 29 14 4 - - - +/dev/audio1 c 660 0 29 14 20 - - - +/dev/audio2 c 660 0 29 14 36 - - - +/dev/audio3 c 660 0 29 14 52 - - - +/dev/bty c 644 0 0 60 0 0 1 5 +/dev/sharp_fl c 640 0 44 254 0 - - - +/dev/console c 660 0 5 5 1 - - +/dev/cusa0 c 640 0 0 205 5 - - - +/dev/cusa1 c 640 0 0 205 6 - - - +/dev/cusa2 c 640 0 0 205 7 - - - +/dev/dsp c 660 0 29 14 3 - - - +/dev/dsp1 c 660 0 29 14 19 - - - +/dev/dsp2 c 660 0 29 14 35 - - - +/dev/dsp3 c 660 0 29 14 51 - - - +/dev/fb c 660 0 44 29 0 0 32 2 +/dev/fb0autodetect c 660 0 44 29 1 - - - +/dev/fb0current c 660 0 44 29 0 - - - +#/dev/fb1 c 660 0 44 29 32 - - - +/dev/fb1autodetect c 660 0 44 29 33 - - - +/dev/fb1current c 660 0 44 29 32 - - - +/dev/full c 666 0 7 - - - +/dev/hda b 660 0 6 3 0 - - - +/dev/hda b 660 0 6 3 1 1 1 20 +/dev/hdb b 660 0 6 3 64 - - - +/dev/hdb b 660 0 6 3 65 1 1 20 +/dev/hdc b 660 0 6 22 0 - - - +/dev/hdc b 660 0 6 22 1 1 1 20 +/dev/initctl p 600 0 0 - - - - +/dev/i2c0 c 660 0 0 89 0 - - - +/dev/inportbm c 660 0 0 10 2 - - - +/dev/input/event c 660 0 0 13 64 0 1 20 +/dev/ircomm0 c 640 0 0 161 0 - - - +/dev/jbm c 660 0 0 10 4 - - - +/dev/kmem c 640 0 15 1 2 - - - +/dev/lirc c 660 0 5 61 0 - - - +/dev/logibm c 660 0 0 10 0 - - - +/dev/loop0 b 660 0 11 7 0 - - - +/dev/loop1 b 660 0 11 7 1 - - - +/dev/mem c 640 0 15 1 1 - - - +/dev/mixer c 666 0 0 14 0 - - - +/dev/mixer1 c 666 0 0 14 16 - - - +/dev/mixer2 c 666 0 0 14 32 - - - +/dev/mixer3 c 666 0 0 14 48 - - - +/dev/mmcda b 640 0 0 60 0 - - - +/dev/mmcda1 b 640 0 0 60 1 - - - +/dev/mmcda2 b 640 0 0 60 2 - - - +/dev/msys/fla b 660 0 11 100 0 - - - +/dev/msys/fla1 b 660 0 11 100 1 - - - +/dev/msys/fla2 b 660 0 11 100 2 - - - +/dev/msys/fla3 b 660 0 11 100 3 - - - +/dev/msys/fla4 b 660 0 11 100 4 - - - +/dev/msys/flb b 660 0 11 100 64 - - - +/dev/msys/flb1 b 660 0 11 100 65 - - - +/dev/msys/flb2 b 660 0 11 100 66 - - - +/dev/msys/flb3 b 660 0 11 100 67 - - - +/dev/msys/flb4 b 660 0 11 100 68 - - - +/dev/mtd c 660 0 6 90 0 0 2 8 +/dev/mtdblock b 640 0 0 31 0 0 1 8 +/dev/nst0 c 664 0 11 9 128 - - - +/dev/nst0a c 664 0 11 9 224 - - - +/dev/nst0l c 664 0 11 9 160 - - - +/dev/nst0m c 664 0 11 9 192 - - - +/dev/nst1 c 664 0 11 9 129 - - - +/dev/nst1a c 664 0 11 9 225 - - - +/dev/nst1l c 664 0 11 9 161 - - - +/dev/nst1m c 664 0 11 9 193 - - - +/dev/null c 666 0 0 1 3 - - - +/dev/par0 c 660 0 7 6 0 - - - +/dev/par1 c 660 0 7 6 1 - - - +/dev/par2 c 660 0 7 6 2 - - - +/dev/port c 640 0 15 1 4 - - - +/dev/ppp c 640 0 0 108 0 - - - +/dev/psaux c 660 0 0 10 1 - - - +/dev/ptmx c 666 0 5 5 2 - - - +/dev/ptya0 c 660 0 5 2 176 - - - +/dev/ptya1 c 660 0 5 2 177 - - - +/dev/ptya2 c 660 0 5 2 178 - - - +/dev/ptya3 c 660 0 5 2 179 - - - +/dev/ptya4 c 660 0 5 2 180 - - - +/dev/ptya5 c 660 0 5 2 181 - - - +/dev/ptya6 c 660 0 5 2 182 - - - +/dev/ptya7 c 660 0 5 2 183 - - - +/dev/ptya8 c 660 0 5 2 184 - - - +/dev/ptya9 c 660 0 5 2 185 - - - +/dev/ptyaa c 660 0 5 2 186 - - - +/dev/ptyab c 660 0 5 2 187 - - - +/dev/ptyac c 660 0 5 2 188 - - - +/dev/ptyad c 660 0 5 2 189 - - - +/dev/ptyae c 660 0 5 2 190 - - - +/dev/ptyaf c 660 0 5 2 191 - - - +/dev/ram b 640 0 0 1 0 0 1 4 +/dev/random c 444 0 0 1 8 - - - +/dev/rfcomm0 c 660 0 0 216 0 - - - +/dev/rfcomm1 c 660 0 0 216 1 - - - +/dev/rfcomm2 c 660 0 0 216 2 - - - +/dev/rfcomm3 c 660 0 0 216 3 - - - +/dev/rfcomm4 c 660 0 0 216 4 - - - +/dev/rfcomm5 c 660 0 0 216 5 - - - +/dev/rfcomm6 c 660 0 0 216 6 - - - +/dev/rfcomm7 c 660 0 0 216 7 - - - +/dev/rfcomm8 c 660 0 0 216 8 - - - +/dev/rfcomm9 c 660 0 0 216 9 - - - +/dev/rfcomm10 c 660 0 0 216 10 - - - +/dev/rfcomm11 c 660 0 0 216 11 - - - +/dev/rfcomm12 c 660 0 0 216 12 - - - +/dev/rfcomm13 c 660 0 0 216 13 - - - +/dev/rfcomm14 c 660 0 0 216 14 - - - +/dev/rfcomm15 c 660 0 0 216 15 - - - +/dev/rmidi0 c 660 0 0 35 64 - - - +/dev/rmidi1 c 660 0 0 35 65 - - - +/dev/rmidi2 c 660 0 0 35 66 - - - +/dev/rmidi3 c 660 0 0 35 67 - - - +/dev/rtc c 660 0 47 10 135 - - - +/dev/scd0 b 660 0 6 11 0 - - - +/dev/scd1 b 660 0 6 11 1 - - - +/dev/sda b 660 0 6 8 0 - - - +/dev/sda1 b 660 0 6 8 1 - - - +/dev/sda2 b 660 0 6 8 2 - - - +/dev/sda3 b 660 0 6 8 3 - - - +/dev/sda4 b 660 0 6 8 4 - - - +/dev/sda5 b 660 0 6 8 5 - - - +/dev/sda6 b 660 0 6 8 6 - - - +/dev/sda7 b 660 0 6 8 7 - - - +/dev/sda8 b 660 0 6 8 8 - - - +/dev/sda9 b 660 0 6 8 9 - - - +/dev/sdb b 660 0 6 8 16 - - - +/dev/sdb1 b 660 0 6 8 17 - - - +/dev/sdb2 b 660 0 6 8 18 - - - +/dev/sdb3 b 660 0 6 8 19 - - - +/dev/sdb4 b 660 0 6 8 20 - - - +/dev/sdb5 b 660 0 6 8 21 - - - +/dev/sdb6 b 660 0 6 8 22 - - - +/dev/sdb7 b 660 0 6 8 23 - - - +/dev/sdb8 b 660 0 6 8 24 - - - +/dev/sdb9 b 660 0 6 8 25 - - - +/dev/sdc b 660 0 6 8 32 - - - +/dev/sdc1 b 660 0 6 8 33 - - - +/dev/sdc2 b 660 0 6 8 34 - - - +/dev/sdc3 b 660 0 6 8 35 - - - +/dev/sdc4 b 660 0 6 8 36 - - - +/dev/sdc5 b 660 0 6 8 37 - - - +/dev/sdc6 b 660 0 6 8 38 - - - +/dev/sdc7 b 660 0 6 8 39 - - - +/dev/sdc8 b 660 0 6 8 40 - - - +/dev/sdc9 b 660 0 6 8 41 - - - +/dev/sd_slotstat c 660 0 6 10 240 - - - +/dev/sharp_audioctl c 660 0 29 10 213 - - - +/dev/sharp_buz c 660 0 29 10 211 - - - +/dev/sharp_kbdctl c 660 0 45 10 214 - - - +/dev/sharp_led c 660 0 48 10 210 - - - +/dev/sharp_ts c 640 0 45 11 0 - - - +/dev/smtpe0 c 640 0 0 35 128 - - - +/dev/smtpe1 c 640 0 0 35 129 - - - +/dev/smtpe2 c 640 0 0 35 130 - - - +/dev/smtpe3 c 640 0 0 35 131 - - - +/dev/sndstat c 660 0 29 14 6 - - - +/dev/snd/seq c 660 0 0 116 1 - - - +/dev/snd/timer c 660 0 0 116 33 - - - +/dev/snd/controlC0 c 660 0 0 116 0 - - - +/dev/snd/controlC1 c 660 0 0 116 32 - - - +/dev/snd/controlC2 c 660 0 0 116 64 - - - +/dev/snd/controlC3 c 660 0 0 116 96 - - - +/dev/snd/hwC0D0 c 660 0 0 116 4 - - - +/dev/snd/hwC0D1 c 660 0 0 116 5 - - - +/dev/snd/hwC0D2 c 660 0 0 116 6 - - - +/dev/snd/hwC0D3 c 660 0 0 116 7 - - - +/dev/snd/pcmC0D0c c 660 0 0 116 24 - - - +/dev/snd/pcmC0D0p c 660 0 0 116 16 - - - +/dev/snd/pcmC0D1c c 660 0 0 116 25 - - - +/dev/snd/pcmC0D1p c 660 0 0 116 17 - - - +/dev/snd/pcmC0D2c c 660 0 0 116 26 - - - +/dev/snd/pcmC0D2p c 660 0 0 116 18 - - - +/dev/snd/pcmC0D3c c 660 0 0 116 27 - - - +/dev/snd/pcmC0D3p c 660 0 0 116 19 - - - +/dev/st0 c 660 0 11 9 0 - - - +/dev/st0a c 660 0 11 9 96 - - - +/dev/st0l c 660 0 11 9 32 - - - +/dev/st0m c 660 0 11 9 64 - - - +/dev/st1 c 660 0 11 9 1 - - - +/dev/st1a c 660 0 11 9 97 - - - +/dev/st1l c 660 0 11 9 33 - - - +/dev/st1m c 660 0 11 9 65 - - - +/dev/tty c 664 0 5 5 0 - - - +/dev/tty c 666 0 5 4 0 0 1 9 +/dev/ttyS c 640 0 5 4 64 0 1 4 +/dev/ttySA c 640 0 5 204 5 0 1 4 +/dev/ttyUSB c 660 0 5 188 0 0 1 2 +/dev/urandom c 644 0 0 1 9 - - - +/dev/usbmouse c 640 0 45 10 32 - - - +/dev/zero c 644 0 0 1 5 - - - +/dev/input/mice c 660 0 0 13 63 - - - diff --git a/recipes/initscripts/initscripts-1.0/devices b/recipes/initscripts/initscripts-1.0/devices new file mode 100755 index 0000000000..67a2ec8092 --- /dev/null +++ b/recipes/initscripts/initscripts-1.0/devices @@ -0,0 +1,67 @@ +#!/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 + ln -s /dev/touchscreen/0 /dev/ts + ln -s /dev/touchscreen/0raw /dev/tsraw + ln -s /dev/vc/0 /dev/tty0 + ln -s /dev/vc/1 /dev/tty1 + ln -s /dev/vc/2 /dev/tty2 + ln -s /dev/vc/3 /dev/tty3 + ln -s /dev/vc/4 /dev/tty4 + ln -s /dev/vc/5 /dev/tty5 + ln -s /dev/fb/0 /dev/fb0 +# ln -s /dev/tts/0 /dev/ttySA0 +# ln -s /dev/tts/1 /dev/ttySA1 +# ln -s /dev/tts/2 /dev/ttySA2 + + ln -s /dev/sound/dsp /dev/dsp + ln -s /dev/sound/mixer /dev/mixer + + ln -s /dev/v4l/video0 /dev/video0 + ln -s /dev/v4l/video0 /dev/video + ln -s /dev/misc/rtc /dev/rtc + + ## need this so that ppp will autoload the ppp modules + mknod /dev/ppp c 108 0 + 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 + 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/recipes/initscripts/initscripts-1.0/devpts.sh b/recipes/initscripts/initscripts-1.0/devpts.sh new file mode 100755 index 0000000000..334cf63801 --- /dev/null +++ b/recipes/initscripts/initscripts-1.0/devpts.sh @@ -0,0 +1,28 @@ +#! /bin/sh + +. /etc/default/devpts + +test "`uname -s`" = "Linux" || exit 0 + +# +# First find out if devpts is available. Also check if devfs +# is already mounted - in that case we don't want to use devpts. +# +if test ! -e /dev/.devfsd && ( grep -q devpts /proc/filesystems ) +then + # + # Create multiplexor device. + # + test -c /dev/ptmx || mknod -m 666 /dev/ptmx c 5 2 + + # + # Mount /dev/pts if needed. + # + if ( ! grep -q devpts /proc/mounts ) + then + mkdir -p /dev/pts + mount -t devpts devpts /dev/pts -ogid=${TTYGRP},mode=${TTYMODE} + fi +fi + +exit 0 diff --git a/recipes/initscripts/initscripts-1.0/foonas/checkroot b/recipes/initscripts/initscripts-1.0/foonas/checkroot new file mode 100755 index 0000000000..c69a773482 --- /dev/null +++ b/recipes/initscripts/initscripts-1.0/foonas/checkroot @@ -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/recipes/initscripts/initscripts-1.0/foonas/devices b/recipes/initscripts/initscripts-1.0/foonas/devices new file mode 100755 index 0000000000..f83ea63598 --- /dev/null +++ b/recipes/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/recipes/initscripts/initscripts-1.0/foonas/domainname.sh b/recipes/initscripts/initscripts-1.0/foonas/domainname.sh new file mode 100644 index 0000000000..55cb5dcfba --- /dev/null +++ b/recipes/initscripts/initscripts-1.0/foonas/domainname.sh @@ -0,0 +1,6 @@ +#!/bin/sh +# +# domainname.sh Set the domainname. +# +test -r /etc/defaultdomain && + cat /etc/defaultdomain >/proc/sys/kernel/domainname diff --git a/recipes/initscripts/initscripts-1.0/foonas/halt b/recipes/initscripts/initscripts-1.0/foonas/halt new file mode 100755 index 0000000000..f22d892d46 --- /dev/null +++ b/recipes/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/recipes/initscripts/initscripts-1.0/foonas/reboot b/recipes/initscripts/initscripts-1.0/foonas/reboot new file mode 100755 index 0000000000..05a82be4c0 --- /dev/null +++ b/recipes/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/recipes/initscripts/initscripts-1.0/gumstix-connex/alignment.sh b/recipes/initscripts/initscripts-1.0/gumstix-connex/alignment.sh new file mode 100644 index 0000000000..3826457609 --- /dev/null +++ b/recipes/initscripts/initscripts-1.0/gumstix-connex/alignment.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +if [ -e /proc/cpu/alignment ]; then + echo "2" > /proc/cpu/alignment +fi + diff --git a/recipes/initscripts/initscripts-1.0/gumstix-verdex/alignment.sh b/recipes/initscripts/initscripts-1.0/gumstix-verdex/alignment.sh new file mode 100644 index 0000000000..3826457609 --- /dev/null +++ b/recipes/initscripts/initscripts-1.0/gumstix-verdex/alignment.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +if [ -e /proc/cpu/alignment ]; then + echo "2" > /proc/cpu/alignment +fi + diff --git a/recipes/initscripts/initscripts-1.0/h3600/devices b/recipes/initscripts/initscripts-1.0/h3600/devices new file mode 100755 index 0000000000..0e59229225 --- /dev/null +++ b/recipes/initscripts/initscripts-1.0/h3600/devices @@ -0,0 +1,37 @@ +#!/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. + +# exit without doing anything if udev is active +if test -e /dev/.udevdb; then + exit 0 +fi + + test -n "$VERBOSE" && echo -n "Setting up device links for devfs: " + ( + ln -s /dev/vc/0 /dev/tty0 + ln -s /dev/vc/1 /dev/tty1 + ln -s /dev/vc/2 /dev/tty2 + ln -s /dev/vc/3 /dev/tty3 + ln -s /dev/vc/4 /dev/tty4 + ln -s /dev/vc/5 /dev/tty5 + ln -s /dev/fb/0 /dev/fb0 + # ln -s /dev/tts/0 /dev/ttySA0 + # ln -s /dev/tts/1 /dev/ttySA1 + # ln -s /dev/tts/2 /dev/ttySA2 + + ln -s /dev/sound/dsp /dev/dsp + ln -s /dev/sound/mixer /dev/mixer + + ln -s /dev/v4l/video0 /dev/video0 + ln -s /dev/v4l/video0 /dev/video + ln -s /dev/misc/rtc /dev/rtc + ln -s /dev/misc/apm_bios /dev/apm_bios + + ## need this so that ppp will autoload the ppp modules + mknod /dev/ppp c 108 0 + ) > /dev/null 2>&1 + + + test -n "$VERBOSE" && echo "done" diff --git a/recipes/initscripts/initscripts-1.0/h3900/devices b/recipes/initscripts/initscripts-1.0/h3900/devices new file mode 100755 index 0000000000..0e59229225 --- /dev/null +++ b/recipes/initscripts/initscripts-1.0/h3900/devices @@ -0,0 +1,37 @@ +#!/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. + +# exit without doing anything if udev is active +if test -e /dev/.udevdb; then + exit 0 +fi + + test -n "$VERBOSE" && echo -n "Setting up device links for devfs: " + ( + ln -s /dev/vc/0 /dev/tty0 + ln -s /dev/vc/1 /dev/tty1 + ln -s /dev/vc/2 /dev/tty2 + ln -s /dev/vc/3 /dev/tty3 + ln -s /dev/vc/4 /dev/tty4 + ln -s /dev/vc/5 /dev/tty5 + ln -s /dev/fb/0 /dev/fb0 + # ln -s /dev/tts/0 /dev/ttySA0 + # ln -s /dev/tts/1 /dev/ttySA1 + # ln -s /dev/tts/2 /dev/ttySA2 + + ln -s /dev/sound/dsp /dev/dsp + ln -s /dev/sound/mixer /dev/mixer + + ln -s /dev/v4l/video0 /dev/video0 + ln -s /dev/v4l/video0 /dev/video + ln -s /dev/misc/rtc /dev/rtc + ln -s /dev/misc/apm_bios /dev/apm_bios + + ## need this so that ppp will autoload the ppp modules + mknod /dev/ppp c 108 0 + ) > /dev/null 2>&1 + + + test -n "$VERBOSE" && echo "done" diff --git a/recipes/initscripts/initscripts-1.0/jornada56x/devices b/recipes/initscripts/initscripts-1.0/jornada56x/devices new file mode 100755 index 0000000000..0e59229225 --- /dev/null +++ b/recipes/initscripts/initscripts-1.0/jornada56x/devices @@ -0,0 +1,37 @@ +#!/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. + +# exit without doing anything if udev is active +if test -e /dev/.udevdb; then + exit 0 +fi + + test -n "$VERBOSE" && echo -n "Setting up device links for devfs: " + ( + ln -s /dev/vc/0 /dev/tty0 + ln -s /dev/vc/1 /dev/tty1 + ln -s /dev/vc/2 /dev/tty2 + ln -s /dev/vc/3 /dev/tty3 + ln -s /dev/vc/4 /dev/tty4 + ln -s /dev/vc/5 /dev/tty5 + ln -s /dev/fb/0 /dev/fb0 + # ln -s /dev/tts/0 /dev/ttySA0 + # ln -s /dev/tts/1 /dev/ttySA1 + # ln -s /dev/tts/2 /dev/ttySA2 + + ln -s /dev/sound/dsp /dev/dsp + ln -s /dev/sound/mixer /dev/mixer + + ln -s /dev/v4l/video0 /dev/video0 + ln -s /dev/v4l/video0 /dev/video + ln -s /dev/misc/rtc /dev/rtc + ln -s /dev/misc/apm_bios /dev/apm_bios + + ## need this so that ppp will autoload the ppp modules + mknod /dev/ppp c 108 0 + ) > /dev/null 2>&1 + + + test -n "$VERBOSE" && echo "done" diff --git a/recipes/initscripts/initscripts-1.0/jornada6xx/checkroot b/recipes/initscripts/initscripts-1.0/jornada6xx/checkroot new file mode 100755 index 0000000000..9e2d3cfc85 --- /dev/null +++ b/recipes/initscripts/initscripts-1.0/jornada6xx/checkroot @@ -0,0 +1,211 @@ +# +# 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 + 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 + + # 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. 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 rootfs /proc/mounts | awk '{print $4}') = rw ]; then + exit 0 +fi + +# Add a second check, which seems to be needed for some kernel versions +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/recipes/initscripts/initscripts-1.0/jornada6xx/devices b/recipes/initscripts/initscripts-1.0/jornada6xx/devices new file mode 100644 index 0000000000..5ca2a1ccef --- /dev/null +++ b/recipes/initscripts/initscripts-1.0/jornada6xx/devices @@ -0,0 +1,71 @@ +#!/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/.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 + ln -s /dev/touchscreen/0 /dev/ts + ln -s /dev/touchscreen/0raw /dev/tsraw + ln -s /dev/vc/0 /dev/tty0 + ln -s /dev/vc/1 /dev/tty1 + ln -s /dev/vc/2 /dev/tty2 + ln -s /dev/vc/3 /dev/tty3 + ln -s /dev/vc/4 /dev/tty4 + ln -s /dev/vc/5 /dev/tty5 + ln -s /dev/fb/0 /dev/fb0 + + ln -s /dev/sound/dsp /dev/dsp + ln -s /dev/sound/mixer /dev/mixer + + ln -s /dev/v4l/video0 /dev/video0 + ln -s /dev/v4l/video0 /dev/video + ln -s /dev/misc/rtc /dev/rtc + + ## need this so that ppp will autoload the ppp modules + mknod /dev/ppp c 108 0 + + 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 + mknod /dev/input/ts0 c 13 128 + mknod /dev/ttySC0 c 8 204 + mknod /dev/ttySC1 c 9 204 + mknod /dev/ttySC2 c 10 204 + + mknod /dev/irda0 c 10 204 + + mkdir -p dev/msys + mkdir -p dev/pts + mkdir -p dev/vc + 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/recipes/initscripts/initscripts-1.0/jornada7xx/checkroot b/recipes/initscripts/initscripts-1.0/jornada7xx/checkroot new file mode 100755 index 0000000000..9e2d3cfc85 --- /dev/null +++ b/recipes/initscripts/initscripts-1.0/jornada7xx/checkroot @@ -0,0 +1,211 @@ +# +# 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 + 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 + + # 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. 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 rootfs /proc/mounts | awk '{print $4}') = rw ]; then + exit 0 +fi + +# Add a second check, which seems to be needed for some kernel versions +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/recipes/initscripts/initscripts-1.0/jornada7xx/devices b/recipes/initscripts/initscripts-1.0/jornada7xx/devices new file mode 100755 index 0000000000..422336a345 --- /dev/null +++ b/recipes/initscripts/initscripts-1.0/jornada7xx/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/.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 + ln -s /dev/touchscreen/0 /dev/ts + ln -s /dev/touchscreen/0raw /dev/tsraw + ln -s /dev/vc/0 /dev/tty0 + ln -s /dev/vc/1 /dev/tty1 + ln -s /dev/vc/2 /dev/tty2 + ln -s /dev/vc/3 /dev/tty3 + ln -s /dev/vc/4 /dev/tty4 + ln -s /dev/vc/5 /dev/tty5 + ln -s /dev/fb/0 /dev/fb0 +# ln -s /dev/tts/0 /dev/ttySA0 +# ln -s /dev/tts/1 /dev/ttySA1 +# ln -s /dev/tts/2 /dev/ttySA2 + + ln -s /dev/sound/dsp /dev/dsp + ln -s /dev/sound/mixer /dev/mixer + + ln -s /dev/v4l/video0 /dev/video0 + ln -s /dev/v4l/video0 /dev/video + ln -s /dev/misc/rtc /dev/rtc + + ## need this so that ppp will autoload the ppp modules + mknod /dev/ppp c 108 0 + + 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 + mknod /dev/input/ts0 c 13 65 + mknod /dev/ttySC1 c 9 204 + mknod /dev/irda0 c 10 204 + mkdir -p dev/msys + mkdir -p dev/pts + mkdir -p dev/vc + 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/recipes/initscripts/initscripts-1.0/logicpd-pxa270/checkroot b/recipes/initscripts/initscripts-1.0/logicpd-pxa270/checkroot new file mode 100644 index 0000000000..2a4d2a67a9 --- /dev/null +++ b/recipes/initscripts/initscripts-1.0/logicpd-pxa270/checkroot @@ -0,0 +1,179 @@ +# +# 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 +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" + test "$mnt" != / && continue + rootopts="$opts" + test "$pass" = 0 -o "$pass" = "" && rootcheck=no + case "$opts" in + ro|ro,*|*,ro|*,ro,*) + rootmode=ro + ;; + esac +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/recipes/initscripts/initscripts-1.0/mountall.sh b/recipes/initscripts/initscripts-1.0/mountall.sh new file mode 100755 index 0000000000..53bff0fbce --- /dev/null +++ b/recipes/initscripts/initscripts-1.0/mountall.sh @@ -0,0 +1,60 @@ +# +# mountall.sh Mount all filesystems. +# +# 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 +# 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 $MOUNTALL 2>&1 | logger -s -p user.err + +# +# 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 + +# 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/recipes/initscripts/initscripts-1.0/mountnfs.sh b/recipes/initscripts/initscripts-1.0/mountnfs.sh new file mode 100755 index 0000000000..84cb3651fc --- /dev/null +++ b/recipes/initscripts/initscripts-1.0/mountnfs.sh @@ -0,0 +1,87 @@ +# +# mountnfs.sh Now that TCP/IP is configured, mount the NFS file +# systems in /etc/fstab if needed. If possible, +# start the portmapper before mounting (this is needed for +# Linux 2.1.x and up). +# +# Also mounts SBM filesystems now, so the name of +# this script is getting increasingly inaccurate. +# +# Version: @(#)mountnfs.sh 2.83 05-Oct-2001 miquels@cistron.nl +# + +. /etc/default/rcS + +# +# Run in a subshell because of I/O redirection. +# +test -f /etc/fstab && ( + +# +# Read through fstab line by line. If it is NFS, set the flag +# for mounting NFS filesystems. If any NFS partition is found and it +# not mounted with the nolock option, we start the portmapper. +# +portmap=no +mount_nfs=no +mount_smb=no +mount_ncp=no +while read device mountpt fstype options +do + case "$device" in + ""|\#*) + continue + ;; + esac + + case "$options" in + *noauto*) + continue + ;; + esac + + if test "$fstype" = nfs + then + mount_nfs=yes + case "$options" in + *nolock*) + ;; + *) + portmap=yes + ;; + esac + fi + if test "$fstype" = smbfs + then + mount_smb=yes + fi + if test "$fstype" = ncpfs + then + mount_ncp=yes + fi +done + +exec 0>&1 + +if test "$portmap" = yes +then + if test -x /sbin/portmap + then + echo -n "Starting portmapper... " + start-stop-daemon --start --quiet --exec /sbin/portmap + sleep 2 + fi +fi + +if test "$mount_nfs" = yes || test "$mount_smb" = yes || test "$mount_ncp" = yes +then + echo "Mounting remote filesystems..." + test "$mount_nfs" = yes && mount -a -t nfs + test "$mount_smb" = yes && mount -a -t smbfs + test "$mount_ncp" = yes && mount -a -t ncpfs +fi + +) < /etc/fstab + +: exit 0 + diff --git a/recipes/initscripts/initscripts-1.0/mtx-1/checkroot b/recipes/initscripts/initscripts-1.0/mtx-1/checkroot new file mode 100755 index 0000000000..e8ae039650 --- /dev/null +++ b/recipes/initscripts/initscripts-1.0/mtx-1/checkroot @@ -0,0 +1,167 @@ +# +# 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 +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" + test "$mnt" != / && continue + rootopts="$opts" + test "$pass" = 0 -o "$pass" = "" && rootcheck=no + case "$opts" in + ro|ro,*|*,ro|*,ro,*) + rootmode=ro + ;; + esac +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. +# +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/recipes/initscripts/initscripts-1.0/mtx-1/mountall.sh b/recipes/initscripts/initscripts-1.0/mtx-1/mountall.sh new file mode 100755 index 0000000000..6ce2863dd9 --- /dev/null +++ b/recipes/initscripts/initscripts-1.0/mtx-1/mountall.sh @@ -0,0 +1,47 @@ +#!/bin/sh +# +# 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 +#t nonfs,nosmbfs,noncpfs 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/recipes/initscripts/initscripts-1.0/mtx-2/checkroot b/recipes/initscripts/initscripts-1.0/mtx-2/checkroot new file mode 100755 index 0000000000..e8ae039650 --- /dev/null +++ b/recipes/initscripts/initscripts-1.0/mtx-2/checkroot @@ -0,0 +1,167 @@ +# +# 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 +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" + test "$mnt" != / && continue + rootopts="$opts" + test "$pass" = 0 -o "$pass" = "" && rootcheck=no + case "$opts" in + ro|ro,*|*,ro|*,ro,*) + rootmode=ro + ;; + esac +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. +# +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/recipes/initscripts/initscripts-1.0/mtx-2/mountall.sh b/recipes/initscripts/initscripts-1.0/mtx-2/mountall.sh new file mode 100755 index 0000000000..6ce2863dd9 --- /dev/null +++ b/recipes/initscripts/initscripts-1.0/mtx-2/mountall.sh @@ -0,0 +1,47 @@ +#!/bin/sh +# +# 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 +#t nonfs,nosmbfs,noncpfs 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/recipes/initscripts/initscripts-1.0/openmn/extractfs b/recipes/initscripts/initscripts-1.0/openmn/extractfs new file mode 100755 index 0000000000..7e57dedd2d --- /dev/null +++ b/recipes/initscripts/initscripts-1.0/openmn/extractfs @@ -0,0 +1,7 @@ +#!/bin/sh + +if (grep -q 'tmpfs.*/var.*tmpfs' /proc/mounts) +then + test "$VERBOSE" != no && echo "Copying /var filesystem..." + cp -a /boot/var / +fi diff --git a/recipes/initscripts/initscripts-1.0/openmn/packages b/recipes/initscripts/initscripts-1.0/openmn/packages new file mode 100755 index 0000000000..2566487d2d --- /dev/null +++ b/recipes/initscripts/initscripts-1.0/openmn/packages @@ -0,0 +1,63 @@ +#!/bin/sh +# Original author: ??? +# +# Additions by Steph Meslin-Weber: +# x Percentage display +# x Dot display of dependency installations +# - removed both of above +# - display is now X of Y packages and current package name being installed + +#. /etc/default/rcS + +reconfigure () { + pkg=$1 + path=$2 + isdependent=$3 + test -e "$path/info/$pkg.control" || return 1 + depends="`cat $path/info/$pkg.control|grep Depends|cut -d: -f2`" + + # make sure we haven't already installed this package + isthere=`cat /tmp/.configured.list|grep $pkg` + if test "$isthere" != ""; then + return 1 + fi + + if test "$depends" != ""; then + for dep in $depends; do + (echo $log|grep $dep >/dev/null 2>&1) || ( reconfigure $dep $path "$max" "$pkg" && log="$log $dep"; ) + done + fi + + echo -ne " ${pkg}" + + test -e "$path/info/$pkg.prerm" && $path/info/$pkg.prerm unconfigure >/dev/null 2>&1 + test -e "$path/info/$pkg.postinst" && $path/info/$pkg.postinst configure >/dev/null 2>&1 + + log="$log $pkg" + + # append the installed package name to the list + echo -ne "$pkg\n" >> /tmp/.configured.list + + echo + return 0 +} + +if test ! -e /etc/.configured; then + echo "Reconfiguring all packages installed to root:" + + # create unique packages list file + rm -f /tmp/.configured.list + touch /tmp/.configured.list + + log="" + + for control in /usr/lib/ipkg/info/*.control; do + package=`echo $control|sed -e 's,.*/,,g; s,\.control,,g;'` + (echo $log|grep $package >/dev/null 2>&1) || reconfigure $package /usr/lib/ipkg + done + + # cleanup unique packages list file + rm -f /tmp/.configured.list +fi + +test -f /usr/lib/ipkg/info/task-ramses || ipkg install task-ramses diff --git a/recipes/initscripts/initscripts-1.0/openmn/umountfs b/recipes/initscripts/initscripts-1.0/openmn/umountfs new file mode 100755 index 0000000000..399194109b --- /dev/null +++ b/recipes/initscripts/initscripts-1.0/openmn/umountfs @@ -0,0 +1,17 @@ +#! /bin/sh +# +# umountfs Turn off swap and unmount all local filesystems. +# + +PATH=/sbin:/bin:/usr/sbin:/usr/bin + +echo "Deactivating swap..." +swapoff -a + +# We leave /proc mounted. +echo "Unmounting local filesystems..." +umount -f -a -r + +mount -o remount,ro / + +: exit 0 diff --git a/recipes/initscripts/initscripts-1.0/openprotium/checkroot b/recipes/initscripts/initscripts-1.0/openprotium/checkroot new file mode 100755 index 0000000000..6b63b07188 --- /dev/null +++ b/recipes/initscripts/initscripts-1.0/openprotium/checkroot @@ -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 / + grep -q '^proc /proc' /etc/mtab || mount -f /proc + test "$devfs" && grep -q '^devfs /dev' /proc/mounts && mount -f "$devfs" +fi + +: exit 0 diff --git a/recipes/initscripts/initscripts-1.0/openprotium/devfs.sh b/recipes/initscripts/initscripts-1.0/openprotium/devfs.sh new file mode 100644 index 0000000000..5765ca648c --- /dev/null +++ b/recipes/initscripts/initscripts-1.0/openprotium/devfs.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +mount -t devfs none /dev + + diff --git a/recipes/initscripts/initscripts-1.0/openprotium/devices b/recipes/initscripts/initscripts-1.0/openprotium/devices new file mode 100755 index 0000000000..f83ea63598 --- /dev/null +++ b/recipes/initscripts/initscripts-1.0/openprotium/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/recipes/initscripts/initscripts-1.0/openprotium/domainname.sh b/recipes/initscripts/initscripts-1.0/openprotium/domainname.sh new file mode 100644 index 0000000000..55cb5dcfba --- /dev/null +++ b/recipes/initscripts/initscripts-1.0/openprotium/domainname.sh @@ -0,0 +1,6 @@ +#!/bin/sh +# +# domainname.sh Set the domainname. +# +test -r /etc/defaultdomain && + cat /etc/defaultdomain >/proc/sys/kernel/domainname diff --git a/recipes/initscripts/initscripts-1.0/openprotium/flashclean b/recipes/initscripts/initscripts-1.0/openprotium/flashclean new file mode 100755 index 0000000000..d9a0e1b592 --- /dev/null +++ b/recipes/initscripts/initscripts-1.0/openprotium/flashclean @@ -0,0 +1,60 @@ +#! /bin/sh +# +# This is an init script for openprotium for storcenter +# +# This script cleansup after a successful uboot based reflash. +# A uboot reflash is done by changing the bootloader boot command +# to tftp a flash image and flash the firmware. However the boot command +# is never reset back to a regular boot. This way if the flash did +# not work the next power cycle will cause another reflash. A nice +# development recovery feature. So this boot script is the mechanism +# to reset the uboot boot command. Once booted and access it validated +# this script will issue command to reset the boot command. +# +# This command only has a start so stop is not necessary and should +# as late in the boot process as possible to ensure a successful reboot +# +# Copy it to /etc/init.d/flashclean and type +# update-rc.d flashclean start 99 5 +# +BOOTCMD="bootm FF800000" + +dmesg | grep StorCenter >/dev/null 2>&1 +if [ $? -ne 0 ]; then + exit 0 +fi + +printenv=/sbin/fw_printenv +setenv=/sbin/fw_setenv +test -x "$printenv" -a -x "$setenv" || exit 0 + +case "$1" in + start) + # Check to see if any work needs to be done + # Need to quote the right hand side, hence the ugly awk. + eval `$printenv bootcmd | awk -F= '{printf("%s=\"%s\"", $1, $2)}'` + if [ "$bootcmd" = "$BOOTCMD" ]; then + exit 0 + fi + + echo -n "Restoring u-Boot bootcmd" + $setenv bootcmd $BOOTCMD > /dev/null 2>&1 + eval `$printenv bootcmd | awk -F= '{printf("%s=\"%s\"", $1, $2)}'` + if [ "$bootcmd" != "$BOOTCMD" ]; then + echo " FAILED." + exit 1 + fi + echo "." + ;; + stop) + ;; + reload|force-reload) + ;; + restart) + ;; + *) + echo "Usage: /etc/init.d/flashclean {start|stop|reload|restart|force-reload}" + exit 1 +esac + +exit 0 diff --git a/recipes/initscripts/initscripts-1.0/openprotium/halt b/recipes/initscripts/initscripts-1.0/openprotium/halt new file mode 100755 index 0000000000..f22d892d46 --- /dev/null +++ b/recipes/initscripts/initscripts-1.0/openprotium/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/recipes/initscripts/initscripts-1.0/openprotium/mountall.sh b/recipes/initscripts/initscripts-1.0/openprotium/mountall.sh new file mode 100644 index 0000000000..b5ccf9e621 --- /dev/null +++ b/recipes/initscripts/initscripts-1.0/openprotium/mountall.sh @@ -0,0 +1,28 @@ +#!/bin/sh +# +# 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 -at nonfs,nosmbfs,noncpfs 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 + +: exit 0 + diff --git a/recipes/initscripts/initscripts-1.0/openprotium/reboot b/recipes/initscripts/initscripts-1.0/openprotium/reboot new file mode 100755 index 0000000000..05a82be4c0 --- /dev/null +++ b/recipes/initscripts/initscripts-1.0/openprotium/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/recipes/initscripts/initscripts-1.0/openprotium/umountfs b/recipes/initscripts/initscripts-1.0/openprotium/umountfs new file mode 100755 index 0000000000..e489c4c1cd --- /dev/null +++ b/recipes/initscripts/initscripts-1.0/openprotium/umountfs @@ -0,0 +1,27 @@ +#! /bin/sh +# +# umountfs Turn off swap and unmount all local filesystems. +# + +PATH=/sbin:/bin:/usr/sbin:/usr/bin + +echo "Deactivating swap..." +swapoff -a + +# We leave /proc mounted. +echo "Unmounting local filesystems..." +# umount anything not a pseudo file system, and not root +# doesn't work for nested mounts at a non-root mount point +while read device mountpt fstype options +do + echo "$device" | grep -q "^/" + if [ $? -eq 0 ]; then + if [ "$mountpt" != "/" ] && [ "$mountpt" != "/dev/" ]; then + umount $mountpt + fi + fi +done</proc/mounts + +mount -o remount,ro / + +: exit 0 diff --git a/recipes/initscripts/initscripts-1.0/openprotium/umountinitrd.sh b/recipes/initscripts/initscripts-1.0/openprotium/umountinitrd.sh new file mode 100644 index 0000000000..12cf7c604c --- /dev/null +++ b/recipes/initscripts/initscripts-1.0/openprotium/umountinitrd.sh @@ -0,0 +1,11 @@ +#!/bin/sh +# umount the static dev - we'd probably never use it. +# +[ -d /dev/.static/dev ] && umount /dev/.static/dev +# +# if a root is found on an ext* filesystem, umount the old initrd +# +grep -q "/ ext" /proc/mounts +if [ $? -eq 0 ]; then + umount /initrd +fi diff --git a/recipes/initscripts/initscripts-1.0/oplinux-uclibc/checkroot b/recipes/initscripts/initscripts-1.0/oplinux-uclibc/checkroot new file mode 100755 index 0000000000..e5fc6ed8b5 --- /dev/null +++ b/recipes/initscripts/initscripts-1.0/oplinux-uclibc/checkroot @@ -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/recipes/initscripts/initscripts-1.0/oplinux-uclibc/mountall.sh b/recipes/initscripts/initscripts-1.0/oplinux-uclibc/mountall.sh new file mode 100755 index 0000000000..1418a4d0cf --- /dev/null +++ b/recipes/initscripts/initscripts-1.0/oplinux-uclibc/mountall.sh @@ -0,0 +1,46 @@ +#!/bin/sh +# +# 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/recipes/initscripts/initscripts-1.0/oplinux/checkroot b/recipes/initscripts/initscripts-1.0/oplinux/checkroot new file mode 100755 index 0000000000..e5fc6ed8b5 --- /dev/null +++ b/recipes/initscripts/initscripts-1.0/oplinux/checkroot @@ -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/recipes/initscripts/initscripts-1.0/poodle/devices b/recipes/initscripts/initscripts-1.0/poodle/devices new file mode 100755 index 0000000000..9d1624428a --- /dev/null +++ b/recipes/initscripts/initscripts-1.0/poodle/devices @@ -0,0 +1,67 @@ +#!/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/.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 + ln -s /dev/touchscreen/0 /dev/ts + ln -s /dev/touchscreen/0raw /dev/tsraw + ln -s /dev/vc/0 /dev/tty0 + ln -s /dev/vc/1 /dev/tty1 + ln -s /dev/vc/2 /dev/tty2 + ln -s /dev/vc/3 /dev/tty3 + ln -s /dev/vc/4 /dev/tty4 + ln -s /dev/vc/5 /dev/tty5 + ln -s /dev/fb/0 /dev/fb0 +# ln -s /dev/tts/0 /dev/ttySA0 +# ln -s /dev/tts/1 /dev/ttySA1 +# ln -s /dev/tts/2 /dev/ttySA2 + + ln -s /dev/sound/dsp /dev/dsp + ln -s /dev/sound/mixer /dev/mixer + + ln -s /dev/v4l/video0 /dev/video0 + ln -s /dev/v4l/video0 /dev/video + ln -s /dev/misc/rtc /dev/rtc + + ## need this so that ppp will autoload the ppp modules + mknod /dev/ppp c 108 0 + 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/msys + mkdir -p dev/pts + mkdir -p dev/vc + 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 /dev/sharp_ts /dev/ts + ln -sf /dev/sharp_fl /dev/fl + 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/recipes/initscripts/initscripts-1.0/populate-volatile.sh b/recipes/initscripts/initscripts-1.0/populate-volatile.sh new file mode 100755 index 0000000000..3bb3d94de6 --- /dev/null +++ b/recipes/initscripts/initscripts-1.0/populate-volatile.sh @@ -0,0 +1,171 @@ +#!/bin/sh + +. /etc/default/rcS + +CFGDIR="/etc/default/volatiles" +TMPROOT="/var/tmp" +COREDEF="00_core" + +[ "${VERBOSE}" != "no" ] && echo "Populating volatile Filesystems." + +create_file() { + EXEC=" + touch \"$1\"; + chown ${TUSER}.${TGROUP} $1 || echo \"Failed to set owner -${TUSER}- for -$1-.\" >/dev/tty0 2>&1; + chmod ${TMODE} $1 || echo \"Failed to set mode -${TMODE}- for -$1-.\" >/dev/tty0 2>&1 " + + test "$VOLATILE_ENABLE_CACHE" = yes && echo "$EXEC" >> /etc/volatile.cache + + [ -e "$1" ] && { + [ "${VERBOSE}" != "no" ] && echo "Target already exists. Skipping." + } || { + eval $EXEC & + } +} + +mk_dir() { + EXEC=" + mkdir -p \"$1\"; + chown ${TUSER}.${TGROUP} $1 || echo \"Failed to set owner -${TUSER}- for -$1-.\" >/dev/tty0 2>&1; + chmod ${TMODE} $1 || echo \"Failed to set mode -${TMODE}- for -$1-.\" >/dev/tty0 2>&1 " + + test "$VOLATILE_ENABLE_CACHE" = yes && echo "$EXEC" >> /etc/volatile.cache + + [ -e "$1" ] && { + [ "${VERBOSE}" != "no" ] && echo "Target already exists. Skipping." + } || { + eval $EXEC & + } +} + +link_file() { + EXEC="test -e \"$2\" -o -L $2 || ln -s \"$1\" \"$2\" >/dev/tty0 2>&1" + + test "$VOLATILE_ENABLE_CACHE" = yes && echo " $EXEC" >> /etc/volatile.cache + + [ -e "$2" ] && { + echo "Cannot create link over existing -${TNAME}-." >&2 + } || { + eval $EXEC & + } +} + +check_requirements() { + + cleanup() { + rm "${TMP_INTERMED}" + rm "${TMP_DEFINED}" + rm "${TMP_COMBINED}" + } + + CFGFILE="$1" + + [ `basename "${CFGFILE}"` = "${COREDEF}" ] && return 0 + + TMP_INTERMED="${TMPROOT}/tmp.$$" + TMP_DEFINED="${TMPROOT}/tmpdefined.$$" + TMP_COMBINED="${TMPROOT}/tmpcombined.$$" + + + cat /etc/passwd | sed 's@\(^:\)*:.*@\1@' | sort | uniq > "${TMP_DEFINED}" + cat ${CFGFILE} | grep -v "^#" | cut -d " " -f 2 > "${TMP_INTERMED}" + cat "${TMP_DEFINED}" "${TMP_INTERMED}" | sort | uniq > "${TMP_COMBINED}" + + NR_DEFINED_USERS="`cat "${TMP_DEFINED}" | wc -l`" + NR_COMBINED_USERS="`cat "${TMP_COMBINED}" | wc -l`" + + [ "${NR_DEFINED_USERS}" -ne "${NR_COMBINED_USERS}" ] && { + echo "Undefined users:" + diff "${TMP_DEFINED}" "${TMP_COMBINED}" | grep "^>" + cleanup + return 1 + } + + + cat /etc/group | sed 's@\(^:\)*:.*@\1@' | sort | uniq > "${TMP_DEFINED}" + cat ${CFGFILE} | grep -v "^#" | cut -d " " -f 3 > "${TMP_INTERMED}" + cat "${TMP_DEFINED}" "${TMP_INTERMED}" | sort | uniq > "${TMP_COMBINED}" + + NR_DEFINED_GROUPS="`cat "${TMP_DEFINED}" | wc -l`" + NR_COMBINED_GROUPS="`cat "${TMP_COMBINED}" | wc -l`" + + [ "${NR_DEFINED_GROUPS}" -ne "${NR_COMBINED_GROUPS}" ] && { + echo "Undefined groups:" + diff "${TMP_DEFINED}" "${TMP_COMBINED}" | grep "^>" + cleanup + return 1 + } + + # Add checks for required directories here + + cleanup + return 0 + } + +apply_cfgfile() { + + CFGFILE="$1" + + check_requirements "${CFGFILE}" || { + echo "Skipping ${CFGFILE}" + return 1 + } + + cat ${CFGFILE} | grep -v "^#" | \ + while read LINE; do + + eval `echo "$LINE" | sed -n "s/\(.*\)\ \(.*\) \(.*\)\ \(.*\)\ \(.*\)\ \(.*\)/TTYPE=\1 ; TUSER=\2; TGROUP=\3; TMODE=\4; TNAME=\5 TLTARGET=\6/p"` + + [ "${VERBOSE}" != "no" ] && echo "Checking for -${TNAME}-." + + + [ "${TTYPE}" = "l" ] && { + TSOURCE="$TLTARGET" + [ -L "${TNAME}" ] || { + [ "${VERBOSE}" != "no" ] && echo "Creating link -${TNAME}- pointing to -${TSOURCE}-." + link_file "${TSOURCE}" "${TNAME}" & + } + continue + } + + [ -L "${TNAME}" ] && { + [ "${VERBOSE}" != "no" ] && echo "Found link." + NEWNAME=`ls -l "${TNAME}" | sed -e 's/^.*-> \(.*\)$/\1/'` + echo ${NEWNAME} | grep -v "^/" >/dev/null && { + TNAME="`echo ${TNAME} | sed -e 's@\(.*\)/.*@\1@'`/${NEWNAME}" + [ "${VERBOSE}" != "no" ] && echo "Converted relative linktarget to absolute path -${TNAME}-." + } || { + TNAME="${NEWNAME}" + [ "${VERBOSE}" != "no" ] && echo "Using absolute link target -${TNAME}-." + } + } + + case "${TTYPE}" in + "f") [ "${VERBOSE}" != "no" ] && echo "Creating file -${TNAME}-." + create_file "${TNAME}" & + ;; + "d") [ "${VERBOSE}" != "no" ] && echo "Creating directory -${TNAME}-." + mk_dir "${TNAME}" & + # Add check to see if there's an entry in fstab to mount. + ;; + *) [ "${VERBOSE}" != "no" ] && echo "Invalid type -${TTYPE}-." + continue + ;; + esac + + + done + + return 0 + + } + +if test -e /etc/volatile.cache -a "$VOLATILE_ENABLE_CACHE" = "yes" -a "x$1" != "xupdate" +then + sh /etc/volatile.cache +else + rm -f /etc/volatile.cache + for file in `ls -1 "${CFGDIR}" | sort`; do + apply_cfgfile "${CFGDIR}/${file}" + done +fi diff --git a/recipes/initscripts/initscripts-1.0/ramdisk b/recipes/initscripts/initscripts-1.0/ramdisk new file mode 100755 index 0000000000..4dfe53cf61 --- /dev/null +++ b/recipes/initscripts/initscripts-1.0/ramdisk @@ -0,0 +1,49 @@ +#!/bin/sh + +. /etc/default/rcS + +FSTYPE=ext2 + +if test ! -e /proc/mtd +then + test "$VERBOSE" != "no" && echo >&2 "/proc not mounted, or mtd support not enabled in kernel." + exit +fi + +RAM_MTD_NO=`cat /proc/mtd | grep mtdram | tail -n 1 | cut -d: -f1 | cut -dd -f2` +if test -z "$RAM_MTD_NO"; then exit 0; fi + +if test -e /dev/mtdblock/0 +then + RAM_MTD=/dev/mtd/$RAM_MTD_NO + RAM_MTDBLK=/dev/mtdblock/$RAM_MTD_NO +else + RAM_MTD=/dev/mtd$RAM_MTD_NO + 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` +test -e /etc/ramdisk.conf && OLD_MTD_SIZE=`cat /etc/ramdisk.conf` +echo $RAM_MTD_SIZE > /etc/ramdisk.conf + +if test ! -d "$RAM_MNTPT"; then echo >&2 "Mountpoint $RAM_MNTPT does not exist!"; exit 0; fi + +if (test ! -e /etc/.configured) || test "$OLD_MTD_SIZE" != "$RAM_MTD_SIZE"; then + test "$VERBOSE" != "no" && echo -n "Wiping ramdisk: " + dd if=/dev/zero bs=1024 count=$RAM_MTD_SIZE of=$RAM_MTD 2>/dev/null >&2 || exit 1 + test "$VERBOSE" != "no" && echo "$RAM_MTD"; + test "$VERBOSE" != "no" && echo -n "Creating filesystem on ramdisk: " + mkfs.$FSTYPE $RAM_MTDBLK 2>/dev/null >&2 || exit 1 + test "$VERBOSE" != "no" && echo "$RAM_MTDBLK"; +fi + +test "$VERBOSE" != "no" && echo -n "Mounting ramdisk: " +mount -t $FSTYPE $RAM_MTDBLK $RAM_MNTPT 2>/dev/null >&2 || exit 1 +test "$VERBOSE" != "no" && echo "$RAM_MTDBLK"; + +exit 0 diff --git a/recipes/initscripts/initscripts-1.0/simpad/devices b/recipes/initscripts/initscripts-1.0/simpad/devices new file mode 100644 index 0000000000..0e59229225 --- /dev/null +++ b/recipes/initscripts/initscripts-1.0/simpad/devices @@ -0,0 +1,37 @@ +#!/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. + +# exit without doing anything if udev is active +if test -e /dev/.udevdb; then + exit 0 +fi + + test -n "$VERBOSE" && echo -n "Setting up device links for devfs: " + ( + ln -s /dev/vc/0 /dev/tty0 + ln -s /dev/vc/1 /dev/tty1 + ln -s /dev/vc/2 /dev/tty2 + ln -s /dev/vc/3 /dev/tty3 + ln -s /dev/vc/4 /dev/tty4 + ln -s /dev/vc/5 /dev/tty5 + ln -s /dev/fb/0 /dev/fb0 + # ln -s /dev/tts/0 /dev/ttySA0 + # ln -s /dev/tts/1 /dev/ttySA1 + # ln -s /dev/tts/2 /dev/ttySA2 + + ln -s /dev/sound/dsp /dev/dsp + ln -s /dev/sound/mixer /dev/mixer + + ln -s /dev/v4l/video0 /dev/video0 + ln -s /dev/v4l/video0 /dev/video + ln -s /dev/misc/rtc /dev/rtc + ln -s /dev/misc/apm_bios /dev/apm_bios + + ## need this so that ppp will autoload the ppp modules + mknod /dev/ppp c 108 0 + ) > /dev/null 2>&1 + + + test -n "$VERBOSE" && echo "done" diff --git a/recipes/initscripts/initscripts-1.0/single b/recipes/initscripts/initscripts-1.0/single new file mode 100755 index 0000000000..2d177ebb62 --- /dev/null +++ b/recipes/initscripts/initscripts-1.0/single @@ -0,0 +1,21 @@ +#! /bin/sh +# +# single executed by init(8) upon entering runlevel 1 (single). +# +# Version: @(#)single 1.20 26-Geb-2001 miquels@cistron.nl +# + +PATH="/sbin:/bin:/usr/sbin:/usr/bin" + +# Kill all processes. +echo "Sending all processes the TERM signal..." +killall5 -15 +sleep 5 +echo "Sending all processes the KILL signal..." +killall5 -9 + +# We start update here, since we just killed it. +test -x /sbin/update && update + +echo "Entering single-user mode..." +exec init -t1 S diff --git a/recipes/initscripts/initscripts-1.0/slugos/alignment.sh b/recipes/initscripts/initscripts-1.0/slugos/alignment.sh new file mode 100644 index 0000000000..52e43cc0c5 --- /dev/null +++ b/recipes/initscripts/initscripts-1.0/slugos/alignment.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# +# How to handle alignment faults on the ARM +# +# 0 - ignore, the value will probably be rotated +# 1 - warn, a log message will be output +# 2 - fixup, the kernel will do an expensive aligned read +# 3 - fixup+warn +# 4 - signal, the process will get an illegal instruction fault +# 5 - signal+warn +# 6 - invalid (has no effect) +# 7 - invalid (has no effect) +# +# Set ALIGN in /etc/default/rcS to override (do not edit this +# file!) Set ALIGN to empty to avoid changing the kernel +# default (currently '0'). +ALIGN=3 +. /etc/default/rcS +test -e /proc/cpu/alignment -a -n "$ALIGN" -a "$ALIGN" -ge 0 -a "$ALIGN" -lt 6 && + echo "$ALIGN" >/proc/cpu/alignment diff --git a/recipes/initscripts/initscripts-1.0/slugos/banner b/recipes/initscripts/initscripts-1.0/slugos/banner new file mode 100644 index 0000000000..8e64235acb --- /dev/null +++ b/recipes/initscripts/initscripts-1.0/slugos/banner @@ -0,0 +1,4 @@ +#!/bin/sh +#NOTE: this script may execute with absolutely nothing +# in /dev +echo "SlugOS booting..." diff --git a/recipes/initscripts/initscripts-1.0/slugos/bootclean.sh b/recipes/initscripts/initscripts-1.0/slugos/bootclean.sh new file mode 100644 index 0000000000..3b17d6d617 --- /dev/null +++ b/recipes/initscripts/initscripts-1.0/slugos/bootclean.sh @@ -0,0 +1,47 @@ +#!/bin/sh +# +# bootclean.sh - Cleans out /tmp, /var/run, and /var/lock +# This script should run after mountall.sh in runlevel S. +# +# This script relies upon find and xargs, and is largely +# based on the equivalent script in the Debian releases. + +. /etc/default/rcS + +# Completely clean out everything in /tmp, but do not walk into +# anything that might be mounted beneath /tmp. If /tmp is not +# a directory, ignore this (it's probably a symlink to +# /var/volatiles/tmp, and we best leave it alone). + +if [ -d /tmp -a ! -L /tmp ] ; then + echo "bootclean.sh: Cleaning /tmp..." + cd /tmp || { echo "bootclean.sh: unable to cd to /tmp." ; return 1 ; } + find . -xdev ! -type d -print0 | xargs -0r rm -f -- + find . -depth -xdev -type d ! -name . -exec rmdir \{\} \; +else + echo "bootclean.sh: Skipping /tmp (not a directory)..." +fi + +# Now clean out /var/lock. + +if [ -d /var/lock -a ! -L /var/lock ] ; then + echo "bootclean.sh: Cleaning /var/lock..." + cd /var/lock || { echo "bootclean.sh: unable to cd to /var/lock." ; return 1 ; } + find . -xdev ! -type d -print0 | xargs -0r rm -f -- +else + echo "bootclean.sh: Skipping /var/lock (not a directory)..." +fi + +# Now clean out /var/run. + +if [ -d /var/run -a ! -L /var/run ] ; then + echo "bootclean.sh: Cleaning /var/run..." + cd /var/run || { echo "bootclean.sh: unable to cd to /var/run." ; return 1 ; } + find . -xdev ! -type d ! -name utmp -print0 | xargs -0r rm -f -- +else + echo "bootclean.sh: Skipping /var/run (not a directory)..." +fi + +# done. + +exit 0 diff --git a/recipes/initscripts/initscripts-1.0/slugos/checkroot b/recipes/initscripts/initscripts-1.0/slugos/checkroot new file mode 100644 index 0000000000..31291cdc65 --- /dev/null +++ b/recipes/initscripts/initscripts-1.0/slugos/checkroot @@ -0,0 +1,177 @@ +#!/bin/sh +# checkroot.sh Check to root filesystem. +# +# Version: @(#)checkroot.sh 2.84 25-Jan-2002 miquels@cistron.nl +# + +. /etc/default/functions +. /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 +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" + test "$mnt" != / && continue + rootopts="$opts" + test "$pass" = 0 -o "$pass" = "" && ROOTFSCK=no + case "$opts" in + ro|ro,*|*,ro|*,ro,*) + rootmode=ro + ;; + esac +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. +# +# We don't test whether we're running a 2.[0123].x kernel and md +# since that's plain too old. + +if test "$DOSWAP" != no +then + swaps="$(blkid -t TYPE=swap -o device 2>/dev/null)" + if test -n "$swaps" + then + swapon $swaps 2>/dev/null + else + swapon -a 2> /dev/null + fi +fi + +# +# Check the root filesystem. +# +if test -f /fastboot || test "$ROOTFSCK" != yes +then + test "$ROOTFSCK" = yes && echo "Fast boot, no filesystem check" +elif test ! -x /sbin/fsck -a ! -x /usr/sbin/fsck +then + echo "/etc/init.d/checkroot.sh: no fsck" +else + leds disk-1 slow + # + # 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 "$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 + leds system panic + leds beep -r 5 + # Start a single user shell on the console + if single_user_ok + then + sulogin -t 600 $CONSOLE + # if this exits with SIGALRM (which happens to be 142) the + # timeout happened, do not, then, reboot! + if test $? -ne 142 + then + reboot -f + else + echo "/etc/init.d/checkroot.sh: sulogin timeout, continuing boot" + fi + else + echo "/etc/init.d/checkroot.sh: fsck failed, continuing boot" + fi + fi + else + echo "*** ERROR! Cannot fsck root fs because it is not mounted read-only!" + echo + fi + leds disk-1 off +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. +# +mount -n -o remount,$rootopts / +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 + mount -f /sys + test "$devfs" && grep -q '^devfs /dev' /proc/mounts && mount -f "$devfs" +fi + +: exit 0 diff --git a/recipes/initscripts/initscripts-1.0/slugos/devices.patch b/recipes/initscripts/initscripts-1.0/slugos/devices.patch new file mode 100644 index 0000000000..2583b62f48 --- /dev/null +++ b/recipes/initscripts/initscripts-1.0/slugos/devices.patch @@ -0,0 +1,52 @@ +# +# Patch to allow /dev to reside permanently in the file +# system. +# +--- old/devices 2005-05-28 21:51:39.012078699 -0700 ++++ new/devices 2005-06-12 00:16:29.222686303 -0700 +@@ -6,7 +6,7 @@ + . /etc/default/rcS + + # exit without doing anything if udev is active +-if test -e /dev/.udev -o -e /dev/.udevdb; then ++if test -e /dev/.udev -o -e /dev/.udevdb -o -e /dev/.permanent; then + exit 0 + fi + +@@ -37,12 +37,20 @@ + mknod /dev/ppp c 108 0 + 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 ++ if test -e /dev/.noram ++ then ++ # There should be no files, any files will damage the ++ # makedevs script below. ++ rm $(find /dev -type f -print) ++ :>/dev/.noram + else +- if test "$VERBOSE" != "no"; then echo "done"; fi ++ 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 + fi + if test "$VERBOSE" != "no"; then echo -n "Populating /dev: "; fi + cd / +@@ -60,6 +68,10 @@ + if test "$VERBOSE" != "no"; then echo "failed"; fi + else + if test "$VERBOSE" != "no"; then echo "done"; fi ++ if test -e /dev/.noram ++ then ++ :>/dev/.permanent ++ fi + fi + fi + diff --git a/recipes/initscripts/initscripts-1.0/slugos/domainname.sh b/recipes/initscripts/initscripts-1.0/slugos/domainname.sh new file mode 100644 index 0000000000..e12de0e130 --- /dev/null +++ b/recipes/initscripts/initscripts-1.0/slugos/domainname.sh @@ -0,0 +1,5 @@ +#!/bin/sh +# domainname.sh Set the domainname. +# +test -r /etc/defaultdomain && + cat /etc/defaultdomain >/proc/sys/kernel/domainname diff --git a/recipes/initscripts/initscripts-1.0/slugos/mountall.sh b/recipes/initscripts/initscripts-1.0/slugos/mountall.sh new file mode 100644 index 0000000000..1ae02df6a3 --- /dev/null +++ b/recipes/initscripts/initscripts-1.0/slugos/mountall.sh @@ -0,0 +1,36 @@ +#!/bin/sh +# mountall.sh Mount all filesystems. +# +# Version: @(#)mountall.sh 2.83-2 01-Nov-2001 miquels@cistron.nl +# +. /etc/default/rcS + +# If the right stuff exists, attempt to automatically assemble any +# RAID devices that might be configured. +# +if test -x /sbin/mdadm +then + test "$VERBOSE" != no && echo "Assembling RAID devices..." + mdadm --assemble --scan --auto=md +fi + +# +# 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 -at nonfs,nosmbfs,noncpfs 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 + +: exit 0 + diff --git a/recipes/initscripts/initscripts-1.0/slugos/reboot b/recipes/initscripts/initscripts-1.0/slugos/reboot new file mode 100755 index 0000000000..f98b87f033 --- /dev/null +++ b/recipes/initscripts/initscripts-1.0/slugos/reboot @@ -0,0 +1,16 @@ +#!/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 "Rebooting... " +if [ -x /usr/sbin/kexec ] ; then + echo " trying kexec..." + kexec -f -e -x +fi +echo " normal reboot..." +reboot -d -f -i diff --git a/recipes/initscripts/initscripts-1.0/slugos/rootopts.patch b/recipes/initscripts/initscripts-1.0/slugos/rootopts.patch new file mode 100644 index 0000000000..3f2a925879 --- /dev/null +++ b/recipes/initscripts/initscripts-1.0/slugos/rootopts.patch @@ -0,0 +1,15 @@ +# +# Ensure that the root file system is remounted with the correct +# options from fstab +# +--- old/checkroot.sh 2005-05-28 19:30:55.488975598 -0700 ++++ new/checkroot.sh 2005-05-28 19:31:32.334390450 -0700 +@@ -149,7 +149,7 @@ + # is on a ro fs until the remount succeeded. Then clean up old mtabs + # and finally write the new mtab. + # +-mount -n -o remount,$rootmode / ++mount -n -o remount,$rootopts / + if test "$rootmode" = rw + then + if test ! -L /etc/mtab diff --git a/recipes/initscripts/initscripts-1.0/slugos/umountfs b/recipes/initscripts/initscripts-1.0/slugos/umountfs new file mode 100644 index 0000000000..5580d7bb47 --- /dev/null +++ b/recipes/initscripts/initscripts-1.0/slugos/umountfs @@ -0,0 +1,43 @@ +#!/bin/sh +# +# umountfs Turn off swap and unmount all local filesystems. +# + +PATH=/sbin:/bin:/usr/sbin:/usr/bin + +# Ensure /proc is mounted +test -r /proc/mounts || mount -t proc proc /proc + +echo "Deactivating swap..." +swapoff -a + +# We leave /proc mounted, the umount of /dev/devpts seems to fail +# quite frequently, the busybox umount apparently gives up at the +# first failure, so it is necessary to go file system by file +# system. It is necessary to go backward in the /proc list, because +# later things may have been mounted on earlier mounts. +devfs= +unmount() { + local dev mp type opts + if read dev mp type opts + then + # recurse - unmount later items + unmount + # skip /proc and /dev but not the sub-directories + case "$mp" in + /|/proc)return 0;; + /dev) devfs=1 + return 0;; + esac + # then unmount this, if possible, otherwise make + # it read-only + umount -f -r "$mp" + fi +} + +echo "Unmounting local filesystems..." +unmount </proc/mounts + +# now /dev and read-only / (halt/reboot may need /proc!) +test -n "$devfs" && umount -f -r /dev +mount -o remount,ro / diff --git a/recipes/initscripts/initscripts-1.0/slugos/umountnfs.sh b/recipes/initscripts/initscripts-1.0/slugos/umountnfs.sh new file mode 100644 index 0000000000..6ff83e50d7 --- /dev/null +++ b/recipes/initscripts/initscripts-1.0/slugos/umountnfs.sh @@ -0,0 +1,40 @@ +#!/bin/sh +# +# umountnfs.sh Unmount all network filesystems. +# +PATH=/sbin:/bin:/usr/sbin:/usr/bin + +# Write a reboot record to /var/log/wtmp before unmounting +halt -w + +# Ensure /proc is mounted +test -r /proc/mounts || mount -t proc proc /proc + +echo "Unmounting remote filesystems..." + +# +# Read the list of mounted file systems and -f umount the +# known network file systems. -f says umount it even if +# the server is unreachable. Do not attempt to umount +# the root file system. Unmount in reverse order from +# that given by /proc/mounts (otherwise it may not work). +# +unmount() { + local dev mp type opts + if read dev mp type opts + then + # recurse - unmount later items + unmount + # skip /, /proc and /dev + case "$mp" in + /|/proc)return 0;; + /dev) return 0;; + esac + # then unmount this, if nfs + case "$type" in + nfs|smbfs|ncpfs) umount -f "$mp";; + esac + fi +} + +unmount </proc/mounts diff --git a/recipes/initscripts/initscripts-1.0/slugos/volatiles b/recipes/initscripts/initscripts-1.0/slugos/volatiles new file mode 100644 index 0000000000..3c680b2643 --- /dev/null +++ b/recipes/initscripts/initscripts-1.0/slugos/volatiles @@ -0,0 +1,36 @@ +# This configuration file lists filesystem objects that should get verified +# during startup and be created if missing. +# +# Every line must either be a comment starting with # +# or a definition of format: +# <type> <owner> <group> <mode> <path> <linksource> +# where the items are separated by whitespace ! +# +# <type> : d|f|l : (d)irectory|(f)ile|(l)ink +# +# A linking example: +# l root root 0777 /var/test /tmp/testfile +# f root root 0644 /var/test none +# +# Understanding links: +# When populate-volatile is to verify/create a directory or file, it will first +# check it's existence. If a link is found to exist in the place of the target, +# the path of the target is replaced with the target the link points to. +# Thus, if a link is in the place to be verified, the object will be created +# in the place the link points to instead. +# 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 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 +f root root 0664 /var/log/wtmp none +f root root 0664 /var/run/utmp none diff --git a/recipes/initscripts/initscripts-1.0/spitz/devices b/recipes/initscripts/initscripts-1.0/spitz/devices new file mode 100755 index 0000000000..083090ecb9 --- /dev/null +++ b/recipes/initscripts/initscripts-1.0/spitz/devices @@ -0,0 +1,68 @@ +#!/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/.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 + ln -s /dev/touchscreen/0 /dev/ts + ln -s /dev/touchscreen/0raw /dev/tsraw + ln -s /dev/vc/0 /dev/tty0 + ln -s /dev/vc/1 /dev/tty1 + ln -s /dev/vc/2 /dev/tty2 + ln -s /dev/vc/3 /dev/tty3 + ln -s /dev/vc/4 /dev/tty4 + ln -s /dev/vc/5 /dev/tty5 + ln -s /dev/fb/0 /dev/fb0 +# ln -s /dev/tts/0 /dev/ttySA0 +# ln -s /dev/tts/1 /dev/ttySA1 +# ln -s /dev/tts/2 /dev/ttySA2 + + ln -s /dev/sound/dsp /dev/dsp + ln -s /dev/sound/mixer /dev/mixer + + ln -s /dev/v4l/video0 /dev/video0 + ln -s /dev/v4l/video0 /dev/video + ln -s /dev/misc/rtc /dev/rtc + + ## need this so that ppp will autoload the ppp modules + mknod /dev/ppp c 108 0 + 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/msys + mkdir -p dev/pts + mkdir -p dev/input + mkdir -p dev/vc + 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 /dev/sharp_ts /dev/ts + ln -sf /dev/sharp_fl /dev/fl + 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/recipes/initscripts/initscripts-1.0/sysfs.sh b/recipes/initscripts/initscripts-1.0/sysfs.sh new file mode 100644 index 0000000000..4486128ad5 --- /dev/null +++ b/recipes/initscripts/initscripts-1.0/sysfs.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +if [ -e /proc ] && ! [ -e /proc/mounts ]; then + mount -t proc proc /proc +fi + +if [ -e /sys ] && grep -q sysfs /proc/filesystems; then + mount sysfs /sys -t sysfs +fi + +exit 0 diff --git a/recipes/initscripts/initscripts-1.0/tosa/devices b/recipes/initscripts/initscripts-1.0/tosa/devices new file mode 100755 index 0000000000..61cfd9d7b9 --- /dev/null +++ b/recipes/initscripts/initscripts-1.0/tosa/devices @@ -0,0 +1,72 @@ +#!/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/.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 + ln -s /dev/touchscreen/0 /dev/ts + ln -s /dev/touchscreen/0raw /dev/tsraw + ln -s /dev/vc/0 /dev/tty0 + ln -s /dev/vc/1 /dev/tty1 + ln -s /dev/vc/2 /dev/tty2 + ln -s /dev/vc/3 /dev/tty3 + ln -s /dev/vc/4 /dev/tty4 + ln -s /dev/vc/5 /dev/tty5 + ln -s /dev/fb/0 /dev/fb0 +# ln -s /dev/tts/0 /dev/ttySA0 +# ln -s /dev/tts/1 /dev/ttySA1 +# ln -s /dev/tts/2 /dev/ttySA2 + + ln -s /dev/sound/dsp /dev/dsp + ln -s /dev/sound/mixer /dev/mixer + + ln -s /dev/v4l/video0 /dev/video0 + ln -s /dev/v4l/video0 /dev/video + ln -s /dev/misc/rtc /dev/rtc + + ## need this so that ppp will autoload the ppp modules + mknod /dev/ppp c 108 0 + 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/msys + mkdir -p dev/pts + mkdir -p dev/input + mkdir -p dev/vc + 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 /dev/sharp_ts /dev/ts + ln -sf /dev/sharp_fl /dev/fl + 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 + +#Always turn on usb +if [ ! -d /dev/usb ]; then mkdir /dev/usb; fi +mknod /dev/usb/host_ohci c 10 222 + +exit 0 diff --git a/recipes/initscripts/initscripts-1.0/uml/devices b/recipes/initscripts/initscripts-1.0/uml/devices new file mode 100755 index 0000000000..d6459c1633 --- /dev/null +++ b/recipes/initscripts/initscripts-1.0/uml/devices @@ -0,0 +1,61 @@ +#!/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/.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 + ln -s /dev/touchscreen/0 /dev/ts + ln -s /dev/touchscreen/0raw /dev/tsraw + ln -s /dev/vc/0 /dev/tty0 + ln -s /dev/vc/1 /dev/tty1 + ln -s /dev/vc/2 /dev/tty2 + ln -s /dev/vc/3 /dev/tty3 + ln -s /dev/vc/4 /dev/tty4 + ln -s /dev/vc/5 /dev/tty5 + ln -s /dev/fb/0 /dev/fb0 +# ln -s /dev/tts/0 /dev/ttySA0 +# ln -s /dev/tts/1 /dev/ttySA1 +# ln -s /dev/tts/2 /dev/ttySA2 + + ln -s /dev/sound/dsp /dev/dsp + ln -s /dev/sound/mixer /dev/mixer + + ln -s /dev/v4l/video0 /dev/video0 + ln -s /dev/v4l/video0 /dev/video + ln -s /dev/misc/rtc /dev/rtc + + ## need this so that ppp will autoload the ppp modules + mknod /dev/ppp c 108 0 + 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/msys + mkdir -p dev/pts + 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/recipes/initscripts/initscripts-1.0/urandom b/recipes/initscripts/initscripts-1.0/urandom new file mode 100755 index 0000000000..45c41d758b --- /dev/null +++ b/recipes/initscripts/initscripts-1.0/urandom @@ -0,0 +1,41 @@ +#! /bin/sh +# +# urandom This script saves the random seed between reboots. +# It is called from the boot, halt and reboot scripts. +# +# Version: @(#)urandom 1.33 22-Jun-1998 miquels@cistron.nl +# + +test -c /dev/urandom || exit 0 +. /etc/default/rcS + +case "$1" in + start|"") + test "$VERBOSE" != no && echo "Initializing random number generator..." + # Load and then save 512 bytes, + # which is the size of the entropy pool + if test -f /var/lib/urandom/random-seed + then + cat /var/lib/urandom/random-seed >/dev/urandom + fi + rm -f /var/lib/urandom/random-seed + umask 077 + dd if=/dev/urandom of=/var/lib/urandom/random-seed count=1 \ + >/dev/null 2>&1 || echo "urandom start: failed." + umask 022 + ;; + stop) + # Carry a random seed from shut-down to start-up; + # see documentation in linux/drivers/char/random.c + test "$VERBOSE" != no && echo "Saving random seed..." + umask 077 + dd if=/dev/urandom of=/var/lib/urandom/random-seed count=1 \ + >/dev/null 2>&1 || echo "urandom stop: failed." + ;; + *) + echo "Usage: urandom {start|stop}" >&2 + exit 1 + ;; +esac + +exit 0 diff --git a/recipes/initscripts/initscripts-openmoko/bootmisc.sh b/recipes/initscripts/initscripts-openmoko/bootmisc.sh new file mode 100644 index 0000000000..4511e12fc1 --- /dev/null +++ b/recipes/initscripts/initscripts-openmoko/bootmisc.sh @@ -0,0 +1,47 @@ +# +# bootmisc.sh Miscellaneous things to be done during bootup. +# + +. /etc/default/rcS +# +# Put a nologin file in /etc to prevent people from logging in before +# system startup is complete. +# +if test "$DELAYLOGIN" = yes +then + echo "System bootup in progress - please wait" > /etc/nologin + cp /etc/nologin /etc/nologin.boot +fi + +# +# Update /etc/motd. +# +if test "$EDITMOTD" != no +then + uname -a > /etc/motd.tmp + sed 1d /etc/motd >> /etc/motd.tmp + mv /etc/motd.tmp /etc/motd +fi + +# +# Update dynamic library cache +# +#/sbin/ldconfig + +# Set the system clock from hardware clock +# If the timestamp is 1 day or more recent than the current time, +# use the timestamp instead. +[ "$UTC" = yes ] || /etc/init.d/hwclock.sh start + +if ! test -f /etc/.configured && test -e /etc/timestamp +then + SYSTEMDATE=`date "+%Y%m%d"` + TIMESTAMP=`cat /etc/timestamp | awk '{ print substr($0,9,4) substr($0,1,4);}'` + NEEDUPDATE=`expr \( $TIMESTAMP \> $SYSTEMDATE \)` + if [ $NEEDUPDATE -eq 1 ]; then + date `cat /etc/timestamp` + /etc/init.d/hwclock.sh stop + fi +fi + +: exit 0 diff --git a/recipes/initscripts/initscripts-openmoko/campgsm b/recipes/initscripts/initscripts-openmoko/campgsm new file mode 100644 index 0000000000..5be67086c2 --- /dev/null +++ b/recipes/initscripts/initscripts-openmoko/campgsm @@ -0,0 +1,128 @@ +#!/bin/sh + +VERBOSE=no + +PIDS=`pidof -x "$0"` + +# make sure pidof sees us +if [ -z "$PIDS" ]; then + exec "$0" + exit 1 +fi + +GSM_DEVICE="/dev/ttySAC0" +GSM_POWER="/sys/devices/platform/neo1973-pm-gsm.0/power_on" +GSM_RESET="/sys/devices/platform/neo1973-pm-gsm.0/reset" + +GSM_COMMANDS="Z E0V1 +CFUN=1 +COPS=0" + +gsm_running () { + if [ "$PIDS" != "$$" ]; then + return 0 + else + return 1 + fi +} + +gsm_send () { + cmd="$1" + echo -ne "AT${cmd}\r" > "$GSM_DEVICE" +} + +# this function might block forever +gsm_wait () { + ret="UNKNOWN" + + while read status; do + case "$status" in + OK*) + ret="OK" + ;; + ERROR*) + ret="ERROR" + ;; + *) + ret="UNKNOWN" + ;; + esac + if [ "x$ret" != "xUNKNOWN" ]; then + break + fi + done < "$GSM_DEVICE" + + if [ "x$ret" != "xOK" ]; then + return 1 + fi + + return 0 +} + +gsm_setup () { + [ $VERBOSE == "yes" ] && echo -n "Powering up GSM modem..." + echo 0 > "$GSM_POWER"; sleep 1 + echo 1 > "$GSM_POWER"; sleep 1 + echo 1 > "$GSM_RESET"; sleep 1 + echo 0 > "$GSM_RESET"; sleep 4 + [ $VERBOSE == "yes" ] && echo "done" + + stty -F "$GSM_DEVICE" cooked -opost -echo crtscts 115200 +} + +gsm_wakeup () { + [ $VERBOSE == "yes" ] && echo "Waking up GSM modem" + + # there is at most one OK/ERROR even if we send multiple commands + gsm_send "" + gsm_send "" + gsm_send "" + + if gsm_wait; then + [ $VERBOSE == "yes" ] && echo "GSM modem awake" + return 0 + else + echo "failed to wake up GSM modem" + return 1 + fi +} + +start () { + gsm_setup + + if gsm_wakeup; then + for cmd in $GSM_COMMANDS + do + [ $VERBOSE == "yes" ] && echo "Sending AT$cmd" + gsm_send "$cmd" + + if ! gsm_wait; then + echo "AT$cmd failed" + break + fi + done + fi +} + +set -e + +case "$1" in + start) + if gsm_running; then + echo "Another instance is already running" + exit 1 + fi + + start & + ;; + stop) + if gsm_running; then + PIDS=`pidof -x -o "$$" "$0"` + echo -n "Stopping other instances..." + kill $PIDS + echo "done" + fi + ;; + *) + echo "Usage: $0 {start|stop}" + exit 1 + ;; +esac diff --git a/recipes/initscripts/initscripts-openmoko/checkroot.sh b/recipes/initscripts/initscripts-openmoko/checkroot.sh new file mode 100644 index 0000000000..029ae9b405 --- /dev/null +++ b/recipes/initscripts/initscripts-openmoko/checkroot.sh @@ -0,0 +1,43 @@ +# +# 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 + +# +# 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. +# +ROOTFSDEV="/dev/root" +if grep -q "^$ROOTFSDEV .* rw" /proc/mounts; then + echo "Root filesystem already read-write, not remounting" +else + rootmode=rw + + echo "Remounting root file system..." + mount -n -o remount,noatime,$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 +fi + +: exit 0 diff --git a/recipes/initscripts/initscripts-openmoko/led-trigger.sh b/recipes/initscripts/initscripts-openmoko/led-trigger.sh new file mode 100644 index 0000000000..9583ce9331 --- /dev/null +++ b/recipes/initscripts/initscripts-openmoko/led-trigger.sh @@ -0,0 +1,6 @@ +#! /bin/sh +sys_led_trigger="/sys/devices/platform/gta02-led.0/leds/gta02-aux:red/trigger" +if test -e $sys_led_trigger ;then + echo bat-charging > $sys_led_trigger +fi + diff --git a/recipes/initscripts/initscripts-openmoko/mountall.sh b/recipes/initscripts/initscripts-openmoko/mountall.sh new file mode 100644 index 0000000000..4bd7bbb02c --- /dev/null +++ b/recipes/initscripts/initscripts-openmoko/mountall.sh @@ -0,0 +1,52 @@ +# +# mountall.sh Mount all filesystems. +# +# 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 +# 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 $MOUNTALL + +# +# 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 +if test $doswap = yes +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="`grep root /etc/passwd | cut -d: -f6`" + + if test -n "$ROOT_HOME" + then + ! test -d "$ROOT_HOME" && mkdir -p "$ROOT_HOME" + fi +fi +: exit 0 + diff --git a/recipes/initscripts/initscripts-openmoko/mountdevsubfs.sh b/recipes/initscripts/initscripts-openmoko/mountdevsubfs.sh new file mode 100644 index 0000000000..c6cfb05af2 --- /dev/null +++ b/recipes/initscripts/initscripts-openmoko/mountdevsubfs.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +. /etc/default/devpts + +test -c /dev/ptmx || mknod -m 666 /dev/ptmx c 5 2 + +if [ -d /dev/pts ]; then + mount -n -t devpts devpts /dev/pts -ogid=${TTYGRP},mode=${TTYMODE} +fi + + +if [ -d /dev/shm ]; then + mount -n -t tmpfs shmfs /dev/shm -omode=0777 +fi diff --git a/recipes/initscripts/initscripts-openmoko/mountkernfs.sh b/recipes/initscripts/initscripts-openmoko/mountkernfs.sh new file mode 100644 index 0000000000..1ed09fcf05 --- /dev/null +++ b/recipes/initscripts/initscripts-openmoko/mountkernfs.sh @@ -0,0 +1,33 @@ +#!/bin/sh + +supported_kernel() { + case "$(uname -r)" in + 2.[012345].*|2.6.[0-9]|2.6.[0-9][!0-9]*) return 1 ;; + 2.6.1[0-7]|2.6.1[0-7][!0-9]*) return 1 ;; + esac + return 0 +} + +check_kernel() { + if ! supported_kernel; then + echo "WARNING: kernel < 2.6.18" + fi + + if ! grep -qs devpts /proc/filesystems; then + echo "WARNING: kernel does not support devpts" + fi + + if ! grep -qs tmpfs /proc/filesystems; then + echo "WARNING: kernel does not support tmpfs" + fi +} + +if [ -d /proc ]; then + mount -n -t proc proc /proc +fi + +check_kernel + +if [ -d /sys ]; then + mount -n -t sysfs sysfs /sys +fi diff --git a/recipes/initscripts/initscripts-openmoko/mountnfs.sh b/recipes/initscripts/initscripts-openmoko/mountnfs.sh new file mode 100644 index 0000000000..2631392483 --- /dev/null +++ b/recipes/initscripts/initscripts-openmoko/mountnfs.sh @@ -0,0 +1,87 @@ +# +# mountnfs.sh Now that TCP/IP is configured, mount the NFS file +# systems in /etc/fstab if needed. If possible, +# start the portmapper before mounting (this is needed for +# Linux 2.1.x and up). +# +# Also mounts SBM filesystems now, so the name of +# this script is getting increasingly inaccurate. +# +# Version: @(#)mountnfs.sh 2.83 05-Oct-2001 miquels@cistron.nl +# + +. /etc/default/rcS + +# +# Run in a subshell because of I/O redirection. +# +test -x /sbin/portmap && test -f /etc/fstab && ( + +# +# Read through fstab line by line. If it is NFS, set the flag +# for mounting NFS filesystems. If any NFS partition is found and it +# not mounted with the nolock option, we start the portmapper. +# +portmap=no +mount_nfs=no +mount_smb=no +mount_ncp=no +while read device mountpt fstype options +do + case "$device" in + ""|\#*) + continue + ;; + esac + + case "$options" in + *noauto*) + continue + ;; + esac + + if test "$fstype" = nfs + then + mount_nfs=yes + case "$options" in + *nolock*) + ;; + *) + portmap=yes + ;; + esac + fi + if test "$fstype" = smbfs + then + mount_smb=yes + fi + if test "$fstype" = ncpfs + then + mount_ncp=yes + fi +done + +exec 0>&1 + +if test "$portmap" = yes +then + if test -x /sbin/portmap + then + echo -n "Starting portmapper... " + start-stop-daemon --start --quiet --exec /sbin/portmap + sleep 2 + fi +fi + +if test "$mount_nfs" = yes || test "$mount_smb" = yes || test "$mount_ncp" = yes +then + echo "Mounting remote filesystems..." + test "$mount_nfs" = yes && mount -a -t nfs + test "$mount_smb" = yes && mount -a -t smbfs + test "$mount_ncp" = yes && mount -a -t ncpfs +fi + +) < /etc/fstab + +: exit 0 + diff --git a/recipes/initscripts/initscripts-openmoko/populate-volatile.sh b/recipes/initscripts/initscripts-openmoko/populate-volatile.sh new file mode 100644 index 0000000000..6fb23d758d --- /dev/null +++ b/recipes/initscripts/initscripts-openmoko/populate-volatile.sh @@ -0,0 +1,248 @@ +#!/bin/sh + +. /etc/default/rcS + +CFGDIR="/etc/default/volatiles" +TMPROOT="/var/tmp" +COREDEF="00_core" + +[ "${VERBOSE}" != "no" ] && echo "Populating volatile Filesystems." + +create_file() { + EXEC=" + touch \"$1\"; + chown ${TUSER}.${TGROUP} $1 || echo \"Failed to set owner -${TUSER}- for -$1-.\" >/dev/tty0 2>&1; + chmod ${TMODE} $1 || echo \"Failed to set mode -${TMODE}- for -$1-.\" >/dev/tty0 2>&1 " + + test "$VOLATILE_ENABLE_CACHE" = yes && echo "$EXEC" >> /etc/volatile.cache + + [ -e "$1" ] && { + [ "${VERBOSE}" != "no" ] && echo "Target already exists. Skipping." + } || { + eval $EXEC + } +} + +mk_dir() { + EXEC=" + mkdir -p \"$1\"; + chown ${TUSER}.${TGROUP} $1 || echo \"Failed to set owner -${TUSER}- for -$1-.\" >/dev/tty0 2>&1; + chmod ${TMODE} $1 || echo \"Failed to set mode -${TMODE}- for -$1-.\" >/dev/tty0 2>&1 " + + test "$VOLATILE_ENABLE_CACHE" = yes && echo "$EXEC" >> /etc/volatile.cache + + [ -e "$1" ] && { + [ "${VERBOSE}" != "no" ] && echo "Target already exists. Skipping." + } || { + eval $EXEC + } +} + +link_file() { + EXEC="test -e \"$2\" -o -L $2 || ln -s \"$1\" \"$2\" >/dev/tty0 2>&1" + + test "$VOLATILE_ENABLE_CACHE" = yes && echo " $EXEC" >> /etc/volatile.cache + + [ -e "$2" ] && { + echo "Cannot create link over existing -${TNAME}-." >&2 + } || { + eval $EXEC + } +} + +check_requirements() { + + cleanup() { + rm "${TMP_INTERMED}" + rm "${TMP_DEFINED}" + rm "${TMP_COMBINED}" + } + + CFGFILE="$1" + + [ `basename "${CFGFILE}"` = "${COREDEF}" ] && return 0 + + TMP_INTERMED="${TMPROOT}/tmp.$$" + TMP_DEFINED="${TMPROOT}/tmpdefined.$$" + TMP_COMBINED="${TMPROOT}/tmpcombined.$$" + + + cat /etc/passwd | sed 's@\(^:\)*:.*@\1@' | sort | uniq > "${TMP_DEFINED}" + cat ${CFGFILE} | grep -v "^#" | cut -d " " -f 2 > "${TMP_INTERMED}" + cat "${TMP_DEFINED}" "${TMP_INTERMED}" | sort | uniq > "${TMP_COMBINED}" + + NR_DEFINED_USERS="`cat "${TMP_DEFINED}" | wc -l`" + NR_COMBINED_USERS="`cat "${TMP_COMBINED}" | wc -l`" + + [ "${NR_DEFINED_USERS}" -ne "${NR_COMBINED_USERS}" ] && { + echo "Undefined users:" + diff "${TMP_DEFINED}" "${TMP_COMBINED}" | grep "^>" + cleanup + return 1 + } + + + cat /etc/group | sed 's@\(^:\)*:.*@\1@' | sort | uniq > "${TMP_DEFINED}" + cat ${CFGFILE} | grep -v "^#" | cut -d " " -f 3 > "${TMP_INTERMED}" + cat "${TMP_DEFINED}" "${TMP_INTERMED}" | sort | uniq > "${TMP_COMBINED}" + + NR_DEFINED_GROUPS="`cat "${TMP_DEFINED}" | wc -l`" + NR_COMBINED_GROUPS="`cat "${TMP_COMBINED}" | wc -l`" + + [ "${NR_DEFINED_GROUPS}" -ne "${NR_COMBINED_GROUPS}" ] && { + echo "Undefined groups:" + diff "${TMP_DEFINED}" "${TMP_COMBINED}" | grep "^>" + cleanup + return 1 + } + + # Add checks for required directories here + + cleanup + return 0 + } + +apply_cfgfile() { + + CFGFILE="$1" + + check_requirements "${CFGFILE}" || { + echo "Skipping ${CFGFILE}" + return 1 + } + + cat ${CFGFILE} | grep -v "^#" | \ + while read LINE; do + + eval `echo "$LINE" | sed -n "s/\(.*\)\ \(.*\) \(.*\)\ \(.*\)\ \(.*\)\ \(.*\)/TTYPE=\1 ; TUSER=\2; TGROUP=\3; TMODE=\4; TNAME=\5 TLTARGET=\6/p"` + + [ "${VERBOSE}" != "no" ] && echo "Checking for -${TNAME}-." + + + [ "${TTYPE}" = "l" ] && { + TSOURCE="$TLTARGET" + [ -L "${TNAME}" ] || { + [ "${VERBOSE}" != "no" ] && echo "Creating link -${TNAME}- pointing to -${TSOURCE}-." + link_file "${TSOURCE}" "${TNAME}" + } + continue + } + + [ -L "${TNAME}" ] && { + [ "${VERBOSE}" != "no" ] && echo "Found link." + NEWNAME=`ls -l "${TNAME}" | sed -e 's/^.*-> \(.*\)$/\1/'` + echo ${NEWNAME} | grep -v "^/" >/dev/null && { + TNAME="`echo ${TNAME} | sed -e 's@\(.*\)/.*@\1@'`/${NEWNAME}" + [ "${VERBOSE}" != "no" ] && echo "Converted relative linktarget to absolute path -${TNAME}-." + } || { + TNAME="${NEWNAME}" + [ "${VERBOSE}" != "no" ] && echo "Using absolute link target -${TNAME}-." + } + } + + case "${TTYPE}" in + "f") [ "${VERBOSE}" != "no" ] && echo "Creating file -${TNAME}-." + create_file "${TNAME}" + ;; + "d") [ "${VERBOSE}" != "no" ] && echo "Creating directory -${TNAME}-." + mk_dir "${TNAME}" + # Add check to see if there's an entry in fstab to mount. + ;; + *) [ "${VERBOSE}" != "no" ] && echo "Invalid type -${TTYPE}-." + continue + ;; + esac + + + done + + return 0 + + } + +SKEL_DIR="/etc/volatile/skel" + +skel_mount() { + VOLATILE="$1" + + [ -d "$VOLATILE" ] || mkdir -p "$VOLATILE" + + mount -t tmpfs volatile "$VOLATILE" -omode=0755 +} + +skel_load() { + VOLATILE="$1" + + if ! skel_mount "$VOLATILE"; then + echo "failed to mount $VOLATILE" + return 1 + fi + + cp -a "$SKEL_DIR"/* "$VOLATILE"/ +} + +skel_update() { + VOLATILE="$1" + + if ! skel_mount "$VOLATILE"; then + echo "failed to update" + return 1 + fi + + echo -n "Populating volatile directory..." + for file in `ls -1 "${CFGDIR}" | sort`; do + apply_cfgfile "${CFGDIR}/${file}" + done + echo "done" + + if [ -d "$SKEL_DIR" ]; then + rm -rf "$SKEL_DIR" + fi + + mkdir -p "$SKEL_DIR"/tmp + cp -a "$VOLATILE"/* "$SKEL_DIR"/ +} + +populate() { + if [ -d "$SKEL_DIR"/tmp ]; then + skel_load /var/volatile + else + skel_update /var/volatile + fi + + for d in /var/volatile/* + do + ln -sf "$d" /var + done + + if ! test -L /tmp; then + rm -rf /tmp + ln -sf /var/tmp /tmp + fi +} + +case "$1" in + start) + if grep -q "^volatile " /proc/mounts; then + echo "volatile directory is already mounted" + else + populate + fi + ;; + stop) + : # no-op + ;; + update) + if skel_update /var/volatile; then + umount /var/volatile + if grep -q "^volatile " /proc/mounts; then + cp -a "$SKEL_DIR"/* /var/volatile + fi + fi + ;; + *) + echo "Usage: /etc/init.d/populate-volatile {start|stop|update}" + ;; +esac + +: exit 0 diff --git a/recipes/initscripts/initscripts-openmoko_1.0.bb b/recipes/initscripts/initscripts-openmoko_1.0.bb new file mode 100644 index 0000000000..d6d233b535 --- /dev/null +++ b/recipes/initscripts/initscripts-openmoko_1.0.bb @@ -0,0 +1,111 @@ +DESCRIPTION = "Openmoko init scripts" +SECTION = "base" +PRIORITY = "required" +LICENSE = "GPL" +DEPENDS = "" +RDEPENDS = "" + +RCONFLICTS_${PN} = "initscripts" + +SRC_URI = "file://bootmisc.sh \ + file://campgsm \ + file://checkroot.sh \ + file://finish.sh \ + file://functions \ + file://hostname.sh \ + file://led-trigger.sh \ + file://mountall.sh \ + file://mountdevsubfs.sh \ + file://mountkernfs.sh \ + file://mountnfs.sh \ + file://populate-volatile.sh \ + file://devpts \ + file://volatiles \ + file://halt \ + file://reboot \ + file://rmnologin \ + file://save-rtc.sh \ + file://sendsigs \ + file://umountfs \ + file://umountnfs.sh \ + " + +SRC_URI_append_arm = " file://alignment.sh" + +inherit base + +do_install () { +# +# Create directories and install device independent scripts +# + install -d ${D}${sysconfdir}/init.d + install -d ${D}${sysconfdir}/rcS.d + install -d ${D}${sysconfdir}/rc0.d + install -d ${D}${sysconfdir}/rc1.d + install -d ${D}${sysconfdir}/rc2.d + install -d ${D}${sysconfdir}/rc3.d + install -d ${D}${sysconfdir}/rc4.d + install -d ${D}${sysconfdir}/rc5.d + install -d ${D}${sysconfdir}/rc6.d + install -d ${D}${sysconfdir}/default + install -d ${D}${sysconfdir}/default/volatiles + + if [ "${TARGET_ARCH}" = "arm" ]; then + install -m 0755 ${WORKDIR}/alignment.sh ${D}${sysconfdir}/init.d + fi + install -m 0755 ${WORKDIR}/bootmisc.sh ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/campgsm ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/checkroot.sh ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/finish.sh ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/functions ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/hostname.sh ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/led-trigger.sh ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/mountall.sh ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/mountnfs.sh ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/mountdevsubfs.sh ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/mountkernfs.sh ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/populate-volatile.sh ${D}${sysconfdir}/init.d + + install -m 0644 ${WORKDIR}/devpts ${D}${sysconfdir}/default/devpts + install -m 0644 ${WORKDIR}/volatiles ${D}${sysconfdir}/default/volatiles/00_core + + install -m 0755 ${WORKDIR}/halt ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/reboot ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/rmnologin ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/save-rtc.sh ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/sendsigs ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/umountfs ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/umountnfs.sh ${D}${sysconfdir}/init.d + +# +# Create runlevel links +# + ln -sf ../init.d/hostname.sh ${D}${sysconfdir}/rcS.d/S02hostname.sh + ln -sf ../init.d/mountkernfs.sh ${D}${sysconfdir}/rcS.d/S02mountkernfs.sh + ln -sf ../init.d/mountdevsubfs.sh ${D}${sysconfdir}/rcS.d/S04mountdevsubfs.sh + if [ "${TARGET_ARCH}" = "arm" ]; then + ln -sf ../init.d/alignment.sh ${D}${sysconfdir}/rcS.d/S06alignment + fi + #ln -sf ../init.d/campgsm ${D}${sysconfdir}/rcS.d/S07campgsm + ln -sf ../init.d/checkroot.sh ${D}${sysconfdir}/rcS.d/S10checkroot.sh + ln -sf ../init.d/mountall.sh ${D}${sysconfdir}/rcS.d/S35mountall.sh + ln -sf ../init.d/populate-volatile.sh ${D}${sysconfdir}/rcS.d/S37populate-volatile.sh + ln -sf ../init.d/mountnfs.sh ${D}${sysconfdir}/rcS.d/S45mountnfs.sh + ln -sf ../init.d/bootmisc.sh ${D}${sysconfdir}/rcS.d/S55bootmisc.sh + ln -sf ../init.d/led-trigger.sh ${D}${sysconfdir}/rcS.d/S97led-trigger.sh + ln -sf ../init.d/finish.sh ${D}${sysconfdir}/rcS.d/S99finish.sh + + ln -sf ../init.d/rmnologin ${D}${sysconfdir}/rc5.d/S99rmnologin + + ln -sf ../init.d/sendsigs ${D}${sysconfdir}/rc0.d/S20sendsigs + ln -sf ../init.d/save-rtc.sh ${D}${sysconfdir}/rc0.d/S25save-rtc.sh + ln -sf ../init.d/umountnfs.sh ${D}${sysconfdir}/rc6.d/S31umountnfs.sh + ln -sf ../init.d/umountfs ${D}${sysconfdir}/rc0.d/S40umountfs + ln -sf ../init.d/halt ${D}${sysconfdir}/rc0.d/S90halt + + ln -sf ../init.d/sendsigs ${D}${sysconfdir}/rc6.d/S20sendsigs + ln -sf ../init.d/save-rtc.sh ${D}${sysconfdir}/rc6.d/S25save-rtc.sh + ln -sf ../init.d/umountnfs.sh ${D}${sysconfdir}/rc6.d/S31umountnfs.sh + ln -sf ../init.d/umountfs ${D}${sysconfdir}/rc6.d/S40umountfs + ln -sf ../init.d/reboot ${D}${sysconfdir}/rc6.d/S90reboot +} diff --git a/recipes/initscripts/initscripts-openprotium_1.0.bb b/recipes/initscripts/initscripts-openprotium_1.0.bb new file mode 100644 index 0000000000..e787eede92 --- /dev/null +++ b/recipes/initscripts/initscripts-openprotium_1.0.bb @@ -0,0 +1,181 @@ +# +# OpenProtium stuff sorta specific for the storcenter. +# +# This is, in effect, an extended patch to fix various +# problems in the initscripts on SlugOS. The problems +# mostly come down to the order the scripts are executed +# in. +include initscripts_${PV}.bb + +RCONFLICTS = "initscripts" +# All other standard definitions inherited from initscripts +# Except the PR which is hacked here. The format used is +# a suffix +PR := "${PR}.11" + +FILESPATH = "${@base_set_filespath([ '${FILE_DIRNAME}/${P}', '${FILE_DIRNAME}/initscripts-${PV}', '${FILE_DIRNAME}/files', '${FILE_DIRNAME}' ], d)}" + +PACKAGES = "${PN}-dbg ${PN}" + +SRC_URI += "file://openprotium/devfs.sh" +SRC_URI += "file://openprotium/domainname.sh" +SRC_URI += "file://openprotium/devices" +SRC_URI += "file://openprotium/halt" +SRC_URI += "file://openprotium/reboot" +SRC_URI += "file://openprotium/flashclean" +SRC_URI += "file://openprotium/checkroot.sh" +SRC_URI += "file://openprotium/mountall.sh" +SRC_URI += "file://openprotium/umountinitrd.sh" +SRC_URI += "file://openprotium/umountfs" + +# Without this it is not possible to patch checkroot.sh +S = "${WORKDIR}" + +do_install_append() { + #rm ${D}${sysconfdir}/device_table + #touch ${D}${sysconfdir}/device_table + + # openprotium specific scripts + # install -m 0755 ${WORKDIR}/alignment.sh ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/openprotium/domainname.sh ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/openprotium/devfs.sh ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/openprotium/halt ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/openprotium/reboot ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/openprotium/devices ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/openprotium/flashclean ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/openprotium/checkroot.sh ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/openprotium/mountall.sh ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/openprotium/umountinitrd.sh ${D}${sysconfdir}/init.d + + # Remove the do install links (this detects a change to the + # initscripts .bb file - it will cause a build failure here.) + # This is a copy of the ln -sf lines from the initscripts + # do_install. + rm ${D}${sysconfdir}/rc2.d/S99rmnologin + rm ${D}${sysconfdir}/rc3.d/S99rmnologin + rm ${D}${sysconfdir}/rc4.d/S99rmnologin + rm ${D}${sysconfdir}/rc5.d/S99rmnologin + rm ${D}${sysconfdir}/rc6.d/S20sendsigs +# rm ${D}${sysconfdir}/rc6.d/S30urandom + rm ${D}${sysconfdir}/rc6.d/S31umountnfs.sh + rm ${D}${sysconfdir}/rc6.d/S40umountfs + rm ${D}${sysconfdir}/rcS.d/S30ramdisk + rm ${D}${sysconfdir}/rc6.d/S90reboot + rm ${D}${sysconfdir}/rc0.d/S20sendsigs +# rm ${D}${sysconfdir}/rc0.d/S30urandom + rm ${D}${sysconfdir}/rc0.d/S31umountnfs.sh + rm ${D}${sysconfdir}/rc0.d/S40umountfs + rm ${D}${sysconfdir}/rc0.d/S90halt + rm ${D}${sysconfdir}/rcS.d/S02banner + rm ${D}${sysconfdir}/rcS.d/S10checkroot.sh +# rm ${D}${sysconfdir}/rcS.d/S30checkfs.sh + rm ${D}${sysconfdir}/rcS.d/S35mountall.sh + rm ${D}${sysconfdir}/rcS.d/S39hostname.sh + rm ${D}${sysconfdir}/rcS.d/S45mountnfs.sh + rm ${D}${sysconfdir}/rcS.d/S55bootmisc.sh +# rm ${D}${sysconfdir}/rcS.d/S55urandom + rm ${D}${sysconfdir}/rcS.d/S99finish.sh + rm ${D}${sysconfdir}/rcS.d/S05devices + # udev will run at S04 if installed + rm ${D}${sysconfdir}/rcS.d/S03sysfs + rm ${D}${sysconfdir}/rcS.d/S38devpts.sh + rm -f ${D}${sysconfdir}/rcS.d/S06alignment + rm ${D}${sysconfdir}/rcS.d/S37populate-volatile.sh + rm ${D}${sysconfdir}/rc0.d/S25save-rtc.sh + rm ${D}${sysconfdir}/rc6.d/S25save-rtc.sh + + + + # Check the result + find ${D}${sysconfdir}/rc?.d ! -type d -print | { + status=0 + while read d + do + oenote "initscripts-openprotium: unexpected link $d" + status=1 + done + test $status -eq 0 || + oefatal "initscripts-openprotium: new links break do_install" + } + + # Set the run-level links + # + # Startup (S) links - UNCHANGED + # + # Keep these in order of startup - S, then 1, 2-5, 0,6 + # according to the level in which the script starts (or stops) first. + update-rc.d -r ${D} banner start 2 S . + update-rc.d -r ${D} sysfs.sh start 3 S . + # udev runs at S 04 . + update-rc.d -r ${D} devices start 5 S . + # update-rc.d -r ${D} alignment.sh start 7 S . + # busybox hwclock.sh (slugos-init) starts here (08) + # slugos-init umountinitrd runs here (09) + + update-rc.d -r ${D} checkroot.sh start 10 S . + # slugos buffer syslog starts here (11) + # sysconfsetup runs at S 12 + # modutils.sh runs at S 20 + # checkfs.sh is currently disabled from S 30 (and won't work on SlugOS) + # ramdisk is not used on SlugOS, would run at S 30 + update-rc.d -r ${D} mountall.sh start 35 S . + # base-files populate-volatile.sh runs at S37 + update-rc.d -r ${D} devpts.sh start 38 S . + # slugos file syslog starts here (39) + update-rc.d -r ${D} populate-volatile.sh start 37 S . + + # set hostname and domainname before the network script works (by + # entering them at level 40), networking may reset them. + update-rc.d -r ${D} domainname.sh start 40 S . + update-rc.d -r ${D} hostname.sh start 40 S . + # network runs at S 40 + # slugos network syslog starts here (44) + update-rc.d -r ${D} mountnfs.sh start 45 S . + + # update-rc.d -r ${D} bootmisc.sh start 55 S . + # urandom is currently disabled from S 55 (and won't work with tmpfs /var) + + # ipkg-cl configure runs at S 98 + update-rc.d -r ${D} finish.sh start 99 S . + + # + # User (2-5) links - UNCHANGED + # rmnologin is the only thing added to user levels + update-rc.d -r ${D} rmnologin start 99 2 3 4 5 . + update-rc.d -r ${D} flashclean start 99 5 . + + # + # Shutdown (0,6) links - !!!CHANGED!!! + # + # The problem here is that netbase installs K40networking but portmap + # installs S32portmap. One of these has to change! The safe change + # is to make the networking stop at S40, so all network related shutdown + # must be in a K script or <S40. + # + # S20sendsigs is a disaster. It needs to happen before the umounts + # but after the portmapper (which it would otherwise kill). + # + # urandom would stop at (S)30 + + # This is the special, correct, slugos umountnfs.sh (it looks in + # the /proc/mounts information, not /etc/fstab) + update-rc.d -r ${D} umountnfs.sh start 31 0 6 . + # update-rc.d -r ${D} save-rtc.sh start 25 0 6 . + # portmap stops at 32 + # slugos network syslog stops here (39) + # networking stops at 40 (nothing else does, believe me.) + + # busybox hwclock.sh (slugos-init) stops here (45) + # slugos file syslog stops here (47) + # slugos buffer syslog stops here (49) + # udev stops here (55) + # Remove any errant processes + update-rc.d -r ${D} sendsigs start 60 0 6 . + + # This is the special, correct, slugos umountfs, it will umount + # any network file systems which failed to umount before. + update-rc.d -r ${D} umountfs start 70 0 6 . + + update-rc.d -r ${D} halt start 90 0 . + update-rc.d -r ${D} reboot start 90 6 . +} diff --git a/recipes/initscripts/initscripts-slugos_1.0.bb b/recipes/initscripts/initscripts-slugos_1.0.bb new file mode 100644 index 0000000000..29209dbf6a --- /dev/null +++ b/recipes/initscripts/initscripts-slugos_1.0.bb @@ -0,0 +1,175 @@ +# SlugOS specific stuff for the init scripts. +# +# This is, in effect, an extended patch to fix various +# problems in the initscripts on SlugOS. The problems +# mostly come down to the order the scripts are executed +# in. +include initscripts_${PV}.bb + +RCONFLICTS = "initscripts" + +# SlugOS uses the busybox makedevs, so until that dependency gets virtualized +# the below lines serve to remove the dependency on the full makedevs package: +DEPENDS = "" +RDEPENDS = "" + +# All other standard definitions inherited from initscripts +# Except the PR which is hacked here. The format used is +# a suffix +PR := "${PR}.19" + +FILESPATH = "${@base_set_filespath([ '${FILE_DIRNAME}/${P}', '${FILE_DIRNAME}/initscripts-${PV}', '${FILE_DIRNAME}/files', '${FILE_DIRNAME}' ], d)}" + +PACKAGES = "${PN}-dbg ${PN}" + +SRC_URI += "file://alignment.sh" +SRC_URI += "file://domainname.sh" +SRC_URI += "file://devices.patch;patch=1" +SRC_URI += "file://bootclean.sh" + +# Without this it is not possible to patch checkroot +S = "${WORKDIR}" + +do_install_append() { + # the image build command now installs this for slugos + rm ${D}${sysconfdir}/device_table + + # slugos specific scripts + install -m 0755 ${WORKDIR}/alignment.sh ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/domainname.sh ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/bootclean.sh ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/checkroot ${D}${sysconfdir}/init.d + + # Remove the do install links (this detects a change to the + # initscripts .bb file - it will cause a build failure here.) + # This is a copy of the ln -sf lines from the initscripts + # do_install. + rm ${D}${sysconfdir}/rc2.d/S99rmnologin + rm ${D}${sysconfdir}/rc3.d/S99rmnologin + rm ${D}${sysconfdir}/rc4.d/S99rmnologin + rm ${D}${sysconfdir}/rc5.d/S99rmnologin + rm ${D}${sysconfdir}/rc6.d/S20sendsigs +# rm ${D}${sysconfdir}/rc6.d/S30urandom + rm ${D}${sysconfdir}/rc6.d/S31umountnfs.sh + rm ${D}${sysconfdir}/rc6.d/S40umountfs + rm ${D}${sysconfdir}/rcS.d/S30ramdisk + rm ${D}${sysconfdir}/rc6.d/S90reboot + rm ${D}${sysconfdir}/rc0.d/S20sendsigs +# rm ${D}${sysconfdir}/rc0.d/S30urandom + rm ${D}${sysconfdir}/rc0.d/S31umountnfs.sh + rm ${D}${sysconfdir}/rc0.d/S40umountfs + rm ${D}${sysconfdir}/rc0.d/S90halt + rm ${D}${sysconfdir}/rcS.d/S02banner + rm ${D}${sysconfdir}/rcS.d/S10checkroot +# rm ${D}${sysconfdir}/rcS.d/S30checkfs.sh + rm ${D}${sysconfdir}/rcS.d/S35mountall.sh + rm ${D}${sysconfdir}/rcS.d/S39hostname.sh + rm ${D}${sysconfdir}/rcS.d/S45mountnfs.sh + rm ${D}${sysconfdir}/rcS.d/S55bootmisc.sh +# rm ${D}${sysconfdir}/rcS.d/S55urandom + rm ${D}${sysconfdir}/rcS.d/S99finish.sh + rm ${D}${sysconfdir}/rcS.d/S05devices + # udev will run at S04 if installed + rm ${D}${sysconfdir}/rcS.d/S03sysfs + rm ${D}${sysconfdir}/rcS.d/S38devpts.sh + rm -f ${D}${sysconfdir}/rcS.d/S06alignment + rm ${D}${sysconfdir}/rcS.d/S37populate-volatile.sh + rm ${D}${sysconfdir}/rc0.d/S25save-rtc.sh + rm ${D}${sysconfdir}/rc6.d/S25save-rtc.sh + + + + # Check the result + find ${D}${sysconfdir}/rc?.d ! -type d -print | { + status=0 + while read d + do + oenote "initscripts-slugos: unexpected link $d" + status=1 + done + test $status -eq 0 || + oefatal "initscripts-slugos: new links break do_install" + } + + # Set the run-level links + # + # Startup (S) links - UNCHANGED + # + # Keep these in order of startup - S, then 1, 2-5, 0,6 + # according to the level in which the script starts (or stops) first. + update-rc.d -r ${D} banner start 2 S . + update-rc.d -r ${D} sysfs.sh start 3 S . + # udev runs at S 04 . + update-rc.d -r ${D} devices start 5 S . + update-rc.d -r ${D} alignment.sh start 7 S . + # busybox hwclock.sh (slugos-init) starts here (08) + # slugos-init umountinitrd runs here (09) + + update-rc.d -r ${D} checkroot start 10 S . + # slugos buffer syslog starts here (11) + # sysconfsetup runs at S 12 + # modutils.sh runs at S 20 + # checkfs.sh is currently disabled from S 30 (and won't work on SlugOS) + # ramdisk is not used on SlugOS, would run at S 30 + update-rc.d -r ${D} mountall.sh start 35 S . + # bootclean must run after mountall but before populate-volatile + update-rc.d -r ${D} bootclean.sh start 36 S . + # base-files populate-volatile.sh runs at S37 + update-rc.d -r ${D} devpts.sh start 38 S . + # slugos file syslog starts here (39) + update-rc.d -r ${D} populate-volatile.sh start 37 S . + + # set hostname and domainname before the network script works (by + # entering them at level 40), networking may reset them. + update-rc.d -r ${D} domainname.sh start 40 S . + update-rc.d -r ${D} hostname.sh start 40 S . + # network runs at S 40 + # slugos network syslog starts here (44) + update-rc.d -r ${D} mountnfs.sh start 45 S . + + update-rc.d -r ${D} bootmisc.sh start 55 S . + # urandom is currently disabled from S 55 (and won't work with tmpfs /var) + + # ipkg-cl configure runs at S 98 + update-rc.d -r ${D} finish.sh start 99 S . + + # + # User (2-5) links - UNCHANGED + # rmnologin is the only thing added to user levels + update-rc.d -r ${D} rmnologin start 99 2 3 4 5 . + + # + # Shutdown (0,6) links - !!!CHANGED!!! + # + # The problem here is that netbase installs K40networking but portmap + # installs S32portmap. One of these has to change! The safe change + # is to make the networking stop at S40, so all network related shutdown + # must be in a K script or <S40. + # + # S20sendsigs is a disaster. It needs to happen before the umounts + # but after the portmapper (which it would otherwise kill). + # + # urandom would stop at (S)30 + + # This is the special, correct, slugos umountnfs.sh (it looks in + # the /proc/mounts information, not /etc/fstab) + update-rc.d -r ${D} umountnfs.sh start 31 0 6 . + update-rc.d -r ${D} save-rtc.sh start 25 0 6 . + # portmap stops at 32 + # slugos network syslog stops here (39) + # networking stops at 40 (nothing else does, believe me.) + + # busybox hwclock.sh (slugos-init) stops here (45) + # slugos file syslog stops here (47) + # slugos buffer syslog stops here (49) + # udev stops here (55) + # Remove any errant processes + update-rc.d -r ${D} sendsigs start 60 0 6 . + + # This is the special, correct, slugos umountfs, it will umount + # any network file systems which failed to umount before. + update-rc.d -r ${D} umountfs start 70 0 6 . + + update-rc.d -r ${D} halt start 90 0 . + update-rc.d -r ${D} reboot start 90 6 . +} diff --git a/recipes/initscripts/initscripts_1.0.bb b/recipes/initscripts/initscripts_1.0.bb new file mode 100644 index 0000000000..b497576036 --- /dev/null +++ b/recipes/initscripts/initscripts_1.0.bb @@ -0,0 +1,132 @@ +DESCRIPTION = "SysV init scripts" +SECTION = "base" +PRIORITY = "required" +DEPENDS = "makedevs" +RDEPENDS = "makedevs" +LICENSE = "GPL" +PR = "r112" + +SRC_URI = "file://functions \ + file://halt \ + file://ramdisk \ + file://umountfs \ + file://devices \ + file://devpts.sh \ + file://devpts \ + file://hostname.sh \ + file://mountall.sh \ + file://banner \ + file://finish.sh \ + file://bootmisc.sh \ + file://mountnfs.sh \ + file://reboot \ + file://checkfs.sh \ + file://single \ + file://sendsigs \ + file://urandom \ + file://rmnologin \ + file://checkroot \ + file://umountnfs.sh \ + file://sysfs.sh \ + file://device_table.txt \ + file://populate-volatile.sh \ + file://volatiles \ + file://save-rtc.sh" + +SRC_URI_append_arm = " file://alignment.sh" + +KERNEL_VERSION = "" + +do_install () { +# +# Create directories and install device independent scripts +# + install -d ${D}${sysconfdir}/init.d + install -d ${D}${sysconfdir}/rcS.d + install -d ${D}${sysconfdir}/rc0.d + install -d ${D}${sysconfdir}/rc1.d + install -d ${D}${sysconfdir}/rc2.d + install -d ${D}${sysconfdir}/rc3.d + install -d ${D}${sysconfdir}/rc4.d + install -d ${D}${sysconfdir}/rc5.d + install -d ${D}${sysconfdir}/rc6.d + install -d ${D}${sysconfdir}/default + install -d ${D}${sysconfdir}/default/volatiles + + install -m 0755 ${WORKDIR}/functions ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/bootmisc.sh ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/checkroot ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/finish.sh ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/halt ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/hostname.sh ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/mountall.sh ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/mountnfs.sh ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/ramdisk ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/reboot ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/rmnologin ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/sendsigs ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/single ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/umountnfs.sh ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/urandom ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/devpts.sh ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/devpts ${D}${sysconfdir}/default + install -m 0755 ${WORKDIR}/sysfs.sh ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/populate-volatile.sh ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/save-rtc.sh ${D}${sysconfdir}/init.d + install -m 0644 ${WORKDIR}/volatiles ${D}${sysconfdir}/default/volatiles/00_core + if [ "${TARGET_ARCH}" = "arm" ]; then + install -m 0755 ${WORKDIR}/alignment.sh ${D}${sysconfdir}/init.d + fi +# +# Install device dependent scripts +# + install -m 0755 ${WORKDIR}/banner ${D}${sysconfdir}/init.d/banner + install -m 0755 ${WORKDIR}/devices ${D}${sysconfdir}/init.d/devices + install -m 0755 ${WORKDIR}/umountfs ${D}${sysconfdir}/init.d/umountfs +# +# Create runlevel links +# + ln -sf ../init.d/rmnologin ${D}${sysconfdir}/rc2.d/S99rmnologin + ln -sf ../init.d/rmnologin ${D}${sysconfdir}/rc3.d/S99rmnologin + ln -sf ../init.d/rmnologin ${D}${sysconfdir}/rc4.d/S99rmnologin + ln -sf ../init.d/rmnologin ${D}${sysconfdir}/rc5.d/S99rmnologin + ln -sf ../init.d/sendsigs ${D}${sysconfdir}/rc6.d/S20sendsigs +# ln -sf ../init.d/urandom ${D}${sysconfdir}/rc6.d/S30urandom + ln -sf ../init.d/umountnfs.sh ${D}${sysconfdir}/rc6.d/S31umountnfs.sh + ln -sf ../init.d/umountfs ${D}${sysconfdir}/rc6.d/S40umountfs + # udev will run at S55 if installed + ln -sf ../init.d/ramdisk ${D}${sysconfdir}/rcS.d/S30ramdisk + ln -sf ../init.d/reboot ${D}${sysconfdir}/rc6.d/S90reboot + ln -sf ../init.d/sendsigs ${D}${sysconfdir}/rc0.d/S20sendsigs +# ln -sf ../init.d/urandom ${D}${sysconfdir}/rc0.d/S30urandom + ln -sf ../init.d/umountnfs.sh ${D}${sysconfdir}/rc0.d/S31umountnfs.sh + ln -sf ../init.d/umountfs ${D}${sysconfdir}/rc0.d/S40umountfs + # udev will run at S55 if installed + ln -sf ../init.d/halt ${D}${sysconfdir}/rc0.d/S90halt + ln -sf ../init.d/save-rtc.sh ${D}${sysconfdir}/rc0.d/S25save-rtc.sh + ln -sf ../init.d/save-rtc.sh ${D}${sysconfdir}/rc6.d/S25save-rtc.sh + ln -sf ../init.d/banner ${D}${sysconfdir}/rcS.d/S02banner + ln -sf ../init.d/checkroot ${D}${sysconfdir}/rcS.d/S10checkroot +# ln -sf ../init.d/checkfs.sh ${D}${sysconfdir}/rcS.d/S30checkfs.sh + ln -sf ../init.d/mountall.sh ${D}${sysconfdir}/rcS.d/S35mountall.sh + ln -sf ../init.d/hostname.sh ${D}${sysconfdir}/rcS.d/S39hostname.sh + ln -sf ../init.d/mountnfs.sh ${D}${sysconfdir}/rcS.d/S45mountnfs.sh + ln -sf ../init.d/bootmisc.sh ${D}${sysconfdir}/rcS.d/S55bootmisc.sh +# ln -sf ../init.d/urandom ${D}${sysconfdir}/rcS.d/S55urandom + ln -sf ../init.d/finish.sh ${D}${sysconfdir}/rcS.d/S99finish.sh + ln -sf ../init.d/devices ${D}${sysconfdir}/rcS.d/S05devices + # udev will run at S04 if installed + ln -sf ../init.d/sysfs.sh ${D}${sysconfdir}/rcS.d/S03sysfs + ln -sf ../init.d/populate-volatile.sh ${D}${sysconfdir}/rcS.d/S37populate-volatile.sh + ln -sf ../init.d/devpts.sh ${D}${sysconfdir}/rcS.d/S38devpts.sh + if [ "${TARGET_ARCH}" = "arm" ]; then + ln -sf ../init.d/alignment.sh ${D}${sysconfdir}/rcS.d/S06alignment + fi + + install -m 0755 ${WORKDIR}/device_table.txt ${D}${sysconfdir}/device_table +} + +# Angstrom doesn't support devfs +do_install_append_angstrom () { + rm ${D}${sysconfdir}/init.d/devices ${D}${sysconfdir}/rcS.d/S05devices +} |