summaryrefslogtreecommitdiff
path: root/beagle/debian-rfs/etc/init.d
diff options
context:
space:
mode:
Diffstat (limited to 'beagle/debian-rfs/etc/init.d')
-rw-r--r--beagle/debian-rfs/etc/init.d/README60
-rwxr-xr-xbeagle/debian-rfs/etc/init.d/bootlogd96
-rwxr-xr-xbeagle/debian-rfs/etc/init.d/bootlogs76
-rwxr-xr-xbeagle/debian-rfs/etc/init.d/bootmisc.sh65
-rwxr-xr-xbeagle/debian-rfs/etc/init.d/checkfs.sh159
-rwxr-xr-xbeagle/debian-rfs/etc/init.d/checkroot.sh436
-rwxr-xr-xbeagle/debian-rfs/etc/init.d/halt83
-rwxr-xr-xbeagle/debian-rfs/etc/init.d/hostname.sh68
-rwxr-xr-xbeagle/debian-rfs/etc/init.d/hwclock.sh171
-rwxr-xr-xbeagle/debian-rfs/etc/init.d/hwclockfirst.sh172
-rwxr-xr-xbeagle/debian-rfs/etc/init.d/killprocs62
-rwxr-xr-xbeagle/debian-rfs/etc/init.d/mountall-bootclean.sh31
-rwxr-xr-xbeagle/debian-rfs/etc/init.d/mountall.sh88
-rwxr-xr-xbeagle/debian-rfs/etc/init.d/mountdevsubfs.sh76
-rwxr-xr-xbeagle/debian-rfs/etc/init.d/mountkernfs.sh83
-rwxr-xr-xbeagle/debian-rfs/etc/init.d/mountnfs-bootclean.sh31
-rwxr-xr-xbeagle/debian-rfs/etc/init.d/mountnfs.sh108
-rwxr-xr-xbeagle/debian-rfs/etc/init.d/mountoverflowtmp55
-rwxr-xr-xbeagle/debian-rfs/etc/init.d/mtab.sh180
-rwxr-xr-xbeagle/debian-rfs/etc/init.d/rc338
-rwxr-xr-xbeagle/debian-rfs/etc/init.d/rc.local41
-rwxr-xr-xbeagle/debian-rfs/etc/init.d/rcS8
-rwxr-xr-xbeagle/debian-rfs/etc/init.d/reboot38
-rwxr-xr-xbeagle/debian-rfs/etc/init.d/rmnologin59
-rwxr-xr-xbeagle/debian-rfs/etc/init.d/sendsigs126
-rwxr-xr-xbeagle/debian-rfs/etc/init.d/single35
-rw-r--r--beagle/debian-rfs/etc/init.d/skeleton159
-rwxr-xr-xbeagle/debian-rfs/etc/init.d/stop-bootlogd33
-rwxr-xr-xbeagle/debian-rfs/etc/init.d/stop-bootlogd-single51
-rwxr-xr-xbeagle/debian-rfs/etc/init.d/umountfs144
-rwxr-xr-xbeagle/debian-rfs/etc/init.d/umountnfs.sh108
-rwxr-xr-xbeagle/debian-rfs/etc/init.d/umountroot57
-rwxr-xr-xbeagle/debian-rfs/etc/init.d/urandom79
33 files changed, 3376 insertions, 0 deletions
diff --git a/beagle/debian-rfs/etc/init.d/README b/beagle/debian-rfs/etc/init.d/README
new file mode 100644
index 0000000..8477036
--- /dev/null
+++ b/beagle/debian-rfs/etc/init.d/README
@@ -0,0 +1,60 @@
+ Configuration of System V init under Debian GNU/Linux
+
+Most Unix versions have a file here that describes how the scripts
+in this directory work, and how the links in the /etc/rc?.d/ directories
+influence system startup/shutdown.
+
+For Debian, this information is contained in the policy manual, chapter
+"System run levels and init.d scripts". The Debian Policy Manual is
+available at:
+
+ http://www.debian.org/doc/debian-policy/#contents
+
+The Debian Policy Manual is also available in the Debian package
+"debian-policy". When this package is installed, the policy manual can be
+found in directory /usr/share/doc/debian-policy. If you have a browser
+installed you can probably read it at
+
+ file://localhost/usr/share/doc/debian-policy/
+
+Some more detailed information can also be found in the files in the
+/usr/share/doc/sysv-rc directory.
+
+Debian Policy dictates that /etc/init.d/*.sh scripts must work properly
+when sourced. The following additional rules apply:
+
+* /etc/init.d/*.sh scripts must not rely for their correct functioning
+ on their being sourced rather than executed. That is, they must work
+ properly when executed too. They must include "#!/bin/sh" at the top.
+ This is useful when running scripts in parallel.
+
+* /etc/init.d/*.sh scripts must conform to the rules for sh scripts as
+ spelled out in the Debian policy section entitled "Scripts" (ยง10.4).
+
+Use the update-rc.d command to create symbolic links in the /etc/rc?.d
+as appropriate. See that man page for more details.
+
+All init.d scripts are expected to have a LSB style header documenting
+dependencies and default runlevel settings. The header look like this
+(not all fields are required):
+
+### BEGIN INIT INFO
+# Provides: skeleton
+# Required-Start: $remote_fs $syslog
+# Required-Stop: $remote_fs $syslog
+# Should-Start: $portmap
+# Should-Stop: $portmap
+# X-Start-Before: nis
+# X-Stop-After: nis
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# X-Interactive: true
+# Short-Description: Example initscript
+# Description: This file should be used to construct scripts to be
+# placed in /etc/init.d.
+### END INIT INFO
+
+More information on the format is available from insserv(8). This
+information is used to dynamicaly assign sequence numbers to the
+boot scripts and to run the scripts in parallel during the boot.
+See also /usr/share/doc/insserv/README.Debian.
diff --git a/beagle/debian-rfs/etc/init.d/bootlogd b/beagle/debian-rfs/etc/init.d/bootlogd
new file mode 100755
index 0000000..b688796
--- /dev/null
+++ b/beagle/debian-rfs/etc/init.d/bootlogd
@@ -0,0 +1,96 @@
+#! /bin/sh
+### BEGIN INIT INFO
+# Provides: bootlogd
+# Required-Start: mountdevsubfs
+# X-Start-Before: hostname keymap keyboard-setup procps pcmcia hwclock hwclockfirst hdparm hibernate-cleanup lvm2
+# Required-Stop:
+# Default-Start: S
+# Default-Stop:
+# Short-Description: Start or stop bootlogd.
+# Description: Starts or stops the bootlogd log program
+# which logs boot messages.
+### END INIT INFO
+
+PATH=/sbin:/bin # No remote fs at start
+DAEMON=/sbin/bootlogd
+[ -x "$DAEMON" ] || exit 0
+NAME=bootlogd
+DESC="boot logger"
+BOOTLOGD_OPTS="-r -c"
+[ -r /etc/default/bootlogd ] && . /etc/default/bootlogd
+. /lib/init/vars.sh
+
+. /lib/lsb/init-functions
+
+# Because bootlogd is broken on some systems, we take the special measure
+# of requiring it to be enabled by setting an environment variable.
+case "$BOOTLOGD_ENABLE" in
+ [Nn]*)
+ exit 0
+ ;;
+esac
+
+# Previously this script was symlinked as "stop-bootlogd" which, when run
+# with the "start" argument, should stop bootlogd. Now stop-bootlogd is
+# a distinct script, but for backward compatibility this script continues
+# to implement the old behavior.
+SCRIPTNAME=${0##*/}
+SCRIPTNAME=${SCRIPTNAME#[SK]??}
+ACTION="$1"
+case "$0" in
+ *stop-bootlog*)
+ [ "$ACTION" = start ] && ACTION=stop
+ ;;
+esac
+
+case "$ACTION" in
+ start)
+ # PATH is set above
+ [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
+ if [ -d /proc/1/. ]
+ then
+ umask 027
+ start-stop-daemon --start --quiet --exec $DAEMON -- \
+ $BOOTLOGD_OPTS
+ ES=$?
+ else
+ $DAEMON $BOOTLOGD_OPTS
+ ES=$?
+ fi
+ [ "$VERBOSE" != no ] && log_end_msg $ES
+ ;;
+ stop)
+ PATH=/bin:/sbin:/usr/bin:/usr/sbin
+ [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
+ start-stop-daemon --oknodo --stop --quiet --exec $DAEMON
+ ES=$?
+ sleep 1
+ [ "$VERBOSE" != no ] && log_end_msg $ES
+ if [ -f /var/log/boot ] && [ -f /var/log/boot~ ]
+ then
+ [ "$VERBOSE" = no ] || log_action_begin_msg "Moving boot log file"
+ # bootlogd writes to boot, making backup at boot~
+ cd /var/log && {
+ chgrp adm boot || :
+ savelog -q -p -c 5 boot \
+ && mv boot.0 boot \
+ && mv boot~ boot.0
+ }
+ ES=$?
+ [ "$VERBOSE" = no ] || log_action_end_msg $ES
+ fi
+ ;;
+ restart|force-reload)
+ /etc/init.d/bootlogd stop
+ /etc/init.d/bootlogd start
+ ;;
+ status)
+ status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
+ ;;
+ *)
+ echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload|status}" >&2
+ exit 3
+ ;;
+esac
+
+:
diff --git a/beagle/debian-rfs/etc/init.d/bootlogs b/beagle/debian-rfs/etc/init.d/bootlogs
new file mode 100755
index 0000000..769e644
--- /dev/null
+++ b/beagle/debian-rfs/etc/init.d/bootlogs
@@ -0,0 +1,76 @@
+#!/bin/sh
+### BEGIN INIT INFO
+# Provides: bootlogs
+# Required-Start: hostname $local_fs
+# Required-Stop:
+# Should-Start: $x-display-manager gdm kdm xdm ldm sdm wdm nodm
+# Default-Start: 1 2 3 4 5
+# Default-Stop:
+# Short-Description: Log file handling to be done during bootup.
+# Description: Various things that don't need to be done particularly
+# early in the boot, just before getty is run.
+### END INIT INFO
+
+PATH=/sbin:/usr/sbin:/bin:/usr/bin
+[ "$DELAYLOGIN" ] || DELAYLOGIN=yes
+. /lib/init/vars.sh
+
+do_start () {
+ # Update motd
+ uname -snrvm > /var/run/motd
+ [ -f /etc/motd.tail ] && cat /etc/motd.tail >> /var/run/motd
+
+ # Save kernel messages in /var/log/dmesg
+ if which dmesg >/dev/null 2>&1
+ then
+ [ -f /var/log/dmesg ] && savelog -q -p -c 5 /var/log/dmesg
+ dmesg -s 524288 > /var/log/dmesg
+ chgrp adm /var/log/dmesg || :
+ elif [ -c /dev/klog ]
+ then
+ [ -f /var/log/dmesg ] && savelog -q -p -c 5 /var/log/dmesg
+ dd if=/dev/klog of=/var/log/dmesg &
+ sleep 1
+ kill $!
+ [ -f /var/log/dmesg ] && { chgrp adm /var/log/dmesg || : ; }
+ fi
+
+ #
+ # Save udev log in /var/log/udev
+ #
+ if [ -e /dev/.udev.log ]
+ then
+ mv -f /dev/.udev.log /var/log/udev
+ fi
+}
+
+do_status () {
+ if [ -f /var/run/motd ] && [ ! -f /dev/.udev.log ] ; then
+ return 0
+ else
+ return 4
+ fi
+}
+
+case "$1" in
+ start|"")
+ do_start
+ ;;
+ restart|reload|force-reload)
+ echo "Error: argument '$1' not supported" >&2
+ exit 3
+ ;;
+ stop)
+ # No-op
+ ;;
+ status)
+ do_status
+ exit $?
+ ;;
+ *)
+ echo "Usage: bootlogs [start|stop|status]" >&2
+ exit 3
+ ;;
+esac
+
+:
diff --git a/beagle/debian-rfs/etc/init.d/bootmisc.sh b/beagle/debian-rfs/etc/init.d/bootmisc.sh
new file mode 100755
index 0000000..334a14e
--- /dev/null
+++ b/beagle/debian-rfs/etc/init.d/bootmisc.sh
@@ -0,0 +1,65 @@
+#!/bin/sh
+### BEGIN INIT INFO
+# Provides: bootmisc
+# Required-Start: $remote_fs
+# Required-Stop:
+# Should-Start: udev
+# Default-Start: S
+# Default-Stop:
+# Short-Description: Miscellaneous things to be done during bootup.
+# Description: Some cleanup. Note, it need to run after mountnfs-bootclean.sh.
+### END INIT INFO
+
+PATH=/sbin:/usr/sbin:/bin:/usr/bin
+[ "$DELAYLOGIN" ] || DELAYLOGIN=yes
+. /lib/init/vars.sh
+
+do_start () {
+ #
+ # If login delaying is enabled then create the flag file
+ # which prevents logins before startup is complete
+ #
+ case "$DELAYLOGIN" in
+ Y*|y*)
+ echo "System bootup in progress - please wait" > /var/lib/initscripts/nologin
+ ;;
+ esac
+
+ # Create /var/run/utmp so we can login.
+ : > /var/run/utmp
+ if grep -q ^utmp: /etc/group
+ then
+ chmod 664 /var/run/utmp
+ chgrp utmp /var/run/utmp
+ fi
+
+ # Set pseudo-terminal access permissions.
+ if [ ! -e /dev/.udev ] && [ -c /dev/ttyp0 ]
+ then
+ chmod -f 666 /dev/tty[p-za-e][0-9a-f]
+ chown -f root:tty /dev/tty[p-za-e][0-9a-f]
+ fi
+
+ # Remove bootclean's flag files.
+ # Don't run bootclean again after this!
+ rm -f /tmp/.clean /var/run/.clean /var/lock/.clean
+}
+
+case "$1" in
+ start|"")
+ do_start
+ ;;
+ restart|reload|force-reload)
+ echo "Error: argument '$1' not supported" >&2
+ exit 3
+ ;;
+ stop)
+ # No-op
+ ;;
+ *)
+ echo "Usage: bootmisc.sh [start|stop]" >&2
+ exit 3
+ ;;
+esac
+
+:
diff --git a/beagle/debian-rfs/etc/init.d/checkfs.sh b/beagle/debian-rfs/etc/init.d/checkfs.sh
new file mode 100755
index 0000000..a290672
--- /dev/null
+++ b/beagle/debian-rfs/etc/init.d/checkfs.sh
@@ -0,0 +1,159 @@
+#! /bin/sh
+### BEGIN INIT INFO
+# Provides: checkfs
+# Required-Start: checkroot
+# Required-Stop:
+# Should-Start: mtab
+# Default-Start: S
+# Default-Stop:
+# X-Interactive: true
+# Short-Description: Check all filesystems.
+### END INIT INFO
+
+# Include /usr/bin in path to find on_ac_power if /usr/ is on the root
+# partition.
+PATH=/sbin:/bin:/usr/bin
+FSCK_LOGFILE=/var/log/fsck/checkfs
+[ "$FSCKFIX" ] || FSCKFIX=no
+. /lib/init/vars.sh
+
+. /lib/lsb/init-functions
+. /lib/init/splash-functions-base
+. /lib/init/usplash-fsck-functions.sh
+. /lib/init/swap-functions.sh
+
+do_start () {
+ # See if we're on AC Power. If not, we're not gonna run our
+ # check. If on_ac_power (in /usr/) is unavailable, behave as
+ # before and check all file systems needing it.
+
+# Disabled AC power check until fsck can be told to only check the
+# file system if it is corrupt when running on battery. (bug #526398)
+# if which on_ac_power >/dev/null 2>&1
+# then
+# on_ac_power >/dev/null 2>&1
+# if [ $? -eq 1 ]
+# then
+# [ "$VERBOSE" = no ] || log_success_msg "Running on battery power, so skipping file system check."
+# BAT=yes
+# fi
+# fi
+ BAT=""
+ fscheck="yes"
+
+ if [ -f /fastboot ] || grep -s -w -i "fastboot" /proc/cmdline
+ then
+ [ "$fscheck" = yes ] && log_warning_msg "Fast boot enabled, so skipping file system check."
+ fscheck=no
+ fi
+
+ #
+ # Check the rest of the file systems.
+ #
+ if [ "$fscheck" = yes ] && [ ! "$BAT" ] && [ "$FSCKTYPES" != "none" ]
+ then
+
+ # Execute swapon command again, in case there are lvm
+ # or md swap partitions. fsck can suck RAM.
+ swaponagain 'lvm and md'
+
+ if [ -f /forcefsck ] || grep -s -w -i "forcefsck" /proc/cmdline
+ then
+ force="-f"
+ else
+ force=""
+ fi
+ if [ "$FSCKFIX" = yes ]
+ then
+ fix="-y"
+ else
+ fix="-a"
+ fi
+ spinner="-C"
+ case "$TERM" in
+ dumb|network|unknown|"")
+ spinner=""
+ ;;
+ esac
+ [ "$(uname -m)" = s390 ] && spinner="" # This should go away
+ FSCKTYPES_OPT=""
+ [ "$FSCKTYPES" ] && FSCKTYPES_OPT="-t $FSCKTYPES"
+ handle_failed_fsck() {
+ log_failure_msg "File system check failed.
+A log is being saved in ${FSCK_LOGFILE} if that location is writable.
+Please repair the file system manually."
+ log_warning_msg "A maintenance shell will now be started.
+CONTROL-D will terminate this shell and resume system boot."
+ # Start a single user shell on the console
+ if ! sulogin $CONSOLE
+ then
+ log_failure_msg "Attempt to start maintenance shell failed.
+Continuing with system boot in 5 seconds."
+ sleep 5
+ fi
+ }
+ if [ "$VERBOSE" = no ]
+ then
+ log_action_begin_msg "Checking file systems"
+ if usplash_running; then
+ PROGRESS_FILE=`mktemp` || exit 1
+ set -m
+ logsave -s $FSCK_LOGFILE fsck -C3 -R -A $fix $force $FSCKTYPES_OPT >/dev/console 2>&1 3>$PROGRESS_FILE &
+ set +m
+ usplash_progress "$PROGRESS_FILE"
+ rm -f $PROGRESS_FILE
+ else
+ splash_start_indefinite
+ logsave -s $FSCK_LOGFILE fsck $spinner -R -A $fix $force $FSCKTYPES_OPT
+ FSCKCODE=$?
+ splash_stop_indefinite
+ fi
+
+ if [ "$FSCKCODE" -gt 1 ]
+ then
+ log_action_end_msg 1 "code $FSCKCODE"
+ handle_failed_fsck
+ else
+ log_action_end_msg 0
+ fi
+ else
+ if [ "$FSCKTYPES" ]
+ then
+ log_action_msg "Will now check all file systems of types $FSCKTYPES"
+ else
+ log_action_msg "Will now check all file systems"
+ fi
+ splash_start_indefinite
+ logsave -s $FSCK_LOGFILE fsck $spinner -V -R -A $fix $force $FSCKTYPES_OPT
+ FSCKCODE=$?
+ splash_stop_indefinite
+ if [ "$FSCKCODE" -gt 1 ]
+ then
+ handle_failed_fsck
+ else
+ log_success_msg "Done checking file systems.
+A log is being saved in ${FSCK_LOGFILE} if that location is writable."
+ fi
+ fi
+ fi
+ rm -f /fastboot /forcefsck 2>/dev/null
+}
+
+case "$1" in
+ start|"")
+ do_start
+ ;;
+ restart|reload|force-reload)
+ echo "Error: argument '$1' not supported" >&2
+ exit 3
+ ;;
+ stop)
+ # No-op
+ ;;
+ *)
+ echo "Usage: checkfs.sh [start|stop]" >&2
+ exit 3
+ ;;
+esac
+
+:
diff --git a/beagle/debian-rfs/etc/init.d/checkroot.sh b/beagle/debian-rfs/etc/init.d/checkroot.sh
new file mode 100755
index 0000000..df84d22
--- /dev/null
+++ b/beagle/debian-rfs/etc/init.d/checkroot.sh
@@ -0,0 +1,436 @@
+#! /bin/sh
+### BEGIN INIT INFO
+# Provides: checkroot
+# Required-Start: mountdevsubfs hostname
+# Required-Stop:
+# Should-Start: keymap hwclockfirst hdparm bootlogd
+# Should-stop:
+# Default-Start: S
+# Default-Stop:
+# X-Interactive: true
+# Short-Description: Check to root file system.
+### END INIT INFO
+
+# Include /usr/bin in path to find on_ac_power if /usr/ is on the root
+# partition.
+PATH=/sbin:/bin:/usr/bin
+FSCK_LOGFILE=/var/log/fsck/checkroot
+[ "$FSCKFIX" ] || FSCKFIX=no
+[ "$SULOGIN" ] || SULOGIN=no
+. /lib/init/vars.sh
+
+. /lib/lsb/init-functions
+. /lib/init/mount-functions.sh
+. /lib/init/splash-functions-base
+. /lib/init/usplash-fsck-functions.sh
+
+do_start () {
+ #
+ # 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 sysv does.
+ #
+ [ "$SULOGIN" = yes ] && sulogin -t 30 $CONSOLE
+
+ KERNEL="$(uname -s)"
+ MACHINE="$(uname -m)"
+
+ #
+ # Read /etc/fstab, looking for:
+ # 1) The root filesystem, resolving LABEL=*|UUID=* entries to the
+ # device node,
+ # 2) Swap that is on a md device or a file that may be on a md
+ # device,
+ #
+
+ exec 9<&0 </etc/fstab
+
+ fstabroot=/dev/root
+ rootdev=none
+ roottype=none
+ rootopts=defaults
+ rootmode=rw
+ rootcheck=no
+ swap_on_lv=no
+ swap_on_file=no
+
+ while read DEV MTPT FSTYPE OPTS DUMP PASS JUNK
+ do
+ case "$DEV" in
+ ""|\#*)
+ continue;
+ ;;
+ /dev/mapper/*)
+ [ "$FSTYPE" = "swap" ] && swap_on_lv=yes
+ ;;
+ /dev/*)
+ ;;
+ LABEL=*|UUID=*)
+ if [ "$MTPT" = "/" ] && [ -x /sbin/findfs ]
+ then
+ DEV="$(findfs "$DEV")"
+ fi
+ ;;
+ /*)
+ [ "$FSTYPE" = "swap" ] && swap_on_file=yes
+ ;;
+ *)
+ ;;
+ esac
+ [ "$MTPT" != "/" ] && continue
+ rootdev="$DEV"
+ fstabroot="$DEV"
+ rootopts="$OPTS"
+ roottype="$FSTYPE"
+ ( [ "$PASS" != 0 ] && [ "$PASS" != "" ] ) && rootcheck=yes
+ ( [ "$FSTYPE" = "nfs" ] || [ "$FSTYPE" = "nfs4" ] ) && 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.
+ #
+ ENABLE_SWAP=no
+ case "$KERNEL" in
+ Linux)
+ if [ "$NOSWAP" = yes ]
+ then
+ [ "$VERBOSE" = no ] || log_warning_msg "Not activating swap as requested via bootoption noswap."
+ ENABLE_SWAP=no
+ else
+ if [ "$swap_on_lv" = yes ]
+ then
+ [ "$VERBOSE" = no ] || log_warning_msg "Not activating swap on logical volume."
+ elif [ "$swap_on_file" = yes ]
+ then
+ [ "$VERBOSE" = no ] || log_warning_msg "Not activating swap on swapfile."
+ else
+ ENABLE_SWAP=yes
+ fi
+ fi
+ ;;
+ *)
+ ENABLE_SWAP=yes
+ ;;
+ esac
+ if [ "$ENABLE_SWAP" = yes ]
+ then
+ if [ "$VERBOSE" = no ]
+ then
+ log_action_begin_msg "Activating swap"
+ swapon -a -e >/dev/null 2>&1
+ log_action_end_msg $?
+ else
+ log_daemon_msg "Activating swap"
+ swapon -a -v
+ log_end_msg $?
+ fi
+ fi
+
+ #
+ # Does the root device in /etc/fstab match with the actual device ?
+ # If not we try to use the /dev/root alias device, and if that
+ # fails we create a temporary node in /lib/init/rw.
+ #
+ if [ "$rootcheck" = yes ]
+ then
+ ddev="$(mountpoint -qx $rootdev)"
+ rdev="$(mountpoint -d /)"
+ if [ "$ddev" != "$rdev" ] && [ "$ddev" != "4:0" ]
+ then
+ if [ "$(mountpoint -qx /dev/root)" = "4:0" ]
+ then
+ rootdev=/dev/root
+ else
+ if \
+ rm -f /lib/init/rw/rootdev \
+ && mknod -m 600 /lib/init/rw/rootdev b ${rdev%:*} ${rdev#*:} \
+ && [ -e /lib/init/rw/rootdev ]
+ then
+ rootdev=/lib/init/rw/rootdev
+ else
+ rootfatal=yes
+ fi
+ fi
+ fi
+ fi
+
+ #
+ # Bother, said Pooh.
+ #
+ if [ "$rootfatal" = yes ]
+ then
+ log_failure_msg "The device node $rootdev for the root filesystem is missing or incorrect
+or there is no entry for the root filesystem listed in /etc/fstab.
+The system is also unable to create a temporary node in /lib/init/rw.
+This means you have to fix the problem manually."
+ log_warning_msg "A maintenance shell will now be started.
+CONTROL-D will terminate this shell and restart the system."
+ # Start a single user shell on the console
+ if ! sulogin $CONSOLE
+ then
+ log_failure_msg "Attempt to start maintenance shell failed.
+Will restart in 5 seconds."
+ sleep 5
+ fi
+ [ "$VERBOSE" = no ] || log_action_msg "Will now restart"
+ reboot -f
+ fi
+
+ # See if we're on AC Power. If not, we're not gonna run our
+ # check. If on_ac_power (in /usr/) is unavailable, behave as
+ # before and check all file systems needing it.
+# Disabled AC power check until fsck can be told to only check the
+# file system if it is corrupt when running on battery. (bug #526398)
+# if which on_ac_power >/dev/null 2>&1 && [ "$rootcheck" = yes ]
+# then
+# on_ac_power >/dev/null 2>&1
+# if [ "$?" -eq 1 ]
+# then
+# log_warning_msg "On battery power, so skipping file system check."
+# rootcheck=no
+# fi
+# fi
+
+ #
+ # See if we want to check the root file system.
+ #
+ FSCKCODE=0
+ if [ -f /fastboot ] || grep -s -w -i "fastboot" /proc/cmdline
+ then
+ [ "$rootcheck" = yes ] && log_warning_msg "Fast boot enabled, so skipping root file system check."
+ rootcheck=no
+ fi
+
+ if [ "$rootcheck" = yes ]
+ then
+ #
+ # Ensure that root is quiescent and read-only before fsck'ing.
+ #
+ # mount -n -o remount,ro / would be the correct syntax but
+ # mount can get confused when there is a "bind" mount defined
+ # in fstab that bind-mounts "/" somewhere else.
+ #
+ # So we use mount -n -o remount,ro $rootdev / but that can
+ # fail on older kernels on sparc64/alpha architectures due
+ # to a bug in sys_mount().
+ #
+ # As a compromise we try both.
+ #
+ if \
+ ! mount -n -o remount,ro $rootdev / \
+ && ! mount -n -o remount,ro -t dummytype $rootdev / 2>/dev/null \
+ && ! mount -n -o remount,ro / 2>/dev/null
+ then
+ log_failure_msg "Cannot check root file system because it is not mounted read-only."
+ rootcheck=no
+ fi
+ fi
+
+ #
+ # The actual checking is done here.
+ #
+ if [ "$rootcheck" = yes ]
+ then
+ if [ -f /forcefsck ] || grep -s -w -i "forcefsck" /proc/cmdline
+ then
+ force="-f"
+ else
+ force=""
+ fi
+
+ if [ "$FSCKFIX" = yes ]
+ then
+ fix="-y"
+ else
+ fix="-a"
+ fi
+
+ spinner="-C"
+ case "$TERM" in
+ dumb|network|unknown|"")
+ spinner="" ;;
+ esac
+ # This Linux/s390 special case should go away.
+ if [ "${KERNEL}:${MACHINE}" = Linux:s390 ]
+ then
+ spinner=""
+ fi
+
+ if [ "$VERBOSE" = no ]
+ then
+ log_action_begin_msg "Checking root file system"
+ if [ "$roottype" = "ext2" -o "$roottype" = "ext3" -o "$roottype" = "ext4" ] && usplash_running; then
+ PROGRESS_FILE=`mktemp -p /lib/init/rw` || PROGRESS_FILE=/lib/init/rw/checkroot_fsck
+ set -m
+ logsave -s $FSCK_LOGFILE fsck -C3 $force $fix -t $roottype $rootdev >/dev/console 2>&1 3>$PROGRESS_FILE &
+ set +m
+ usplash_progress "$PROGRESS_FILE"
+ rm -f $PROGRESS_FILE
+ else
+ splash_start_indefinite
+ logsave -s $FSCK_LOGFILE fsck $spinner $force $fix -t $roottype $rootdev
+ FSCKCODE=$?
+ splash_stop_indefinite
+ fi
+ if [ "$FSCKCODE" = 0 ]
+ then
+ log_action_end_msg 0
+ else
+ log_action_end_msg 1 "code $FSCKCODE"
+ fi
+ else
+ splash_start_indefinite
+ log_daemon_msg "Will now check root file system"
+ logsave -s $FSCK_LOGFILE fsck $spinner $force $fix -V -t $roottype $rootdev
+ FSCKCODE=$?
+ log_end_msg $FSCKCODE
+ splash_stop_indefinite
+ fi
+ fi
+
+ #
+ # If there was a failure, drop into single-user mode.
+ #
+ # NOTE: "failure" is defined as exiting with a return code of
+ # 4 or larger. A return code of 1 indicates that file system
+ # errors were corrected but that the boot may proceed. A return
+ # code of 2 or 3 indicates that the system should immediately reboot.
+ #
+ if [ "$FSCKCODE" -gt 3 ]
+ then
+ # Surprise! Re-directing from a HERE document (as in "cat << EOF")
+ # does not work because the root is currently read-only.
+ log_failure_msg "An automatic file system check (fsck) of the root filesystem failed.
+A manual fsck must be performed, then the system restarted.
+The fsck should be performed in maintenance mode with the
+root filesystem mounted in read-only mode."
+ log_warning_msg "The root filesystem is currently mounted in read-only mode.
+A maintenance shell will now be started.
+After performing system maintenance, press CONTROL-D
+to terminate the maintenance shell and restart the system."
+ # Start a single user shell on the console
+ if ! sulogin $CONSOLE
+ then
+ log_failure_msg "Attempt to start maintenance shell failed.
+Will restart in 5 seconds."
+ sleep 5
+ fi
+ [ "$VERBOSE" = no ] || log_action_msg "Will now restart"
+ reboot -f
+ elif [ "$FSCKCODE" -gt 1 ]
+ then
+ log_failure_msg "The file system check corrected errors on the root partition
+but requested that the system be restarted."
+ log_warning_msg "The system will be restarted in 5 seconds."
+ sleep 5
+ [ "$VERBOSE" = no ] || log_action_msg "Will now restart"
+ reboot -f
+ fi
+
+ #
+ # Remount root to final mode (rw or ro).
+ #
+ # See the comments above at the previous "mount -o remount"
+ # for an explanation why we try this twice.
+ #
+ if ! mount -n -o remount,$rootopts,$rootmode $fstabroot / 2>/dev/null
+ then
+ mount -n -o remount,$rootopts,$rootmode /
+ fi
+
+ #
+ # We only create/modify /etc/mtab if the location where it is
+ # stored is writable. If /etc/mtab is a symlink into /proc/
+ # then it is not writable.
+ #
+ INIT_MTAB_FILE=no
+ MTAB_PATH="$(readlink -f /etc/mtab || :)"
+ case "$MTAB_PATH" in
+ /proc/*)
+ ;;
+ /*)
+ if touch "$MTAB_PATH" >/dev/null 2>&1
+ then
+ :> "$MTAB_PATH"
+ rm -f ${MTAB_PATH}~
+ INIT_MTAB_FILE=yes
+ fi
+ ;;
+ "")
+ [ -L /etc/mtab ] && MTAB_PATH="$(readlink /etc/mtab)"
+ if [ "$MTAB_PATH" ]
+ then
+ log_failure_msg "Cannot initialize ${MTAB_PATH}."
+ else
+ log_failure_msg "Cannot initialize /etc/mtab."
+ fi
+ ;;
+ *)
+ log_failure_msg "Illegal mtab location '${MTAB_PATH}'."
+ ;;
+ esac
+
+ if [ "$INIT_MTAB_FILE" = yes ]
+ then
+ [ "$roottype" != none ] &&
+ mount -f -o $rootopts -t $roottype $fstabroot /
+ fi
+
+ #
+ # Remove /lib/init/rw/rootdev if we created it.
+ #
+ rm -f /lib/init/rw/rootdev
+}
+
+do_status () {
+ # If / is read-write or swap is enabled, this script have done
+ # its job.
+ rootrw=false
+ swapon=false
+ if [ -f /etc/mtab ] ; then
+ if grep " / " /etc/mtab |grep -q rw ; then
+ rootrw=true
+ fi
+ fi
+ if [ -f /proc/swaps ] ; then
+ if [ "$(cat /proc/swaps |grep -v ^Filename)" ] ; then
+ swapon=true
+ fi
+ fi
+ if [ true = "$rootrw" ] || [ true = "$swapon" ] ; then
+ return 0
+ else
+ return 4
+ fi
+}
+
+case "$1" in
+ start|"")
+ do_start
+ ;;
+ restart|reload|force-reload)
+ echo "Error: argument '$1' not supported" >&2
+ exit 3
+ ;;
+ stop)
+ # No-op
+ ;;
+ status)
+ do_status
+ exit $?
+ ;;
+ *)
+ echo "Usage: checkroot.sh [start|stop]" >&2
+ exit 3
+ ;;
+esac
+
+:
diff --git a/beagle/debian-rfs/etc/init.d/halt b/beagle/debian-rfs/etc/init.d/halt
new file mode 100755
index 0000000..3b359fe
--- /dev/null
+++ b/beagle/debian-rfs/etc/init.d/halt
@@ -0,0 +1,83 @@
+#! /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
+
+NETDOWN=yes
+
+PATH=/sbin:/usr/sbin:/bin:/usr/bin
+[ -f /etc/default/halt ] && . /etc/default/halt
+
+. /lib/lsb/init-functions
+
+do_stop () {
+ if [ "$INIT_HALT" = "" ]
+ then
+ case "$HALT" in
+ [Pp]*)
+ INIT_HALT=POWEROFF
+ ;;
+ [Hh]*)
+ INIT_HALT=HALT
+ ;;
+ *)
+ INIT_HALT=POWEROFF
+ ;;
+ esac
+ fi
+
+ # See if we need to cut the power.
+ if [ "$INIT_HALT" = "POWEROFF" ] && [ -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
+
+ # If INIT_HALT=HALT don't poweroff.
+ poweroff="-p"
+ if [ "$INIT_HALT" = "HALT" ]
+ then
+ poweroff=""
+ fi
+
+ # Make it possible to not shut down network interfaces,
+ # needed to use wake-on-lan
+ netdown="-i"
+ if [ "$NETDOWN" = "no" ]; then
+ netdown=""
+ fi
+
+ log_action_msg "Will now halt"
+ halt -d -f $netdown $poweroff $hddown
+}
+
+case "$1" in
+ start)
+ # No-op
+ ;;
+ restart|reload|force-reload)
+ echo "Error: argument '$1' not supported" >&2
+ exit 3
+ ;;
+ stop)
+ do_stop
+ ;;
+ *)
+ echo "Usage: $0 start|stop" >&2
+ exit 3
+ ;;
+esac
+
+:
diff --git a/beagle/debian-rfs/etc/init.d/hostname.sh b/beagle/debian-rfs/etc/init.d/hostname.sh
new file mode 100755
index 0000000..61eb5ea
--- /dev/null
+++ b/beagle/debian-rfs/etc/init.d/hostname.sh
@@ -0,0 +1,68 @@
+#! /bin/sh
+### BEGIN INIT INFO
+# Provides: hostname
+# Required-Start:
+# Required-Stop:
+# Should-Start: glibc
+# Default-Start: S
+# Default-Stop:
+# Short-Description: Set hostname based on /etc/hostname
+# Description: Read the machines hostname from /etc/hostname, and
+# update the kernel value with this value. If
+# /etc/hostname is empty, the current kernel value
+# for hostname is used. If the kernel value is
+# empty, the value 'localhost' is used.
+### END INIT INFO
+
+PATH=/sbin:/bin
+
+. /lib/init/vars.sh
+. /lib/lsb/init-functions
+
+do_start () {
+ [ -f /etc/hostname ] && HOSTNAME="$(cat /etc/hostname)"
+
+ # Keep current name if /etc/hostname is missing.
+ [ -z "$HOSTNAME" ] && HOSTNAME="$(hostname)"
+
+ # And set it to 'localhost' if no setting was found
+ [ -z "$HOSTNAME" ] && HOSTNAME=localhost
+
+ [ "$VERBOSE" != no ] && log_action_begin_msg "Setting hostname to '$HOSTNAME'"
+ hostname "$HOSTNAME"
+ ES=$?
+ [ "$VERBOSE" != no ] && log_action_end_msg $ES
+ exit $ES
+}
+
+do_status () {
+ HOSTNAME=$(hostname)
+ if [ "$HOSTNAME" ] ; then
+ return 0
+ else
+ return 4
+ fi
+}
+
+case "$1" in
+ start|"")
+ do_start
+ ;;
+ restart|reload|force-reload)
+ echo "Error: argument '$1' not supported" >&2
+ exit 3
+ ;;
+ stop)
+ # No-op
+ ;;
+ status)
+ do_status
+ exit $?
+ ;;
+ *)
+ echo "Usage: hostname.sh [start|stop]" >&2
+ exit 3
+ ;;
+esac
+
+:
diff --git a/beagle/debian-rfs/etc/init.d/hwclock.sh b/beagle/debian-rfs/etc/init.d/hwclock.sh
new file mode 100755
index 0000000..d500287
--- /dev/null
+++ b/beagle/debian-rfs/etc/init.d/hwclock.sh
@@ -0,0 +1,171 @@
+#!/bin/sh
+# hwclock.sh Set and adjust the CMOS clock, according to the UTC
+# setting in /etc/default/rcS (see also rcS(5)).
+#
+# Version: @(#)hwclock.sh 2.00 14-Dec-1998 miquels@cistron.nl
+#
+# Patches:
+# 2000-01-30 Henrique M. Holschuh <hmh@rcm.org.br>
+# - Minor cosmetic changes in an attempt to help new
+# users notice something IS changing their clocks
+# during startup/shutdown.
+# - Added comments to alert users of hwclock issues
+# and discourage tampering without proper doc reading.
+
+# WARNING: Please read /usr/share/doc/util-linux/README.Debian.hwclock
+# before changing this file. You risk serious clock
+# misbehaviour otherwise.
+
+### BEGIN INIT INFO
+# Provides: hwclock
+# Required-Start: checkroot
+# Required-Stop: $local_fs
+# Default-Start: S
+# Default-Stop: 0 6
+### END INIT INFO
+
+FIRST=no # debian/rules sets this to 'yes' when creating hwclockfirst.sh
+
+# Set this to any options you might need to give to hwclock, such
+# as machine hardware clock type for Alphas.
+HWCLOCKPARS=
+
+# Set this to the hardware clock device you want to use, it should
+# probably match the CONFIG_RTC_HCTOSYS_DEVICE kernel config option.
+HCTOSYS_DEVICE=rtc0
+
+hwclocksh()
+{
+ [ ! -x /sbin/hwclock ] && return 0
+ [ ! -r /etc/default/rcS ] || . /etc/default/rcS
+
+ . /lib/lsb/init-functions
+ verbose_log_action_msg() { [ "$VERBOSE" = no ] || log_action_msg "$@"; }
+
+ [ "$GMT" = "-u" ] && UTC="yes"
+ case "$UTC" in
+ no|"") GMT="--localtime"
+ UTC=""
+ if [ "X$FIRST" = "Xyes" ] && [ ! -r /etc/localtime ]; then
+ if [ -z "$TZ" ]; then
+ log_action_msg "System clock was not updated at this time"
+ return 1
+ fi
+ fi
+ ;;
+ yes) GMT="--utc"
+ UTC="--utc"
+ ;;
+ *) log_action_msg "Unknown UTC setting: \"$UTC\""; return 1 ;;
+ esac
+
+ case "$BADYEAR" in
+ no|"") BADYEAR="" ;;
+ yes) BADYEAR="--badyear" ;;
+ *) log_action_msg "unknown BADYEAR setting: \"$BADYEAR\""; return 1 ;;
+ esac
+
+ case "$1" in
+ start)
+ if [ -d /dev/.udev ]; then
+ return 0
+ fi
+
+ if [ -w /etc ] && [ ! -f /etc/adjtime ] && [ ! -e /etc/adjtime ]; then
+ echo "0.0 0 0.0" > /etc/adjtime
+ fi
+
+ if [ ! -w /etc/adjtime ]; then
+ NOADJ="--noadjfile"
+ else
+ NOADJ=""
+ fi
+
+ if [ "$FIRST" != yes ]; then
+ # Uncomment the hwclock --adjust line below if you want
+ # hwclock to try to correct systematic drift errors in the
+ # Hardware Clock.
+ #
+ # WARNING: If you uncomment this option, you must either make
+ # sure *nothing* changes the Hardware Clock other than
+ # hwclock --systohc, or you must delete /etc/adjtime
+ # every time someone else modifies the Hardware Clock.
+ #
+ # Common "vilains" are: ntp, MS Windows, the BIOS Setup
+ # program.
+ #
+ # WARNING: You must remember to invalidate (delete)
+ # /etc/adjtime if you ever need to set the system clock
+ # to a very different value and hwclock --adjust is being
+ # used.
+ #
+ # Please read /usr/share/doc/util-linux/README.Debian.hwclock
+ # before enabling hwclock --adjust.
+
+ #/sbin/hwclock --rtc=/dev/$HCTOSYS_DEVICE --adjust $GMT $BADYEAR
+ :
+ fi
+
+ if [ "$HWCLOCKACCESS" != no ]; then
+ log_action_msg "Setting the system clock"
+
+ # Copies Hardware Clock time to System Clock using the correct
+ # timezone for hardware clocks in local time, and sets kernel
+ # timezone. DO NOT REMOVE.
+ if /sbin/hwclock --rtc=/dev/$HCTOSYS_DEVICE --hctosys $GMT $HWCLOCKPARS $BADYEAR $NOADJ; then
+ # Announce the local time.
+ verbose_log_action_msg "System Clock set to: `date $UTC`"
+ else
+ log_warning_msg "Unable to set System Clock to: `date $UTC`"
+ fi
+ else
+ verbose_log_action_msg "Not setting System Clock"
+ fi
+ ;;
+ stop|restart|reload|force-reload)
+ #
+ # Updates the Hardware Clock with the System Clock time.
+ # This will *override* any changes made to the Hardware Clock.
+ #
+ # WARNING: If you disable this, any changes to the system
+ # clock will not be carried across reboots.
+ #
+ if [ ! -w /etc/adjtime ]; then
+ NOADJ="--noadjfile"
+ else
+ NOADJ=""
+ fi
+
+ if [ "$HWCLOCKACCESS" != no ]; then
+ log_action_msg "Saving the system clock"
+ if [ "$GMT" = "-u" ]; then
+ GMT="--utc"
+ fi
+ if /sbin/hwclock --rtc=/dev/$HCTOSYS_DEVICE --systohc $GMT $HWCLOCKPARS $BADYEAR $NOADJ; then
+ verbose_log_action_msg "Hardware Clock updated to `date`"
+ fi
+ else
+ verbose_log_action_msg "Not saving System Clock"
+ fi
+ ;;
+ show)
+ if [ ! -w /etc/adjtime ]; then
+ NOADJ="--noadjfile"
+ else
+ NOADJ=""
+ fi
+
+ if [ "$HWCLOCKACCESS" != no ]; then
+ /sbin/hwclock --rtc=/dev/$HCTOSYS_DEVICE --show $GMT $HWCLOCKPARS $BADYEAR $NOADJ
+ fi
+ ;;
+ *)
+ log_success_msg "Usage: hwclock.sh {start|stop|reload|force-reload|show}"
+ log_success_msg " start sets kernel (system) clock from hardware (RTC) clock"
+ log_success_msg " stop and reload set hardware (RTC) clock from kernel (system) clock"
+ return 1
+ ;;
+ esac
+}
+
+hwclocksh "$@"
diff --git a/beagle/debian-rfs/etc/init.d/hwclockfirst.sh b/beagle/debian-rfs/etc/init.d/hwclockfirst.sh
new file mode 100755
index 0000000..75a330a
--- /dev/null
+++ b/beagle/debian-rfs/etc/init.d/hwclockfirst.sh
@@ -0,0 +1,172 @@
+#!/bin/sh
+# hwclock.sh Set and adjust the CMOS clock, according to the UTC
+# setting in /etc/default/rcS (see also rcS(5)).
+#
+# Version: @(#)hwclock.sh 2.00 14-Dec-1998 miquels@cistron.nl
+#
+# Patches:
+# 2000-01-30 Henrique M. Holschuh <hmh@rcm.org.br>
+# - Minor cosmetic changes in an attempt to help new
+# users notice something IS changing their clocks
+# during startup/shutdown.
+# - Added comments to alert users of hwclock issues
+# and discourage tampering without proper doc reading.
+
+# WARNING: Please read /usr/share/doc/util-linux/README.Debian.hwclock
+# before changing this file. You risk serious clock
+# misbehaviour otherwise.
+
+### BEGIN INIT INFO
+# Provides: hwclockfirst
+# Required-Start: mountdevsubfs
+# Required-Stop:
+# Default-Start: S
+# X-Start-Before: checkroot
+# Default-Stop:
+### END INIT INFO
+
+FIRST=yes # debian/rules sets this to 'yes' when creating hwclockfirst.sh
+
+# Set this to any options you might need to give to hwclock, such
+# as machine hardware clock type for Alphas.
+HWCLOCKPARS=
+
+# Set this to the hardware clock device you want to use, it should
+# probably match the CONFIG_RTC_HCTOSYS_DEVICE kernel config option.
+HCTOSYS_DEVICE=rtc0
+
+hwclocksh()
+{
+ [ ! -x /sbin/hwclock ] && return 0
+ [ ! -r /etc/default/rcS ] || . /etc/default/rcS
+
+ . /lib/lsb/init-functions
+ verbose_log_action_msg() { [ "$VERBOSE" = no ] || log_action_msg "$@"; }
+
+ [ "$GMT" = "-u" ] && UTC="yes"
+ case "$UTC" in
+ no|"") GMT="--localtime"
+ UTC=""
+ if [ "X$FIRST" = "Xyes" ] && [ ! -r /etc/localtime ]; then
+ if [ -z "$TZ" ]; then
+ log_action_msg "System clock was not updated at this time"
+ return 1
+ fi
+ fi
+ ;;
+ yes) GMT="--utc"
+ UTC="--utc"
+ ;;
+ *) log_action_msg "Unknown UTC setting: \"$UTC\""; return 1 ;;
+ esac
+
+ case "$BADYEAR" in
+ no|"") BADYEAR="" ;;
+ yes) BADYEAR="--badyear" ;;
+ *) log_action_msg "unknown BADYEAR setting: \"$BADYEAR\""; return 1 ;;
+ esac
+
+ case "$1" in
+ start)
+ if [ -d /dev/.udev ]; then
+ return 0
+ fi
+
+ if [ -w /etc ] && [ ! -f /etc/adjtime ] && [ ! -e /etc/adjtime ]; then
+ echo "0.0 0 0.0" > /etc/adjtime
+ fi
+
+ if [ ! -w /etc/adjtime ]; then
+ NOADJ="--noadjfile"
+ else
+ NOADJ=""
+ fi
+
+ if [ "$FIRST" != yes ]; then
+ # Uncomment the hwclock --adjust line below if you want
+ # hwclock to try to correct systematic drift errors in the
+ # Hardware Clock.
+ #
+ # WARNING: If you uncomment this option, you must either make
+ # sure *nothing* changes the Hardware Clock other than
+ # hwclock --systohc, or you must delete /etc/adjtime
+ # every time someone else modifies the Hardware Clock.
+ #
+ # Common "vilains" are: ntp, MS Windows, the BIOS Setup
+ # program.
+ #
+ # WARNING: You must remember to invalidate (delete)
+ # /etc/adjtime if you ever need to set the system clock
+ # to a very different value and hwclock --adjust is being
+ # used.
+ #
+ # Please read /usr/share/doc/util-linux/README.Debian.hwclock
+ # before enabling hwclock --adjust.
+
+ #/sbin/hwclock --rtc=/dev/$HCTOSYS_DEVICE --adjust $GMT $BADYEAR
+ :
+ fi
+
+ if [ "$HWCLOCKACCESS" != no ]; then
+ log_action_msg "Setting the system clock"
+
+ # Copies Hardware Clock time to System Clock using the correct
+ # timezone for hardware clocks in local time, and sets kernel
+ # timezone. DO NOT REMOVE.
+ if /sbin/hwclock --rtc=/dev/$HCTOSYS_DEVICE --hctosys $GMT $HWCLOCKPARS $BADYEAR $NOADJ; then
+ # Announce the local time.
+ verbose_log_action_msg "System Clock set to: `date $UTC`"
+ else
+ log_warning_msg "Unable to set System Clock to: `date $UTC`"
+ fi
+ else
+ verbose_log_action_msg "Not setting System Clock"
+ fi
+ ;;
+ stop|restart|reload|force-reload)
+ #
+ # Updates the Hardware Clock with the System Clock time.
+ # This will *override* any changes made to the Hardware Clock.
+ #
+ # WARNING: If you disable this, any changes to the system
+ # clock will not be carried across reboots.
+ #
+ if [ ! -w /etc/adjtime ]; then
+ NOADJ="--noadjfile"
+ else
+ NOADJ=""
+ fi
+
+ if [ "$HWCLOCKACCESS" != no ]; then
+ log_action_msg "Saving the system clock"
+ if [ "$GMT" = "-u" ]; then
+ GMT="--utc"
+ fi
+ if /sbin/hwclock --rtc=/dev/$HCTOSYS_DEVICE --systohc $GMT $HWCLOCKPARS $BADYEAR $NOADJ; then
+ verbose_log_action_msg "Hardware Clock updated to `date`"
+ fi
+ else
+ verbose_log_action_msg "Not saving System Clock"
+ fi
+ ;;
+ show)
+ if [ ! -w /etc/adjtime ]; then
+ NOADJ="--noadjfile"
+ else
+ NOADJ=""
+ fi
+
+ if [ "$HWCLOCKACCESS" != no ]; then
+ /sbin/hwclock --rtc=/dev/$HCTOSYS_DEVICE --show $GMT $HWCLOCKPARS $BADYEAR $NOADJ
+ fi
+ ;;
+ *)
+ log_success_msg "Usage: hwclock.sh {start|stop|reload|force-reload|show}"
+ log_success_msg " start sets kernel (system) clock from hardware (RTC) clock"
+ log_success_msg " stop and reload set hardware (RTC) clock from kernel (system) clock"
+ return 1
+ ;;
+ esac
+}
+
+hwclocksh "$@"
diff --git a/beagle/debian-rfs/etc/init.d/killprocs b/beagle/debian-rfs/etc/init.d/killprocs
new file mode 100755
index 0000000..6cb5b91
--- /dev/null
+++ b/beagle/debian-rfs/etc/init.d/killprocs
@@ -0,0 +1,62 @@
+#! /bin/sh
+### BEGIN INIT INFO
+# Provides: killprocs
+# Required-Start: $local_fs
+# Required-Stop:
+# Default-Start: 1
+# Default-Stop:
+# Short-Description: executed by init(8) upon entering runlevel 1 (single).
+### END INIT INFO
+
+PATH=/sbin:/usr/sbin:/bin:/usr/bin
+
+. /lib/lsb/init-functions
+
+do_start () {
+ # Kill all processes.
+ log_action_begin_msg "Asking all remaining processes to terminate"
+ killall5 -15 # SIGTERM
+ log_action_end_msg 0
+ alldead=""
+ for seq in 1 2 3 4 5 6 7 8 9 10; do
+ # use SIGCONT/signal 18 to check if there are
+ # processes left. No need to check the exit code
+ # value, because either killall5 work and it make
+ # sense to wait for processes to die, or it fail and
+ # there is nothing to wait for.
+
+ if killall5 -18 ; then
+ :
+ else
+ alldead=1
+ break
+ fi
+
+ sleep 1
+ done
+ if [ -z "$alldead" ] ; then
+ log_action_begin_msg "Killing all remaining processes"
+ killall5 -9 # SIGKILL
+ log_action_end_msg 1
+ else
+ log_action_begin_msg "All processes ended within $seq seconds."
+ log_action_end_msg 0
+ fi
+}
+
+case "$1" in
+ start)
+ do_start
+ ;;
+ restart|reload|force-reload)
+ echo "Error: argument '$1' not supported" >&2
+ exit 3
+ ;;
+ stop)
+ # No-op
+ ;;
+ *)
+ echo "Usage: $0 start|stop" >&2
+ exit 3
+ ;;
+esac
diff --git a/beagle/debian-rfs/etc/init.d/mountall-bootclean.sh b/beagle/debian-rfs/etc/init.d/mountall-bootclean.sh
new file mode 100755
index 0000000..38c0191
--- /dev/null
+++ b/beagle/debian-rfs/etc/init.d/mountall-bootclean.sh
@@ -0,0 +1,31 @@
+#! /bin/sh
+### BEGIN INIT INFO
+# Provides: mountall-bootclean
+# Required-Start: mountall
+# Required-Stop:
+# Default-Start: S
+# Default-Stop:
+# Short-Description: bootclean after mountall.
+# Description: Clean temporary filesystems after
+# all local filesystems have been mounted.
+### END INIT INFO
+
+case "$1" in
+ start|"")
+ # Clean /tmp, /var/lock, /var/run
+ . /lib/init/bootclean.sh
+ ;;
+ restart|reload|force-reload)
+ echo "Error: argument '$1' not supported" >&2
+ exit 3
+ ;;
+ stop)
+ # No-op
+ ;;
+ *)
+ echo "Usage: mountall-bootclean.sh [start|stop]" >&2
+ exit 3
+ ;;
+esac
+
+:
diff --git a/beagle/debian-rfs/etc/init.d/mountall.sh b/beagle/debian-rfs/etc/init.d/mountall.sh
new file mode 100755
index 0000000..405839c
--- /dev/null
+++ b/beagle/debian-rfs/etc/init.d/mountall.sh
@@ -0,0 +1,88 @@
+#! /bin/sh
+### BEGIN INIT INFO
+# Provides: mountall
+# Required-Start: checkfs
+# Required-Stop:
+# Default-Start: S
+# Default-Stop:
+# Short-Description: Mount all filesystems.
+# Description:
+### END INIT INFO
+
+PATH=/sbin:/bin
+. /lib/init/vars.sh
+
+. /lib/lsb/init-functions
+. /lib/init/mount-functions.sh
+. /lib/init/swap-functions.sh
+
+# for ntfs-3g to get correct file name encoding
+if [ -r /etc/default/locale ]; then
+ . /etc/default/locale
+ export LANG
+fi
+
+do_start() {
+ #
+ # Mount local file systems in /etc/fstab.
+ #
+ mount_all_local() {
+ mount -a -t nonfs,nfs4,smbfs,cifs,ncp,ncpfs,coda,ocfs2,gfs,gfs2 \
+ -O no_netdev
+ }
+ pre_mountall
+ if [ "$VERBOSE" = no ]
+ then
+ log_action_begin_msg "Mounting local filesystems"
+ mount_all_local
+ log_action_end_msg $?
+ else
+ log_daemon_msg "Will now mount local filesystems"
+ mount_all_local
+ log_end_msg $?
+ fi
+ post_mountall
+
+ case "$(uname -s)" in
+ *FreeBSD)
+ INITCTL=/etc/.initctl
+ ;;
+ *)
+ INITCTL=/dev/initctl
+ ;;
+ esac
+
+ #
+ # We might have mounted something over /dev, see if
+ # /dev/initctl is there. Look for /usr/share/sysvinit/update-rc.d
+ # to verify that sysvinit (and not upstart) is installed).
+ #
+ if [ ! -p $INITCTL ] && [ -f /usr/share/sysvinit/update-rc.d ]; then
+ rm -f $INITCTL
+ mknod -m 600 $INITCTL p
+ kill -USR1 1
+ fi
+
+ # Execute swapon command again, in case we want to swap to
+ # a file on a now mounted filesystem.
+ swaponagain 'swapfile'
+}
+
+case "$1" in
+ start|"")
+ do_start
+ ;;
+ restart|reload|force-reload)
+ echo "Error: argument '$1' not supported" >&2
+ exit 3
+ ;;
+ stop)
+ # No-op
+ ;;
+ *)
+ echo "Usage: mountall.sh [start|stop]" >&2
+ exit 3
+ ;;
+esac
+
+:
diff --git a/beagle/debian-rfs/etc/init.d/mountdevsubfs.sh b/beagle/debian-rfs/etc/init.d/mountdevsubfs.sh
new file mode 100755
index 0000000..1b61621
--- /dev/null
+++ b/beagle/debian-rfs/etc/init.d/mountdevsubfs.sh
@@ -0,0 +1,76 @@
+#! /bin/sh
+### BEGIN INIT INFO
+# Provides: mountdevsubfs
+# Required-Start: mountkernfs
+# Required-Stop:
+# Should-Start: udev
+# Default-Start: S
+# Default-Stop:
+# Short-Description: Mount special file systems under /dev.
+# Description: Mount the virtual filesystems the kernel provides
+# that ordinarily live under the /dev filesystem.
+### END INIT INFO
+#
+# This script gets called multiple times during boot
+#
+
+PATH=/sbin:/bin
+TTYGRP=5
+TTYMODE=620
+[ -f /etc/default/devpts ] && . /etc/default/devpts
+
+TMPFS_SIZE=
+[ -f /etc/default/tmpfs ] && . /etc/default/tmpfs
+
+KERNEL="$(uname -s)"
+
+. /lib/lsb/init-functions
+. /lib/init/mount-functions.sh
+
+do_start () {
+ #
+ # Mount a tmpfs on /dev/shm
+ #
+ if [ ! -d /dev/shm ]
+ then
+ mkdir --mode=755 /dev/shm
+ [ -x /sbin/restorecon ] && /sbin/restorecon /dev/shm
+ fi
+ SHM_OPT=
+ [ "${SHM_SIZE:=$TMPFS_SIZE}" ] && SHM_OPT=",size=$SHM_SIZE"
+ domount tmpfs shmfs /dev/shm tmpfs -onosuid,nodev$SHM_OPT
+
+ #
+ # Mount /dev/pts
+ #
+ if [ "$KERNEL" = Linux ]
+ then
+ if [ ! -d /dev/pts ]
+ then
+ mkdir --mode=755 /dev/pts
+ [ -x /sbin/restorecon ] && /sbin/restorecon /dev/pts
+ fi
+ domount devpts "" /dev/pts devpts -onoexec,nosuid,gid=$TTYGRP,mode=$TTYMODE
+ fi
+}
+
+case "$1" in
+ "")
+ echo "Warning: mountdevsubfs should be called with the 'start' argument." >&2
+ do_start
+ ;;
+ start)
+ do_start
+ ;;
+ restart|reload|force-reload)
+ echo "Error: argument '$1' not supported" >&2
+ exit 3
+ ;;
+ stop)
+ # No-op
+ ;;
+ *)
+ echo "Usage: mountdevsubfs [start|stop]" >&2
+ exit 3
+ ;;
+esac
diff --git a/beagle/debian-rfs/etc/init.d/mountkernfs.sh b/beagle/debian-rfs/etc/init.d/mountkernfs.sh
new file mode 100755
index 0000000..f3222b8
--- /dev/null
+++ b/beagle/debian-rfs/etc/init.d/mountkernfs.sh
@@ -0,0 +1,83 @@
+#! /bin/sh
+### BEGIN INIT INFO
+# Provides: mountkernfs
+# Required-Start:
+# Required-Stop:
+# Should-Start: glibc
+# 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
+
+PATH=/sbin:/bin
+. /lib/init/vars.sh
+
+. /lib/lsb/init-functions
+. /lib/init/mount-functions.sh
+
+[ -f /etc/default/tmpfs ] && . /etc/default/tmpfs
+
+do_start () {
+ #
+ # Get some writable area available before the root is checked
+ # and remounted.
+ #
+ RW_OPT=
+ [ "${RW_SIZE:=$TMPFS_SIZE}" ] && RW_OPT=",size=$RW_SIZE"
+ domount tmpfs "" /lib/init/rw tmpfs -omode=0755,nosuid$RW_OPT
+ touch /lib/init/rw/.ramfs
+
+ # Make pidfile omit directory for sendsigs
+ mkdir /lib/init/rw/sendsigs.omit.d/
+
+ #
+ # Mount proc filesystem on /proc
+ #
+ domount proc "" /proc proc -onodev,noexec,nosuid
+
+ #
+ # Mount sysfs on /sys
+ #
+ # Only mount sysfs if it is supported (kernel >= 2.6)
+ if grep -E -qs "sysfs\$" /proc/filesystems
+ then
+ domount sysfs "" /sys sysfs -onodev,noexec,nosuid
+ fi
+
+ # Mount /var/run and /var/lock as tmpfs if enabled
+ if [ yes = "$RAMRUN" ] ; then
+ RUN_OPT=
+ [ "${RUN_SIZE:=$TMPFS_SIZE}" ] && RUN_OPT=",size=$RUN_SIZE"
+ domount tmpfs "" /var/run varrun -omode=0755,nosuid$RUN_OPT
+ touch /var/run/.ramfs
+ fi
+ if [ yes = "$RAMLOCK" ] ; then
+ LOCK_OPT=
+ [ "${LOCK_SIZE:=$TMPFS_SIZE}" ] && LOCK_OPT=",size=$LOCK_SIZE"
+ domount tmpfs "" /var/lock varlock -omode=1777,nodev,noexec,nosuid$LOCK_OPT
+ touch /var/lock/.ramfs
+ fi
+}
+
+case "$1" in
+ "")
+ echo "Warning: mountkernfs should be called with the 'start' argument." >&2
+ do_start
+ ;;
+ start)
+ do_start
+ ;;
+ restart|reload|force-reload)
+ echo "Error: argument '$1' not supported" >&2
+ exit 3
+ ;;
+ stop)
+ # No-op
+ ;;
+ *)
+ echo "Usage: mountkernfs [start|stop]" >&2
+ exit 3
+ ;;
+esac
diff --git a/beagle/debian-rfs/etc/init.d/mountnfs-bootclean.sh b/beagle/debian-rfs/etc/init.d/mountnfs-bootclean.sh
new file mode 100755
index 0000000..bd1a574
--- /dev/null
+++ b/beagle/debian-rfs/etc/init.d/mountnfs-bootclean.sh
@@ -0,0 +1,31 @@
+#! /bin/sh
+### BEGIN INIT INFO
+# Provides: mountnfs-bootclean
+# Required-Start: $local_fs mountnfs
+# Required-Stop:
+# Default-Start: S
+# Default-Stop:
+# Short-Description: bootclean after mountnfs.
+# Description: Clean temporary filesystems after
+# network filesystems have been mounted.
+### END INIT INFO
+
+case "$1" in
+ start|"")
+ # Clean /tmp, /var/lock, /var/run
+ . /lib/init/bootclean.sh
+ ;;
+ restart|reload|force-reload)
+ echo "Error: argument '$1' not supported" >&2
+ exit 3
+ ;;
+ stop)
+ # No-op
+ ;;
+ *)
+ echo "Usage: mountnfs-bootclean.sh [start|stop]" >&2
+ exit 3
+ ;;
+esac
+
+:
diff --git a/beagle/debian-rfs/etc/init.d/mountnfs.sh b/beagle/debian-rfs/etc/init.d/mountnfs.sh
new file mode 100755
index 0000000..8d07bb7
--- /dev/null
+++ b/beagle/debian-rfs/etc/init.d/mountnfs.sh
@@ -0,0 +1,108 @@
+#! /bin/sh
+### BEGIN INIT INFO
+# Provides: mountnfs
+# Required-Start: $local_fs
+# Required-Stop:
+# Should-Start: $network $portmap nfs-common udev-mtab
+# Default-Start: S
+# Default-Stop:
+# Short-Description: Wait for network file systems to be mounted
+# Description: Network file systems are mounted by
+# /etc/network/if-up.d/mountnfs in the background
+# when interfaces are brought up; this script waits
+# for them to be mounted before carrying on.
+### END INIT INFO
+
+. /lib/init/vars.sh
+. /lib/lsb/init-functions
+
+do_wait_async_mount() {
+ [ -f /etc/fstab ] || return
+ #
+ # Read through fstab line by line. If it is NFS, set the flag
+ # for mounting NFS file systems. If any NFS partition is found
+ # then wait around for it.
+ #
+
+ exec 9<&0 </etc/fstab
+
+ waitnfs=
+ while read DEV MTPT FSTYPE OPTS REST
+ do
+ case "$DEV" in
+ ""|\#*)
+ continue
+ ;;
+ esac
+ case "$OPTS" in
+ noauto|*,noauto|noauto,*|*,noauto,*)
+ continue
+ ;;
+ esac
+ case "$FSTYPE" in
+ nfs|nfs4|smbfs|cifs|coda|ncp|ncpfs|ocfs2|gfs)
+ ;;
+ *)
+ continue
+ ;;
+ esac
+ case "$MTPT" in
+ /usr/local|/usr/local/*)
+ ;;
+ /usr|/usr/*)
+ waitnfs="$waitnfs $MTPT"
+ ;;
+ /var|/var/*)
+ waitnfs="$waitnfs $MTPT"
+ ;;
+ esac
+ done
+
+ exec 0<&9 9<&-
+
+ # Wait for each path, the timeout is for all of them as that's
+ # really the maximum time we have to wait anyway
+ TIMEOUT=900
+ for mountpt in $waitnfs; do
+ log_action_begin_msg "Waiting for $mountpt"
+
+ while ! mountpoint -q $mountpt; do
+ sleep 0.1
+
+ TIMEOUT=$(( $TIMEOUT - 1 ))
+ if [ $TIMEOUT -le 0 ]; then
+ log_action_end_msg 1
+ break
+ fi
+ done
+
+ if [ $TIMEOUT -gt 0 ]; then
+ log_action_end_msg 0
+ fi
+ done
+}
+
+case "$1" in
+ start)
+ # Using 'no !=' instead of 'yes =' to make sure async nfs
+ # mounting is the default even without a value in
+ # /etc/default/rcS
+ if [ no != "$ASYNCMOUNTNFS" ] ; then
+ do_wait_async_mount
+ else
+ FROMINITD=yes /etc/network/if-up.d/mountnfs
+ fi
+ ;;
+ restart|reload|force-reload)
+ echo "Error: argument '$1' not supported" >&2
+ exit 3
+ ;;
+ stop)
+ ;;
+ *)
+ echo "Usage: $0 start|stop" >&2
+ exit 3
+ ;;
+esac
+
+: exit 0
diff --git a/beagle/debian-rfs/etc/init.d/mountoverflowtmp b/beagle/debian-rfs/etc/init.d/mountoverflowtmp
new file mode 100755
index 0000000..1b547d1
--- /dev/null
+++ b/beagle/debian-rfs/etc/init.d/mountoverflowtmp
@@ -0,0 +1,55 @@
+#! /bin/sh
+### BEGIN INIT INFO
+# Provides: mountoverflowtmp
+# Required-Start: mountall-bootclean
+# Required-Stop: umountfs
+# Default-Start: S
+# Default-Stop:
+# Short-Description: mount emergency /tmp.
+# Description: Mount a tmpfs on /tmp if there would
+# otherwise be too little space to log in.
+### END INIT INFO
+
+. /lib/init/vars.sh
+. /lib/lsb/init-functions
+
+set -e
+
+defs=/etc/default/mountoverflowtmp
+test ! -f "$defs" || . "$defs"
+
+: ${MINTMPKB:=1024}
+if test "$MINTMPKB" = "0"; then exit 0; fi
+
+case "$1" in
+ start)
+ [ "$VERBOSE" != no ] && log_action_begin_msg "Checking minimum space in /tmp"
+ df="`LC_ALL=C df -kP /tmp | grep -v Filesystem`"
+ set -- $df
+ avail="$4"
+ [ "$VERBOSE" != no ] && log_action_end_msg 0
+ if test $avail -lt "$MINTMPKB"; then
+ log_action_begin_msg "Mounting emergency tmpfs on /tmp"
+ mount -t tmpfs -o size=1048576,mode=1777 overflow /tmp
+ log_action_end_msg 0
+ fi
+ ;;
+ restart|reload|force-reload)
+ echo "Error: argument '$1' not supported" >&2
+ exit 3
+ ;;
+ stop)
+ if LC_ALL=C mount | \
+ grep '^overflow on /tmp type tmpfs' >/dev/null; then
+ log_action_begin_msg "Unmounting any overflow tmpfs from /tmp"
+ umount overflow
+ log_action_end_msg 0
+ fi
+ ;;
+ *)
+ echo "Usage: mountoverflowtmp [start|stop]" >&2
+ exit 3
+ ;;
+esac
+
+:
diff --git a/beagle/debian-rfs/etc/init.d/mtab.sh b/beagle/debian-rfs/etc/init.d/mtab.sh
new file mode 100755
index 0000000..d81c928
--- /dev/null
+++ b/beagle/debian-rfs/etc/init.d/mtab.sh
@@ -0,0 +1,180 @@
+#! /bin/sh
+### BEGIN INIT INFO
+# Provides: mtab
+# Required-Start: checkroot
+# Required-Stop:
+# Default-Start: S
+# Default-Stop:
+# Short-Description: Update mtab file.
+# Description: Update the mount program's mtab file after
+# all local filesystems have been mounted.
+### END INIT INFO
+
+#
+# The main purpose of this script is to update the mtab file to reflect
+# the fact that virtual filesystems were mounted early on, before mtab
+# was writable.
+#
+
+PATH=/sbin:/bin
+. /lib/init/vars.sh
+
+TTYGRP=5
+TTYMODE=620
+[ -f /etc/default/devpts ] && . /etc/default/devpts
+
+TMPFS_SIZE=
+[ -f /etc/default/tmpfs ] && . /etc/default/tmpfs
+
+KERNEL="$(uname -s)"
+
+. /lib/lsb/init-functions
+. /lib/init/mount-functions.sh
+
+# $1 - fstype
+# $2 - mount point
+# $3 - mount name/device
+# $4 - mount options
+domtab ()
+{
+ # Directory present?
+ if [ ! -d $2 ]
+ then
+ return
+ fi
+
+ # Not mounted?
+ if ! mountpoint -q $2 < /dev/null
+ then
+ return
+ fi
+
+ if [ -n "$3" ]
+ then
+ NAME="$3"
+ else
+ NAME="$1"
+ fi
+
+ # Already recorded?
+ if ! grep -E -sq "^([^ ]+) +$2 +" /etc/mtab < /dev/null
+ then
+ mount -f -t $1 $OPTS $4 $NAME $2 < /dev/null
+ fi
+}
+
+do_start () {
+ DO_MTAB=""
+ MTAB_PATH="$(readlink -f /etc/mtab || :)"
+ case "$MTAB_PATH" in
+ /proc/*)
+ # Assume that /proc/ is not writable
+ ;;
+ /*)
+ # Only update mtab if it is known to be writable
+ # Note that the touch program is in /usr/bin
+ #if ! touch "$MTAB_PATH" >/dev/null 2>&1
+ #then
+ # return
+ #fi
+ ;;
+ "")
+ [ -L /etc/mtab ] && MTAB_PATH="$(readlink /etc/mtab)"
+ if [ "$MTAB_PATH" ]
+ then
+ log_failure_msg "Cannot initialize ${MTAB_PATH}."
+ else
+ log_failure_msg "Cannot initialize /etc/mtab."
+ fi
+ ;;
+ *)
+ log_failure_msg "Illegal mtab location '${MTAB_PATH}'."
+ ;;
+ esac
+
+ #
+ # Initialize mtab file if necessary
+ #
+ if [ ! -f /etc/mtab ]
+ then
+ :> /etc/mtab
+ chmod 644 /etc/mtab
+ fi
+ if selinux_enabled && [ -x /sbin/restorecon ] && [ -r /etc/mtab ]
+ then
+ restorecon /etc/mtab
+ fi
+
+ # S02mountkernfs.sh
+ RW_OPT=
+ [ "${RW_SIZE:=$TMPFS_SIZE}" ] && RW_OPT=",size=$RW_SIZE"
+ domtab tmpfs /lib/init/rw tmpfs -omode=0755,nosuid$RW_OPT
+
+ domtab proc /proc "proc" -onodev,noexec,nosuid
+ if grep -E -qs "sysfs\$" /proc/filesystems
+ then
+ domtab sysfs /sys sysfs -onodev,noexec,nosuid
+ fi
+ if [ yes = "$RAMRUN" ] ; then
+ RUN_OPT=
+ [ "${RUN_SIZE:=$TMPFS_SIZE}" ] && RUN_OPT=",size=$RUN_SIZE"
+ domtab tmpfs /var/run "varrun" -omode=0755,nosuid$RUN_OPT
+ fi
+ if [ yes = "$RAMLOCK" ] ; then
+ LOCK_OPT=
+ [ "${LOCK_SIZE:=$TMPFS_SIZE}" ] && LOCK_OPT=",size=$LOCK_SIZE"
+ domtab tmpfs /var/lock "varlock" -omode=1777,nodev,noexec,nosuid$LOCK_OPT
+ fi
+ if [ -d /proc/bus/usb ]
+ then
+ domtab usbfs /proc/bus/usb "procbususb"
+ fi
+
+ # S03udev
+ domtab tmpfs /dev "udev" -omode=0755
+
+ # S04mountdevsubfs
+ SHM_OPT=
+ [ "${SHM_SIZE:=$TMPFS_SIZE}" ] && SHM_OPT=",size=$SHM_SIZE"
+ domtab tmpfs /dev/shm tmpfs -onosuid,nodev$SHM_OPT
+ domtab devpts /dev/pts "devpts" -onoexec,nosuid,gid=$TTYGRP,mode=$TTYMODE
+
+ # Add everything else in /proc/mounts into /etc/mtab, with
+ # special exceptions.
+ exec 9<&0 0</proc/mounts
+ while read FDEV FDIR FTYPE FOPTS REST
+ do
+ case "$FDIR" in
+ /lib/modules/*/volatile)
+ FDEV="lrm"
+ ;;
+ /dev/.static/dev)
+ # Not really useful to show in 'df',
+ # and it isn't accessible for non-root
+ # users.
+ continue
+ ;;
+ esac
+ domtab "$FTYPE" "$FDIR" "$FDEV" "-o$FOPTS"
+ done
+ exec 0<&9 9<&-
+}
+
+case "$1" in
+ start|"")
+ do_start
+ ;;
+ restart|reload|force-reload)
+ echo "Error: argument '$1' not supported" >&2
+ exit 3
+ ;;
+ stop)
+ # No-op
+ ;;
+ *)
+ echo "Usage: mountall-mtab.sh [start|stop]" >&2
+ exit 3
+ ;;
+esac
+
+:
diff --git a/beagle/debian-rfs/etc/init.d/rc b/beagle/debian-rfs/etc/init.d/rc
new file mode 100755
index 0000000..fdb8ac7
--- /dev/null
+++ b/beagle/debian-rfs/etc/init.d/rc
@@ -0,0 +1,338 @@
+#! /bin/sh
+#
+# rc
+#
+# Starts/stops services on runlevel changes.
+#
+# Optimization: A start script is not run when the service was already
+# configured to run in the previous runlevel. A stop script is not run
+# when the the service was already configured not to run in the previous
+# runlevel.
+#
+# Authors:
+# Miquel van Smoorenburg <miquels@cistron.nl>
+# Bruce Perens <Bruce@Pixar.com>
+
+PATH=/sbin:/usr/sbin:/bin:/usr/bin
+export PATH
+
+# Un-comment the following for interactive debugging. Do not un-comment
+# this for debugging a real boot process as no scripts will be executed.
+# debug=echo
+
+# Specify method used to enable concurrent init.d scripts.
+# Valid options are 'none' and 'makefile'. Obsolete options
+# used earlier are 'shell' and 'startpar'. The obsolete options
+# are aliases for 'makefile' since 2010-05-14. The default since
+# the same date is 'makefile', as the init.d scripts in Debian now
+# include dependency information and are ordered using this
+# information. See insserv for information on dependency based
+# boot sequencing.
+CONCURRENCY=makefile
+
+# Make sure the name survive changing the argument list
+scriptname="$0"
+
+umask 022
+
+on_exit() {
+ echo "error: '$scriptname' exited outside the expected code flow."
+}
+trap on_exit EXIT # Enable emergency handler
+
+# Ignore CTRL-C only in this shell, so we can interrupt subprocesses.
+trap ":" INT QUIT TSTP
+
+# Set onlcr to avoid staircase effect.
+stty onlcr 0>&1
+
+# Functions for splash progress bars
+if [ -e /lib/init/splash-functions-base ] ; then
+ . /lib/init/splash-functions-base
+else
+ # Quiet down script if old initscripts version without /lib/init/splash-functions-base is used.
+ splash_progress() { return 1; }
+ splash_stop() { return 1; }
+fi
+
+# Now find out what the current and what the previous runlevel are.
+
+runlevel=$RUNLEVEL
+# Get first argument. Set new runlevel to this argument.
+[ "$1" != "" ] && runlevel=$1
+if [ "$runlevel" = "" ]
+then
+ echo "Usage: $scriptname <runlevel>" >&2
+ exit 1
+fi
+previous=$PREVLEVEL
+[ "$previous" = "" ] && previous=N
+
+export runlevel previous
+
+if [ -f /etc/default/rcS ] ; then
+ . /etc/default/rcS
+fi
+export VERBOSE
+
+if [ -f /lib/lsb/init-functions ] ; then
+ . /lib/lsb/init-functions
+else
+ log_action_msg() { echo $@; }
+ log_failure_msg() { echo $@; }
+ log_warning_msg() { echo $@; }
+fi
+
+#
+# Stub to do progress bar ticks (for splash programs) on startup
+#
+startup_progress() {
+ # Avoid divide by zero if anyone moved xdm/kdm/gdm first in a runlevel.
+ if [ 0 -eq "$num_steps" ] ; then return; fi
+
+ step=$(($step + $step_change))
+ progress=$(($step * $progress_size / $num_steps + $first_step))
+ $debug splash_progress "$progress" || true
+}
+
+#
+# Check if we are able to use make like booting. It require the
+# insserv package to be enabled. Boot concurrency also requires
+# startpar to be installed.
+#
+if [ "none" != "$CONCURRENCY" ] ; then
+ test -s /etc/init.d/.depend.boot || CONCURRENCY="none"
+ test -s /etc/init.d/.depend.start || CONCURRENCY="none"
+ test -s /etc/init.d/.depend.stop || CONCURRENCY="none"
+ if test -e /etc/init.d/.legacy-bootordering ; then
+ CONCURRENCY="none"
+ fi
+ startpar -v > /dev/null 2>&1 || CONCURRENCY="none"
+fi
+
+#
+# Start script or program.
+#
+case "$CONCURRENCY" in
+ makefile|startpar|shell) # startpar and shell are obsolete
+ CONCURRENCY=makefile
+ log_action_msg "Using makefile-style concurrent boot in runlevel $runlevel"
+ # The splash API is not handled with this CONCURRENCY mode.
+ # It need to be implented in startpar. Until that is done
+ # stop the splash screen before starting services, to avoid
+ # usplash and X to confuse each other during boot.
+ startup() {
+ if [ start = "$1" ] || [ boot = "$1" ]
+ then
+ $debug splash_stop || true
+ fi
+ eval "$(startpar -p 4 -t 20 -T 3 -M $1 -P $previous -R $runlevel)"
+
+ if [ -n "$failed_service" ]
+ then
+ log_failure_msg "startpar: service(s) returned failure: $failed_service"
+ fi
+
+ if [ -n "$skipped_service" ]
+ then
+ log_warning_msg "startpar: service(s) skipped: $skipped_service"
+ fi
+
+ unset failed_service skipped_service
+ }
+ ;;
+ none|*)
+ startup() {
+ action=$1
+ shift
+ scripts="$@"
+ for script in $scripts ; do
+ $debug "$script" $action
+ startup_progress
+ done
+ }
+ ;;
+esac
+
+# Check if the splash screen should be stopped before the given
+# script.
+is_splash_stop_scripts() {
+ scriptname=$1
+ case "$scriptname" in
+ # killprocs is used in runlevel 1
+ gdm|xdm|kdm|ltsp-client|ltsp-client-core|reboot|halt|killprocs)
+ return 0
+ ;;
+ esac
+ return 1
+}
+
+# Is there an rc directory for this new runlevel?
+if [ -d /etc/rc$runlevel.d ]
+then
+ # Find out where in the progress bar the initramfs got to.
+ PROGRESS_STATE=0
+ if [ -f /dev/.initramfs/progress_state ]; then
+ . /dev/.initramfs/progress_state
+ fi
+
+ # Split the remaining portion of the progress bar into thirds
+ progress_size=$(((100 - $PROGRESS_STATE) / 3))
+
+ case "$runlevel" in
+ 0|6)
+ ACTION=stop
+ # Count down from 0 to -100 and use the entire bar
+ first_step=0
+ progress_size=100
+ step_change=-1
+ ;;
+ S)
+ ACTION=start
+ # Begin where the initramfs left off and use 2/3
+ # of the remaining space
+ first_step=$PROGRESS_STATE
+ progress_size=$(($progress_size * 2))
+ step_change=1
+ ;;
+ *)
+ ACTION=start
+ # Begin where rcS left off and use the final 1/3 of
+ # the space (by leaving progress_size unchanged)
+ first_step=$(($progress_size * 2 + $PROGRESS_STATE))
+ step_change=1
+ ;;
+ esac
+
+ # Count the number of scripts we need to run
+ # (for progress bars)
+ num_steps=0
+ for s in /etc/rc$runlevel.d/[SK]*; do
+ if is_splash_stop_scripts "${s##/etc/rc$runlevel.d/S??}" ; then
+ break
+ fi
+ num_steps=$(($num_steps + 1))
+ done
+ step=0
+
+ # First, run the KILL scripts.
+ if [ makefile = "$CONCURRENCY" ]
+ then
+ if [ "$ACTION" = "start" ] && [ "$previous" != N ]
+ then
+ startup stop
+ fi
+ elif [ "$previous" != N ]
+ then
+ # Run all scripts with the same level in parallel
+ CURLEVEL=""
+ for s in /etc/rc$runlevel.d/K*
+ do
+ # Extract order value from symlink
+ level=${s#/etc/rc$runlevel.d/K}
+ level=${level%%[a-zA-Z]*}
+ if [ "$level" = "$CURLEVEL" ]
+ then
+ continue
+ fi
+ CURLEVEL=$level
+ SCRIPTS=""
+ for i in /etc/rc$runlevel.d/K$level*
+ do
+ # Check if the script is there.
+ [ ! -f $i ] && continue
+
+ #
+ # Find stop script in previous runlevel but
+ # no start script there.
+ #
+ suffix=${i#/etc/rc$runlevel.d/K[0-9][0-9]}
+ previous_stop=/etc/rc$previous.d/K[0-9][0-9]$suffix
+ previous_start=/etc/rc$previous.d/S[0-9][0-9]$suffix
+ #
+ # If there is a stop script in the previous level
+ # and _no_ start script there, we don't
+ # have to re-stop the service.
+ #
+ [ -f $previous_stop ] && [ ! -f $previous_start ] && continue
+
+ # Stop the service.
+ SCRIPTS="$SCRIPTS $i"
+ if is_splash_stop_scripts "$suffix" ; then
+ $debug splash_stop || true
+ fi
+ done
+ startup stop $SCRIPTS
+ done
+ fi
+
+ if [ makefile = "$CONCURRENCY" ]
+ then
+ if [ S = "$runlevel" ]
+ then
+ startup boot
+ else
+ startup $ACTION
+ fi
+ else
+ # Now run the START scripts for this runlevel.
+ # Run all scripts with the same level in parallel
+ CURLEVEL=""
+ for s in /etc/rc$runlevel.d/S*
+ do
+ # Extract order value from symlink
+ level=${s#/etc/rc$runlevel.d/S}
+ level=${level%%[a-zA-Z]*}
+ if [ "$level" = "$CURLEVEL" ]
+ then
+ continue
+ fi
+ CURLEVEL=$level
+ SCRIPTS=""
+ for i in /etc/rc$runlevel.d/S$level*
+ do
+ [ ! -f $i ] && continue
+
+ suffix=${i#/etc/rc$runlevel.d/S[0-9][0-9]}
+ if [ "$previous" != N ]
+ then
+ #
+ # Find start script in previous runlevel and
+ # stop script in this runlevel.
+ #
+ stop=/etc/rc$runlevel.d/K[0-9][0-9]$suffix
+ previous_start=/etc/rc$previous.d/S[0-9][0-9]$suffix
+ #
+ # If there is a start script in the previous level
+ # and _no_ stop script in this level, we don't
+ # have to re-start the service.
+ #
+ if [ start = "$ACTION" ] ; then
+ [ -f $previous_start ] && [ ! -f $stop ] && continue
+ else
+ # Workaround for the special
+ # handling of runlevels 0 and 6.
+ previous_stop=/etc/rc$previous.d/K[0-9][0-9]$suffix
+ #
+ # If there is a stop script in the previous level
+ # and _no_ start script there, we don't
+ # have to re-stop the service.
+ #
+ [ -f $previous_stop ] && [ ! -f $previous_start ] && continue
+ fi
+
+ fi
+ SCRIPTS="$SCRIPTS $i"
+ if is_splash_stop_scripts "$suffix" ; then
+ $debug splash_stop || true
+ fi
+ done
+ startup $ACTION $SCRIPTS
+ done
+ fi
+fi
+
+trap - EXIT # Disable emergency handler
+
+exit 0
+
diff --git a/beagle/debian-rfs/etc/init.d/rc.local b/beagle/debian-rfs/etc/init.d/rc.local
new file mode 100755
index 0000000..5033c7e
--- /dev/null
+++ b/beagle/debian-rfs/etc/init.d/rc.local
@@ -0,0 +1,41 @@
+#! /bin/sh
+### BEGIN INIT INFO
+# Provides: rc.local
+# Required-Start: $remote_fs $syslog $all
+# Required-Stop:
+# Default-Start: 2 3 4 5
+# Default-Stop:
+# Short-Description: Run /etc/rc.local if it exist
+### END INIT INFO
+
+
+PATH=/sbin:/usr/sbin:/bin:/usr/bin
+
+. /lib/init/vars.sh
+. /lib/lsb/init-functions
+
+do_start() {
+ if [ -x /etc/rc.local ]; then
+ [ "$VERBOSE" != no ] && log_begin_msg "Running local boot scripts (/etc/rc.local)"
+ /etc/rc.local
+ ES=$?
+ [ "$VERBOSE" != no ] && log_end_msg $ES
+ return $ES
+ fi
+}
+
+case "$1" in
+ start)
+ do_start
+ ;;
+ restart|reload|force-reload)
+ echo "Error: argument '$1' not supported" >&2
+ exit 3
+ ;;
+ stop)
+ ;;
+ *)
+ echo "Usage: $0 start|stop" >&2
+ exit 3
+ ;;
+esac
diff --git a/beagle/debian-rfs/etc/init.d/rcS b/beagle/debian-rfs/etc/init.d/rcS
new file mode 100755
index 0000000..546b724
--- /dev/null
+++ b/beagle/debian-rfs/etc/init.d/rcS
@@ -0,0 +1,8 @@
+#! /bin/sh
+#
+# rcS
+#
+# Call all S??* scripts in /etc/rcS.d/ in numerical/alphabetical order
+#
+
+exec /etc/init.d/rc S
diff --git a/beagle/debian-rfs/etc/init.d/reboot b/beagle/debian-rfs/etc/init.d/reboot
new file mode 100755
index 0000000..af59a80
--- /dev/null
+++ b/beagle/debian-rfs/etc/init.d/reboot
@@ -0,0 +1,38 @@
+#! /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:/usr/sbin:/bin:/usr/bin
+
+. /lib/lsb/init-functions
+
+do_stop () {
+ # Message should end with a newline since kFreeBSD may
+ # print more stuff (see #323749)
+ log_action_msg "Will now restart"
+ reboot -d -f -i
+}
+
+case "$1" in
+ start)
+ # No-op
+ ;;
+ restart|reload|force-reload)
+ echo "Error: argument '$1' not supported" >&2
+ exit 3
+ ;;
+ stop)
+ do_stop
+ ;;
+ *)
+ echo "Usage: $0 start|stop" >&2
+ exit 3
+ ;;
+esac
diff --git a/beagle/debian-rfs/etc/init.d/rmnologin b/beagle/debian-rfs/etc/init.d/rmnologin
new file mode 100755
index 0000000..62cb6fa
--- /dev/null
+++ b/beagle/debian-rfs/etc/init.d/rmnologin
@@ -0,0 +1,59 @@
+#! /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
+
+PATH=/sbin:/bin
+[ "$DELAYLOGIN" ] || DELAYLOGIN=yes
+. /lib/init/vars.sh
+
+do_start () {
+ #
+ # If login delaying is enabled then remove the flag file
+ #
+ case "$DELAYLOGIN" in
+ Y*|y*)
+ rm -f /var/lib/initscripts/nologin
+ ;;
+ esac
+}
+
+do_status () {
+ if [ ! -f /var/lib/initscripts/nologin ] ; then
+ return 0
+ else
+ return 4
+ fi
+}
+
+case "$1" in
+ start)
+ do_start
+ ;;
+ restart|reload|force-reload)
+ echo "Error: argument '$1' not supported" >&2
+ exit 3
+ ;;
+ stop)
+ # No-op
+ ;;
+ status)
+ do_status
+ exit $?
+ ;;
+ *)
+ echo "Usage: $0 start|stop" >&2
+ exit 3
+ ;;
+esac
+
+:
diff --git a/beagle/debian-rfs/etc/init.d/sendsigs b/beagle/debian-rfs/etc/init.d/sendsigs
new file mode 100755
index 0000000..f5c33c5
--- /dev/null
+++ b/beagle/debian-rfs/etc/init.d/sendsigs
@@ -0,0 +1,126 @@
+#! /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:/usr/sbin:/bin:/usr/bin
+
+. /lib/lsb/init-functions
+
+# Make it possible to see who the misbehaving processes are
+report_unkillable() {
+ if [ -x /usr/bin/pstree ] ; then
+ echo "Currently running processes (pstree):"
+ pstree
+ elif [ -x /bin/ps ] ; then
+ echo "Currently running processes (ps):"
+ ps -ef
+ fi
+}
+
+do_stop () {
+ OMITPIDS=
+
+ # The /var/run/sendsigs.omit file is used to be compatible
+ # with Ubuntu.
+ for omitfile in /var/run/sendsigs.omit /lib/init/rw/sendsigs.omit; do
+ if [ -e $omitfile ]; then
+ for pid in $(cat $omitfile); do
+ OMITPIDS="${OMITPIDS:+$OMITPIDS }-o $pid"
+ done
+ fi
+ done
+
+ # Load sendsigs.omit.d/packagename files too, to make it
+ # possible for scripts that need to modify the list of pids at
+ # run time without race conditions.
+ if [ -d /lib/init/rw/sendsigs.omit.d/ ]; then
+ for pidfile in /lib/init/rw/sendsigs.omit.d/*; do
+ [ -f "$pidfile" ] || continue
+ for pid in $(cat $pidfile); do
+ OMITPIDS="${OMITPIDS:+$OMITPIDS }-o $pid"
+ done
+ done
+ fi
+
+ # Upstart jobs have their own "stop on" clauses that sends
+ # SIGTERM/SIGKILL just like this, so if they're still running,
+ # they're supposed to be
+ if [ -x /sbin/initctl ]; then
+ for pid in $(initctl list | sed -n -e "/process [0-9]/s/.*process //p"); do
+ OMITPIDS="${OMITPIDS:+$OMITPIDS }-o $pid"
+ done
+ fi
+
+ # Flush the kernel I/O buffer before we start to kill
+ # processes, to make sure the IO of already stopped services to
+ # not slow down the remaining processes to a point where they
+ # are accidentily killed with SIGKILL because they did not
+ # manage to shut down in time.
+ sync
+
+ # Kill all processes.
+ log_action_begin_msg "Asking all remaining processes to terminate"
+ killall5 -15 $OMITPIDS # SIGTERM
+ log_action_end_msg 0
+ alldead=""
+ for seq in 1 2 3 4 5 6 7 8 9 10; do
+ # use SIGCONT/signal 18 to check if there are
+ # processes left. No need to check the exit code
+ # value, because either killall5 work and it make
+ # sense to wait for processes to die, or it fail and
+ # there is nothing to wait for.
+
+ # did an upstart job start since we last polled initctl? check
+ # again on each loop and add any new jobs (e.g., plymouth) to
+ # the list. If we did miss one starting up, this beats waiting
+ # 10 seconds before shutting down.
+ if [ -x /sbin/initctl ]; then
+ for pid in $(initctl list | sed -n -e "/process [0-9]/s/.*process //p"); do
+ OMITPIDS="${OMITPIDS:+$OMITPIDS }-o $pid"
+ done
+ fi
+ if killall5 -18 $OMITPIDS ; then
+ :
+ else
+ alldead=1
+ break
+ fi
+
+ sleep 1
+ done
+ if [ -z "$alldead" ] ; then
+ report_unkillable
+ log_action_begin_msg "Killing all remaining processes"
+ killall5 -9 $OMITPIDS # SIGKILL
+ log_action_end_msg 1
+ else
+ log_action_begin_msg "All processes ended within $seq seconds."
+ log_action_end_msg 0
+ fi
+}
+
+case "$1" in
+ start)
+ # No-op
+ ;;
+ restart|reload|force-reload)
+ echo "Error: argument '$1' not supported" >&2
+ exit 3
+ ;;
+ stop)
+ do_stop
+ ;;
+ *)
+ echo "Usage: $0 start|stop" >&2
+ exit 3
+ ;;
+esac
+
+:
diff --git a/beagle/debian-rfs/etc/init.d/single b/beagle/debian-rfs/etc/init.d/single
new file mode 100755
index 0000000..3379102
--- /dev/null
+++ b/beagle/debian-rfs/etc/init.d/single
@@ -0,0 +1,35 @@
+#! /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
+
+. /lib/lsb/init-functions
+
+do_start () {
+ log_action_msg "Will now switch to single-user mode"
+ exec init -t1 S
+}
+
+case "$1" in
+ start)
+ do_start
+ ;;
+ restart|reload|force-reload)
+ echo "Error: argument '$1' not supported" >&2
+ exit 3
+ ;;
+ stop)
+ # No-op
+ ;;
+ *)
+ echo "Usage: $0 start|stop" >&2
+ exit 3
+ ;;
+esac
diff --git a/beagle/debian-rfs/etc/init.d/skeleton b/beagle/debian-rfs/etc/init.d/skeleton
new file mode 100644
index 0000000..dac9480
--- /dev/null
+++ b/beagle/debian-rfs/etc/init.d/skeleton
@@ -0,0 +1,159 @@
+#! /bin/sh
+### BEGIN INIT INFO
+# Provides: skeleton
+# Required-Start: $remote_fs $syslog
+# Required-Stop: $remote_fs $syslog
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: Example initscript
+# Description: This file should be used to construct scripts to be
+# placed in /etc/init.d.
+### END INIT INFO
+
+# Author: Foo Bar <foobar@baz.org>
+#
+# Please remove the "Author" lines above and replace them
+# with your own name if you copy and modify this script.
+
+# Do NOT "set -e"
+
+# PATH should only include /usr/* if it runs after the mountnfs.sh script
+PATH=/sbin:/usr/sbin:/bin:/usr/bin
+DESC="Description of the service"
+NAME=daemonexecutablename
+DAEMON=/usr/sbin/$NAME
+DAEMON_ARGS="--options args"
+PIDFILE=/var/run/$NAME.pid
+SCRIPTNAME=/etc/init.d/$NAME
+
+# Exit if the package is not installed
+[ -x "$DAEMON" ] || exit 0
+
+# Read configuration variable file if it is present
+[ -r /etc/default/$NAME ] && . /etc/default/$NAME
+
+# Load the VERBOSE setting and other rcS variables
+. /lib/init/vars.sh
+
+# Define LSB log_* functions.
+# Depend on lsb-base (>= 3.2-14) to ensure that this file is present
+# and status_of_proc is working.
+. /lib/lsb/init-functions
+
+#
+# Function that starts the daemon/service
+#
+do_start()
+{
+ # Return
+ # 0 if daemon has been started
+ # 1 if daemon was already running
+ # 2 if daemon could not be started
+ start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
+ || return 1
+ start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
+ $DAEMON_ARGS \
+ || return 2
+ # Add code here, if necessary, that waits for the process to be ready
+ # to handle requests from services started subsequently which depend
+ # on this one. As a last resort, sleep for some time.
+}
+
+#
+# Function that stops the daemon/service
+#
+do_stop()
+{
+ # Return
+ # 0 if daemon has been stopped
+ # 1 if daemon was already stopped
+ # 2 if daemon could not be stopped
+ # other if a failure occurred
+ start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
+ RETVAL="$?"
+ [ "$RETVAL" = 2 ] && return 2
+ # Wait for children to finish too if this is a daemon that forks
+ # and if the daemon is only ever run from this initscript.
+ # If the above conditions are not satisfied then add some other code
+ # that waits for the process to drop all resources that could be
+ # needed by services started subsequently. A last resort is to
+ # sleep for some time.
+ start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
+ [ "$?" = 2 ] && return 2
+ # Many daemons don't delete their pidfiles when they exit.
+ rm -f $PIDFILE
+ return "$RETVAL"
+}
+
+#
+# Function that sends a SIGHUP to the daemon/service
+#
+do_reload() {
+ #
+ # If the daemon can reload its configuration without
+ # restarting (for example, when it is sent a SIGHUP),
+ # then implement that here.
+ #
+ start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
+ return 0
+}
+
+case "$1" in
+ start)
+ [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
+ do_start
+ case "$?" in
+ 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
+ 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
+ esac
+ ;;
+ stop)
+ [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
+ do_stop
+ case "$?" in
+ 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
+ 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
+ esac
+ ;;
+ status)
+ status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
+ ;;
+ #reload|force-reload)
+ #
+ # If do_reload() is not implemented then leave this commented out
+ # and leave 'force-reload' as an alias for 'restart'.
+ #
+ #log_daemon_msg "Reloading $DESC" "$NAME"
+ #do_reload
+ #log_end_msg $?
+ #;;
+ restart|force-reload)
+ #
+ # If the "reload" option is implemented then remove the
+ # 'force-reload' alias
+ #
+ log_daemon_msg "Restarting $DESC" "$NAME"
+ do_stop
+ case "$?" in
+ 0|1)
+ do_start
+ case "$?" in
+ 0) log_end_msg 0 ;;
+ 1) log_end_msg 1 ;; # Old process is still running
+ *) log_end_msg 1 ;; # Failed to start
+ esac
+ ;;
+ *)
+ # Failed to stop
+ log_end_msg 1
+ ;;
+ esac
+ ;;
+ *)
+ #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
+ echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
+ exit 3
+ ;;
+esac
+
+:
diff --git a/beagle/debian-rfs/etc/init.d/stop-bootlogd b/beagle/debian-rfs/etc/init.d/stop-bootlogd
new file mode 100755
index 0000000..1797b7d
--- /dev/null
+++ b/beagle/debian-rfs/etc/init.d/stop-bootlogd
@@ -0,0 +1,33 @@
+#! /bin/sh
+### BEGIN INIT INFO
+# Provides: stop-bootlogd
+# Required-Start: $local_fs $all
+# Required-Stop:
+# Default-Start: 2 3 4 5
+# Default-Stop:
+# Short-Description: Stop bootlogd
+# Description: See the init.d/bootlogd script
+### END INIT INFO
+
+NAME=stop-bootlogd
+DAEMON=/sbin/bootlogd
+
+[ -x "$DAEMON" ] || exit 0
+
+case "$1" in
+ start)
+ /etc/init.d/bootlogd stop
+ ;;
+ stop|restart|force-reload)
+ # No-op
+ ;;
+ status)
+ exec /etc/init.d/bootlogd status
+ ;;
+ *)
+ echo "Usage: $NAME {start|stop|restart|force-reload}" >&2
+ exit 3
+ ;;
+esac
+
+:
diff --git a/beagle/debian-rfs/etc/init.d/stop-bootlogd-single b/beagle/debian-rfs/etc/init.d/stop-bootlogd-single
new file mode 100755
index 0000000..2e76f16
--- /dev/null
+++ b/beagle/debian-rfs/etc/init.d/stop-bootlogd-single
@@ -0,0 +1,51 @@
+#! /bin/sh
+### BEGIN INIT INFO
+# Provides: stop-bootlogd-single
+# Required-Start: $local_fs $all
+# Required-Stop:
+# Default-Start: S
+# Default-Stop:
+# Short-Description: Stop bootlogd in single user mode
+# Description: See the init.d/bootlogd script
+### END INIT INFO
+#
+# This has to run in the boot sequence (rcS.d), and not in the "single
+# user" sequence (rc1.d), because rc1.d/ is not used when booting into
+# single user. "grep :[S1]: /etc/inittab" show that single user is just
+# a call to /sbin/sulogin, while runlevel 1 is a call to
+# "/etc/init.d/rc 1" which in the end switches to runlevel S to run
+# /sbin/sulogin.
+
+PATH=/sbin:/usr/sbin:/bin:/usr/bin
+NAME=stop-bootlogd-single
+DAEMON=/sbin/bootlogd
+
+[ -x "$DAEMON" ] || exit 0
+
+case "$1" in
+ start)
+ single=false
+ for word in $(cat /proc/cmdline); do
+ case "$word" in
+ S|single|1)
+ single=true
+ ;;
+ esac
+ done
+ if [ true = "$single" ] ; then
+ /etc/init.d/bootlogd stop
+ fi
+ ;;
+ stop|restart|force-reload)
+ # No-op
+ ;;
+ status)
+ exec /etc/init.d/bootlogd status
+ ;;
+ *)
+ echo "Usage: $NAME {start|stop|restart|force-reload}" >&2
+ exit 3
+ ;;
+esac
+
+:
diff --git a/beagle/debian-rfs/etc/init.d/umountfs b/beagle/debian-rfs/etc/init.d/umountfs
new file mode 100755
index 0000000..7df5e3f
--- /dev/null
+++ b/beagle/debian-rfs/etc/init.d/umountfs
@@ -0,0 +1,144 @@
+#! /bin/sh
+### BEGIN INIT INFO
+# Provides: umountfs
+# Required-Start:
+# Required-Stop: umountroot
+# Default-Start:
+# Default-Stop: 0 6
+# Short-Description: Turn off swap and unmount all local file systems.
+# Description:
+### END INIT INFO
+
+PATH=/sbin:/usr/sbin:/bin:/usr/bin
+. /lib/init/vars.sh
+
+. /lib/lsb/init-functions
+
+umask 022
+
+do_stop () {
+ exec 9<&0 </proc/mounts
+
+ PROTECTED_MOUNTS="$(sed -n '0,/^\/[^ ]* \/ /p' /proc/mounts)"
+ WEAK_MTPTS="" # be gentle, don't use force
+ REG_MTPTS=""
+ TMPFS_MTPTS=""
+ while read -r DEV MTPT FSTYPE REST
+ do
+ echo "$PROTECTED_MOUNTS" | grep -qs "^$DEV $MTPT " && continue
+ case "$MTPT" in
+ /|/proc|/dev|/.dev|/dev/pts|/dev/shm|/dev/.static/dev|/proc/*|/sys|/sys/*|/lib/init/rw)
+ continue
+ ;;
+ /var/run)
+ if [ yes = "$RAMRUN" ] ; then
+ continue
+ fi
+ ;;
+ /var/lock)
+ if [ yes = "$RAMLOCK" ] ; then
+ continue
+ fi
+ ;;
+ esac
+ case "$FSTYPE" in
+ proc|procfs|linprocfs|sysfs|usbfs|usbdevfs|devpts)
+ continue
+ ;;
+ tmpfs)
+ TMPFS_MTPTS="$MTPT $TMPFS_MTPTS"
+ ;;
+ *)
+ if echo "$PROTECTED_MOUNTS" | grep -qs "^$DEV "; then
+ WEAK_MTPTS="$MTPT $WEAK_MTPTS"
+ else
+ REG_MTPTS="$MTPT $REG_MTPTS"
+ fi
+ ;;
+ esac
+ done
+
+ exec 0<&9 9<&-
+
+ #
+ # Make sure tmpfs file systems are umounted before turning off
+ # swap, to avoid running out of memory if the tmpfs filesystems
+ # use a lot of space.
+ #
+ if [ "$TMPFS_MTPTS" ]
+ then
+ if [ "$VERBOSE" = no ]
+ then
+ log_action_begin_msg "Unmounting temporary filesystems"
+ fstab-decode umount $TMPFS_MTPTS
+ log_action_end_msg $?
+ else
+ log_daemon_msg "Will now unmount temporary filesystems"
+ fstab-decode umount -v $TMPFS_MTPTS
+ log_end_msg $?
+ fi
+ fi
+
+ #
+ # Deactivate swap
+ #
+ if [ "$VERBOSE" = no ]
+ then
+ log_action_begin_msg "Deactivating swap"
+ swapoff -a >/dev/null
+ log_action_end_msg $?
+ else
+ log_daemon_msg "Will now deactivate swap"
+ swapoff -a -v
+ log_end_msg $?
+ fi
+
+ #
+ # Unmount local filesystems
+ #
+ if [ "$WEAK_MTPTS" ]; then
+ # Do not use -f umount option for WEAK_MTPTS
+ if [ "$VERBOSE" = no ]
+ then
+ log_action_begin_msg "Unmounting weak filesystems"
+ fstab-decode umount -r -d $WEAK_MTPTS
+ log_action_end_msg $?
+ else
+ log_daemon_msg "Will now unmount weak filesystems"
+ fstab-decode umount -v -r -d $WEAK_MTPTS
+ log_end_msg $?
+ fi
+ fi
+ if [ "$REG_MTPTS" ]
+ then
+ if [ "$VERBOSE" = no ]
+ then
+ log_action_begin_msg "Unmounting local filesystems"
+ fstab-decode umount -f -r -d $REG_MTPTS
+ log_action_end_msg $?
+ else
+ log_daemon_msg "Will now unmount local filesystems"
+ fstab-decode umount -f -v -r -d $REG_MTPTS
+ log_end_msg $?
+ fi
+ fi
+}
+
+case "$1" in
+ start)
+ # No-op
+ ;;
+ restart|reload|force-reload)
+ echo "Error: argument '$1' not supported" >&2
+ exit 3
+ ;;
+ stop)
+ do_stop
+ ;;
+ *)
+ echo "Usage: $0 start|stop" >&2
+ exit 3
+ ;;
+esac
+
+:
diff --git a/beagle/debian-rfs/etc/init.d/umountnfs.sh b/beagle/debian-rfs/etc/init.d/umountnfs.sh
new file mode 100755
index 0000000..55fa96f
--- /dev/null
+++ b/beagle/debian-rfs/etc/init.d/umountnfs.sh
@@ -0,0 +1,108 @@
+#! /bin/sh
+### BEGIN INIT INFO
+# Provides: umountnfs
+# Required-Start:
+# Required-Stop: umountfs
+# Should-Stop: $network $portmap nfs-common
+# Default-Start:
+# Default-Stop: 0 6
+# Short-Description: Unmount all network filesystems except the root fs.
+# Description: Also unmounts all virtual filesystems (proc,
+# devpts, usbfs, sysfs) that are not mounted at the
+# top level.
+### END INIT INFO
+
+PATH=/sbin:/usr/sbin:/bin:/usr/bin
+KERNEL="$(uname -s)"
+RELEASE="$(uname -r)"
+. /lib/init/vars.sh
+
+. /lib/lsb/init-functions
+
+case "${KERNEL}:${RELEASE}" in
+ Linux:[01].*|Linux:2.[01].*)
+ FLAGS=""
+ ;;
+ Linux:2.[23].*|Linux:2.4.?|Linux:2.4.?-*|Linux:2.4.10|Linux:2.4.10-*)
+ FLAGS="-f"
+ ;;
+ *)
+ FLAGS="-f -l"
+ ;;
+esac
+
+do_stop () {
+ # Write a reboot record to /var/log/wtmp before unmounting
+ halt -w
+
+ # Remove bootclean flag files (precaution against symlink attacks)
+ rm -f /tmp/.clean /var/lock/.clean /var/run/.clean
+
+ #
+ # Make list of points to unmount in reverse order of their creation
+ #
+
+ exec 9<&0 </etc/mtab
+
+ DIRS=""
+ while read -r DEV MTPT FSTYPE OPTS REST
+ do
+ case "$MTPT" in
+ /|/proc|/dev|/dev/pts|/dev/shm|/proc/*|/sys|/lib/init/rw)
+ continue
+ ;;
+ /var/run)
+ if [ yes = "$RAMRUN" ] ; then
+ continue
+ fi
+ ;;
+ /var/lock)
+ if [ yes = "$RAMLOCK" ] ; then
+ continue
+ fi
+ ;;
+ esac
+ case "$FSTYPE" in
+ nfs|nfs4|smbfs|ncp|ncpfs|cifs|coda|ocfs2|gfs)
+ DIRS="$MTPT $DIRS"
+ ;;
+ proc|procfs|linprocfs|devpts|usbfs|usbdevfs|sysfs)
+ DIRS="$MTPT $DIRS"
+ ;;
+ esac
+ case "$OPTS" in
+ _netdev|*,_netdev|_netdev,*|*,_netdev,*)
+ DIRS="$MTPT $DIRS"
+ ;;
+ esac
+ done
+
+ exec 0<&9 9<&-
+
+ if [ "$DIRS" ]
+ then
+ [ "$VERBOSE" = no ] || log_action_begin_msg "Unmounting remote and non-toplevel virtual filesystems"
+ fstab-decode umount $FLAGS $DIRS
+ ES=$?
+ [ "$VERBOSE" = no ] || log_action_end_msg $ES
+ fi
+}
+
+case "$1" in
+ start)
+ # No-op
+ ;;
+ restart|reload|force-reload)
+ echo "Error: argument '$1' not supported" >&2
+ exit 3
+ ;;
+ stop|"")
+ do_stop
+ ;;
+ *)
+ echo "Usage: umountnfs.sh [start|stop]" >&2
+ exit 3
+ ;;
+esac
+
+:
diff --git a/beagle/debian-rfs/etc/init.d/umountroot b/beagle/debian-rfs/etc/init.d/umountroot
new file mode 100755
index 0000000..51c4eb8
--- /dev/null
+++ b/beagle/debian-rfs/etc/init.d/umountroot
@@ -0,0 +1,57 @@
+#! /bin/sh
+### BEGIN INIT INFO
+# Provides: umountroot
+# Required-Start:
+# Required-Stop:
+# Should-Stop: halt reboot kexec
+# Default-Start:
+# Default-Stop: 0 6
+# Short-Description: Mount the root filesystem read-only.
+### END INIT INFO
+
+PATH=/sbin:/bin
+. /lib/init/vars.sh
+
+. /lib/lsb/init-functions
+
+do_stop () {
+ [ "$VERBOSE" = no ] || log_action_begin_msg "Mounting root filesystem read-only"
+ # These directories must exist on the root filesystem as they are
+ # targets for system mountpoints. We've just unmounted all other
+ # filesystems, so either they are mounted now (in which case the
+ # mount point exists) or we can make the mountpoint.
+ for dir in /proc /sys /var/run /var/lock; do
+ mkdir -p $dir || true
+ done
+
+ MOUNT_FORCE_OPT=
+ [ "$(uname -s)" = "GNU/kFreeBSD" ] && MOUNT_FORCE_OPT=-f
+ # This:
+ # mount -n -o remount,ro /
+ # will act on a bind mount of / if there is one.
+ # See #339023 and the comment in checkroot.sh
+ mount $MOUNT_FORCE_OPT -n -o remount,ro -t dummytype dummydev / 2>/dev/null \
+ || mount $MOUNT_FORCE_OPT -n -o remount,ro dummydev / 2>/dev/null \
+ || mount $MOUNT_FORCE_OPT -n -o remount,ro /
+ ES=$?
+ [ "$VERBOSE" = no ] || log_action_end_msg $ES
+}
+
+case "$1" in
+ start)
+ # No-op
+ ;;
+ restart|reload|force-reload)
+ echo "Error: argument '$1' not supported" >&2
+ exit 3
+ ;;
+ stop)
+ do_stop
+ ;;
+ *)
+ echo "Usage: $0 start|stop" >&2
+ exit 3
+ ;;
+esac
+
+:
diff --git a/beagle/debian-rfs/etc/init.d/urandom b/beagle/debian-rfs/etc/init.d/urandom
new file mode 100755
index 0000000..bb28a07
--- /dev/null
+++ b/beagle/debian-rfs/etc/init.d/urandom
@@ -0,0 +1,79 @@
+#! /bin/sh
+### BEGIN INIT INFO
+# Provides: urandom
+# Required-Start: $local_fs
+# Required-Stop: $local_fs
+# Default-Start: S
+# Default-Stop: 0 6
+# Short-Description: Save and restore random seed between restarts.
+# Description: This script saves the random seed between restarts.
+# It is called from the boot, halt and reboot scripts.
+### END INIT INFO
+
+[ -c /dev/urandom ] || exit 0
+
+PATH=/sbin:/bin
+SAVEDFILE=/var/lib/urandom/random-seed
+POOLSIZE=512
+[ -f /proc/sys/kernel/random/poolsize ] && POOLSIZE="$(cat /proc/sys/kernel/random/poolsize)"
+. /lib/init/vars.sh
+
+. /lib/lsb/init-functions
+
+do_status () {
+ if [ -f $SAVEDFILE ] ; then
+ return 0
+ else
+ return 4
+ fi
+}
+
+case "$1" in
+ start|"")
+ [ "$VERBOSE" = no ] || log_action_begin_msg "Initializing random number generator"
+ # Load and then save $POOLSIZE bytes,
+ # which is the size of the entropy pool
+ if [ -f "$SAVEDFILE" ]
+ then
+ # Handle locally increased pool size
+ set -- $(LC_ALL=C ls -l "$SAVEDFILE")
+ SAVEDSIZE="$5"
+ if [ "$SAVEDSIZE" -gt "$POOLSIZE" ]
+ then
+ [ -w /proc/sys/kernel/random/poolsize ] && echo $POOLSIZE > /proc/sys/kernel/random/poolsize
+ POOLSIZE=$SAVEDSIZE
+ fi
+ cat "$SAVEDFILE" >/dev/urandom
+ fi
+ rm -f $SAVEDFILE
+ # Hm, why is the saved pool re-created at boot? [pere 2009-09-03]
+ umask 077
+ dd if=/dev/urandom of=$SAVEDFILE bs=$POOLSIZE count=1 >/dev/null 2>&1
+ ES=$?
+ umask 022
+ [ "$VERBOSE" = no ] || log_action_end_msg $ES
+ ;;
+ stop)
+ # Carry a random seed from shut-down to start-up;
+ # see documentation in linux/drivers/char/random.c
+ [ "$VERBOSE" = no ] || log_action_begin_msg "Saving random seed"
+ umask 077
+ dd if=/dev/urandom of=$SAVEDFILE bs=$POOLSIZE count=1 >/dev/null 2>&1
+ ES=$?
+ [ "$VERBOSE" = no ] || log_action_end_msg $ES
+ ;;
+ status)
+ do_status
+ exit $?
+ ;;
+ restart|reload|force-reload)
+ echo "Error: argument '$1' not supported" >&2
+ exit 3
+ ;;
+ *)
+ echo "Usage: urandom start|stop" >&2
+ exit 3
+ ;;
+esac
+
+: