diff options
Diffstat (limited to 'meta/recipes-core/initscripts/initscripts-1.0')
31 files changed, 1729 insertions, 0 deletions
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/arm/alignment.sh b/meta/recipes-core/initscripts/initscripts-1.0/arm/alignment.sh new file mode 100644 index 0000000000..b577b9a03a --- /dev/null +++ b/meta/recipes-core/initscripts/initscripts-1.0/arm/alignment.sh @@ -0,0 +1,13 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: alignment +# Required-Start: mountkernfs +# Required-Stop: mountkernfs +# Default-Start: S +# Default-Stop: +### END INIT INFO + +if [ -e /proc/cpu/alignment ]; then + echo "3" > /proc/cpu/alignment +fi + diff --git a/meta/recipes-core/initscripts/initscripts-1.0/banner.sh b/meta/recipes-core/initscripts/initscripts-1.0/banner.sh new file mode 100644 index 0000000000..9e2b091252 --- /dev/null +++ b/meta/recipes-core/initscripts/initscripts-1.0/banner.sh @@ -0,0 +1,24 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: banner +# Required-Start: +# Required-Stop: +# Default-Start: S +# Default-Stop: +### END INIT INFO + +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/meta/recipes-core/initscripts/initscripts-1.0/bootmisc.sh b/meta/recipes-core/initscripts/initscripts-1.0/bootmisc.sh new file mode 100755 index 0000000000..bd11f9a2fc --- /dev/null +++ b/meta/recipes-core/initscripts/initscripts-1.0/bootmisc.sh @@ -0,0 +1,78 @@ +### BEGIN INIT INFO +# Provides: bootmisc +# Required-Start: $local_fs mountvirtfs +# Required-Stop: $local_fs +# Default-Start: S +# Default-Stop: 0 6 +# Short-Description: Misc and other. +### END INIT INFO + +. /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 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 + +# 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/timestamp2 +then + SYSTEMDATE=`date "+%Y%m%d%2H%2M"` + read TIMESTAMP < /etc/timestamp2 + NEEDUPDATE=`expr \( $TIMESTAMP \> $SYSTEMDATE + 10000 \)` + if [ $NEEDUPDATE -eq 1 ]; then + date $TIMESTAMP + /etc/init.d/hwclock.sh stop + fi +fi +: exit 0 diff --git a/meta/recipes-core/initscripts/initscripts-1.0/checkfs.sh b/meta/recipes-core/initscripts/initscripts-1.0/checkfs.sh new file mode 100755 index 0000000000..91897d4cbb --- /dev/null +++ b/meta/recipes-core/initscripts/initscripts-1.0/checkfs.sh @@ -0,0 +1,49 @@ +### BEGIN INIT INFO +# Provides: checkfs +# Required-Start: checkroot +# Required-Stop: +# Default-Start: S +# Default-Stop: +# Short-Description: Check all other file systems +### END INIT INFO + +. /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/meta/recipes-core/initscripts/initscripts-1.0/checkroot.sh b/meta/recipes-core/initscripts/initscripts-1.0/checkroot.sh new file mode 100755 index 0000000000..02697ce9bf --- /dev/null +++ b/meta/recipes-core/initscripts/initscripts-1.0/checkroot.sh @@ -0,0 +1,137 @@ +### BEGIN INIT INFO +# Provides: checkroot +# Required-Start: udev +# Required-Stop: +# Default-Start: S +# Default-Stop: +# Short-Description: Check to root file system. +### END INIT INFO + +. /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 + +# +# Read /etc/fstab. +# +exec 9< /etc/fstab +rootmode=rw +rootopts=rw +rootcheck=no +swap_on_md=no +devfs= +while read fs mnt type opts dump pass junk <&9 +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. +# +test "$VERBOSE" != no && echo "Activating swap" +swapon -a 2> /dev/null + +# +# 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. +# +mount -n -o remount,$rootmode / +if test "$rootmode" = rw +then + ln -sf /proc/mounts /dev/mtab +fi + +: exit 0 diff --git a/meta/recipes-core/initscripts/initscripts-1.0/device_table.txt b/meta/recipes-core/initscripts/initscripts-1.0/device_table.txt new file mode 100644 index 0000000000..a302c5aca3 --- /dev/null +++ b/meta/recipes-core/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/meta/recipes-core/initscripts/initscripts-1.0/devpts b/meta/recipes-core/initscripts/initscripts-1.0/devpts new file mode 100644 index 0000000000..4a0978b404 --- /dev/null +++ b/meta/recipes-core/initscripts/initscripts-1.0/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/meta/recipes-core/initscripts/initscripts-1.0/devpts.sh b/meta/recipes-core/initscripts/initscripts-1.0/devpts.sh new file mode 100755 index 0000000000..18202adcc7 --- /dev/null +++ b/meta/recipes-core/initscripts/initscripts-1.0/devpts.sh @@ -0,0 +1,28 @@ +#! /bin/sh +### BEGIN INIT INFO +# Provides: devpts +# Required-Start: udev +# Required-Stop: +# Default-Start: S +# Default-Stop: +# Short-Description: Mount /dev/pts file systems. +### END INIT INFO + +. /etc/default/devpts + +if 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 diff --git a/meta/recipes-core/initscripts/initscripts-1.0/finish.sh b/meta/recipes-core/initscripts/initscripts-1.0/finish.sh new file mode 100755 index 0000000000..183a384faa --- /dev/null +++ b/meta/recipes-core/initscripts/initscripts-1.0/finish.sh @@ -0,0 +1,14 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: finish.sh +# Required-Start: $remote_fs rmnologin +# Required-Stop: +# Default-Start: 2 3 4 5 +# Default-Stop: +# Short-Description: Finish system start +# Description: +### END INIT INFO + +if ! test -e /etc/.configured; then + > /etc/.configured +fi diff --git a/meta/recipes-core/initscripts/initscripts-1.0/functions b/meta/recipes-core/initscripts/initscripts-1.0/functions new file mode 100644 index 0000000000..689fd32b39 --- /dev/null +++ b/meta/recipes-core/initscripts/initscripts-1.0/functions @@ -0,0 +1,14 @@ +# -*-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/pidof $1` + [ "$pid" != "" ] && kill $pid +} diff --git a/meta/recipes-core/initscripts/initscripts-1.0/halt b/meta/recipes-core/initscripts/initscripts-1.0/halt new file mode 100755 index 0000000000..609b793b7c --- /dev/null +++ b/meta/recipes-core/initscripts/initscripts-1.0/halt @@ -0,0 +1,29 @@ +#! /bin/sh +### BEGIN INIT INFO +# Provides: halt +# Required-Start: +# Required-Stop: +# Default-Start: +# Default-Stop: 0 +# Short-Description: Execute the halt command. +# Description: +### END INIT INFO + +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/meta/recipes-core/initscripts/initscripts-1.0/hostname.sh b/meta/recipes-core/initscripts/initscripts-1.0/hostname.sh new file mode 100755 index 0000000000..4399ee7b18 --- /dev/null +++ b/meta/recipes-core/initscripts/initscripts-1.0/hostname.sh @@ -0,0 +1,13 @@ +### BEGIN INIT INFO +# Provides: hostname +# Required-Start: +# Required-Stop: +# Default-Start: S +# Default-Stop: +# Short-Description: Set hostname based on /etc/hostname +### END INIT INFO + +if test -f /etc/hostname +then + hostname -F /etc/hostname +fi diff --git a/meta/recipes-core/initscripts/initscripts-1.0/jornada6xx/checkroot.sh b/meta/recipes-core/initscripts/initscripts-1.0/jornada6xx/checkroot.sh new file mode 100755 index 0000000000..9e2d3cfc85 --- /dev/null +++ b/meta/recipes-core/initscripts/initscripts-1.0/jornada6xx/checkroot.sh @@ -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/meta/recipes-core/initscripts/initscripts-1.0/jornada7xx/checkroot.sh b/meta/recipes-core/initscripts/initscripts-1.0/jornada7xx/checkroot.sh new file mode 100755 index 0000000000..9e2d3cfc85 --- /dev/null +++ b/meta/recipes-core/initscripts/initscripts-1.0/jornada7xx/checkroot.sh @@ -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/meta/recipes-core/initscripts/initscripts-1.0/mountall.sh b/meta/recipes-core/initscripts/initscripts-1.0/mountall.sh new file mode 100755 index 0000000000..9d4f97b683 --- /dev/null +++ b/meta/recipes-core/initscripts/initscripts-1.0/mountall.sh @@ -0,0 +1,38 @@ +### BEGIN INIT INFO +# Provides: mountall +# Required-Start: mountvirtfs +# Required-Stop: +# Default-Start: S +# Default-Stop: +# Short-Description: Mount all filesystems. +# Description: +### END INIT INFO + +. /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 + +# +# Execute swapon command again, in case we want to swap to +# a file on a now mounted filesystem. +# +swapon -a 2> /dev/null + +: exit 0 + diff --git a/meta/recipes-core/initscripts/initscripts-1.0/mountnfs.sh b/meta/recipes-core/initscripts/initscripts-1.0/mountnfs.sh new file mode 100755 index 0000000000..46c58b16a8 --- /dev/null +++ b/meta/recipes-core/initscripts/initscripts-1.0/mountnfs.sh @@ -0,0 +1,83 @@ +### BEGIN INIT INFO +# Provides: mountnfs +# Required-Start: $local_fs $network $portmap +# Required-Stop: +# Default-Start: S +# Default-Stop: +### END INIT INFO + +. /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/meta/recipes-core/initscripts/initscripts-1.0/om-gta01/inittab b/meta/recipes-core/initscripts/initscripts-1.0/om-gta01/inittab new file mode 100644 index 0000000000..8d313b2a58 --- /dev/null +++ b/meta/recipes-core/initscripts/initscripts-1.0/om-gta01/inittab @@ -0,0 +1,48 @@ +# /etc/inittab: init(8) configuration. +# $Id: inittab,v 1.91 2002/01/25 13:35:21 miquels Exp $ + +# The default runlevel. +id:5:initdefault: + +# Boot-time system configuration/initialization script. +# This is run first except when booting in emergency (-b) mode. +si::sysinit:/etc/init.d/rcS + +# What to do in single-user mode. +~~:S:wait:/sbin/sulogin + +# Shut down if kernel sends us SIGINT or SIGPWR +ca::ctrlaltdel:/sbin/halt -p +pf::powerfailnow:/sbin/halt -p + +# /etc/init.d executes the S and K scripts upon change +# of runlevel. +# +# Runlevel 0 is halt. +# Runlevel 1 is single-user. +# Runlevels 2-5 are multi-user. +# Runlevel 6 is reboot. + +l0:0:wait:/etc/init.d/rc 0 +l1:1:wait:/etc/init.d/rc 1 +l2:2:wait:/etc/init.d/rc 2 +l3:3:wait:/etc/init.d/rc 3 +l4:4:wait:/etc/init.d/rc 4 +l5:5:wait:/etc/init.d/rc 5 +l6:6:wait:/etc/init.d/rc 6 +# Normally not reached, but fallthrough in case of emergency. +z6:6:respawn:/sbin/sulogin + +# /sbin/getty invocations for the runlevels. +# +# The "id" field MUST be the same as the last +# characters of the device (after "tty"). +# +# Format: +# <id>:<runlevels>:<action>:<process> + +# NOTE: FIC GTA01 has this odd multiplexer on ttySAC0 since +# GSM shares it with the serial output. We only allow +# the getty in runlevel 2 to cope with that. gsmd gets +# started in runlevel 3. -- mickey@openmoko.org +S:2:respawn:/sbin/getty 115200 ttySAC0 diff --git a/meta/recipes-core/initscripts/initscripts-1.0/openmn/extractfs b/meta/recipes-core/initscripts/initscripts-1.0/openmn/extractfs new file mode 100755 index 0000000000..7e57dedd2d --- /dev/null +++ b/meta/recipes-core/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/meta/recipes-core/initscripts/initscripts-1.0/openmn/packages b/meta/recipes-core/initscripts/initscripts-1.0/openmn/packages new file mode 100755 index 0000000000..2566487d2d --- /dev/null +++ b/meta/recipes-core/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/meta/recipes-core/initscripts/initscripts-1.0/openmn/umountfs b/meta/recipes-core/initscripts/initscripts-1.0/openmn/umountfs new file mode 100755 index 0000000000..399194109b --- /dev/null +++ b/meta/recipes-core/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/meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh b/meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh new file mode 100755 index 0000000000..1813fd1240 --- /dev/null +++ b/meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh @@ -0,0 +1,197 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: volatile +# Required-Start: $local_fs +# Required-Stop: $local_fs +# Default-Start: S +# Default-Stop: +# Short-Description: Populate the volatile filesystem +### END INIT INFO + +. /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 + + } + +clearcache=0 +exec 9</proc/cmdline +while read line <&9 +do + case "$line" in + *clearcache*) clearcache=1 + ;; + *) continue + ;; + esac +done +exec 9>&- + +if test -e /etc/volatile.cache -a "$VOLATILE_ENABLE_CACHE" = "yes" -a "x$1" != "xupdate" -a "x$clearcache" = "x0" +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 + +if test -f /etc/ld.so.cache -a ! -f /var/run/ld.so.cache +then + ln -s /etc/ld.so.cache /var/run/ld.so.cache +fi diff --git a/meta/recipes-core/initscripts/initscripts-1.0/reboot b/meta/recipes-core/initscripts/initscripts-1.0/reboot new file mode 100755 index 0000000000..4c55885aba --- /dev/null +++ b/meta/recipes-core/initscripts/initscripts-1.0/reboot @@ -0,0 +1,15 @@ +#! /bin/sh +### BEGIN INIT INFO +# Provides: reboot +# Required-Start: +# Required-Stop: +# Default-Start: +# Default-Stop: 6 +# Short-Description: Execute the reboot command. +# Description: +### END INIT INFO + +PATH=/sbin:/bin:/usr/sbin:/usr/bin + +echo -n "Rebooting... " +reboot -d -f -i diff --git a/meta/recipes-core/initscripts/initscripts-1.0/rmnologin.sh b/meta/recipes-core/initscripts/initscripts-1.0/rmnologin.sh new file mode 100755 index 0000000000..417efc2456 --- /dev/null +++ b/meta/recipes-core/initscripts/initscripts-1.0/rmnologin.sh @@ -0,0 +1,20 @@ +#! /bin/sh +### BEGIN INIT INFO +# Provides: rmnologin +# Required-Start: $remote_fs $all +# Required-Stop: +# Default-Start: 2 3 4 5 +# Default-Stop: +# Short-Description: Remove /etc/nologin at boot +# Description: This script removes the /etc/nologin file as the +# last step in the boot process, if DELAYLOGIN=yes. +# If DELAYLOGIN=no, /etc/nologin was not created by +# bootmisc earlier in the boot process. +### END INIT INFO + +if test -f /etc/nologin.boot +then + rm -f /etc/nologin /etc/nologin.boot +fi + +: exit 0 diff --git a/meta/recipes-core/initscripts/initscripts-1.0/save-rtc.sh b/meta/recipes-core/initscripts/initscripts-1.0/save-rtc.sh new file mode 100644 index 0000000000..75e43001b8 --- /dev/null +++ b/meta/recipes-core/initscripts/initscripts-1.0/save-rtc.sh @@ -0,0 +1,13 @@ +#! /bin/sh +### BEGIN INIT INFO +# Provides: save-rtc +# Required-Start: +# Required-Stop: $local_fs hwclock +# Default-Start: S +# Default-Stop: 0 6 +# Short-Description: Store system clock into file +# Description: +### END INIT INFO + +# Update the timestamp +date +%Y%m%d%2H%2M > /etc/timestamp2 diff --git a/meta/recipes-core/initscripts/initscripts-1.0/sendsigs b/meta/recipes-core/initscripts/initscripts-1.0/sendsigs new file mode 100755 index 0000000000..2b0f8f3631 --- /dev/null +++ b/meta/recipes-core/initscripts/initscripts-1.0/sendsigs @@ -0,0 +1,21 @@ +#! /bin/sh +### BEGIN INIT INFO +# Provides: sendsigs +# Required-Start: +# Required-Stop: umountnfs +# Default-Start: +# Default-Stop: 0 6 +# Short-Description: Kill all remaining processes. +# Description: +### END INIT INFO + +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/meta/recipes-core/initscripts/initscripts-1.0/single b/meta/recipes-core/initscripts/initscripts-1.0/single new file mode 100755 index 0000000000..0cad693f20 --- /dev/null +++ b/meta/recipes-core/initscripts/initscripts-1.0/single @@ -0,0 +1,24 @@ +#! /bin/sh +### BEGIN INIT INFO +# Provides: single +# Required-Start: $local_fs $all killprocs +# Required-Stop: +# Default-Start: 1 +# Default-Stop: +# Short-Description: executed by init(8) upon entering runlevel 1 (single). +### END INIT INFO + +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/meta/recipes-core/initscripts/initscripts-1.0/sysfs.sh b/meta/recipes-core/initscripts/initscripts-1.0/sysfs.sh new file mode 100644 index 0000000000..be28bb35bf --- /dev/null +++ b/meta/recipes-core/initscripts/initscripts-1.0/sysfs.sh @@ -0,0 +1,19 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: mountvirtfs +# Required-Start: +# Required-Stop: +# Default-Start: S +# Default-Stop: +# Short-Description: Mount kernel virtual file systems. +# Description: Mount initial set of virtual filesystems the kernel +# provides and that are required by everything. +### END INIT INFO + +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 diff --git a/meta/recipes-core/initscripts/initscripts-1.0/umountfs b/meta/recipes-core/initscripts/initscripts-1.0/umountfs new file mode 100755 index 0000000000..5c6793dc9c --- /dev/null +++ b/meta/recipes-core/initscripts/initscripts-1.0/umountfs @@ -0,0 +1,24 @@ +#! /bin/sh +### BEGIN INIT INFO +# Provides: umountfs +# Required-Start: +# Required-Stop: +# Default-Start: +# Default-Stop: 0 6 +# Short-Description: Turn off swap and unmount all local file systems. +# Description: +### END INIT INFO + +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/meta/recipes-core/initscripts/initscripts-1.0/umountnfs.sh b/meta/recipes-core/initscripts/initscripts-1.0/umountnfs.sh new file mode 100755 index 0000000000..a4fb821d91 --- /dev/null +++ b/meta/recipes-core/initscripts/initscripts-1.0/umountnfs.sh @@ -0,0 +1,32 @@ +### BEGIN INIT INFO +# Provides: umountnfs +# Required-Start: +# Required-Stop: umountfs +# Should-Stop: $network $portmap +# Default-Start: +# Default-Stop: 0 6 +# Short-Description: Unmount all network filesystems +### END INIT INFO + +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/meta/recipes-core/initscripts/initscripts-1.0/urandom b/meta/recipes-core/initscripts/initscripts-1.0/urandom new file mode 100755 index 0000000000..b6d807cf3b --- /dev/null +++ b/meta/recipes-core/initscripts/initscripts-1.0/urandom @@ -0,0 +1,46 @@ +#! /bin/sh +### BEGIN INIT INFO +# Provides: urandom +# Required-Start: $local_fs mountvirtfs +# Required-Stop: $local_fs +# Default-Start: S +# Default-Stop: 0 6 +# Short-Description: Save and restore the random seed +# Description: Save the random seed on shutdown and restore it on boot, +# to ensure that the seed isn't predicable on startup +# (because the boot process is predictable) +### END INIT INFO + +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/meta/recipes-core/initscripts/initscripts-1.0/volatiles b/meta/recipes-core/initscripts/initscripts-1.0/volatiles new file mode 100644 index 0000000000..b2ae2794dc --- /dev/null +++ b/meta/recipes-core/initscripts/initscripts-1.0/volatiles @@ -0,0 +1,39 @@ +# 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 +l root root 0644 /etc/resolv.conf /var/run/resolv.conf +f root root 0644 /var/run/resolv.conf none + |