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/initscripts-1.0/slugos | |
parent | fa6cd5a3b993f16c27de4ff82b42684516d433ba (diff) | |
download | openembedded-709c4d66e0b107ca606941b988bad717c0b45d9b.tar.gz |
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/initscripts-1.0/slugos')
12 files changed, 491 insertions, 0 deletions
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 |