fs

morpheus filesystem files
git clone git://git.2f30.org/fs
Log | Files | Refs

commit 1dc5dce230108e6e5f9aff95d1497630af7b029d
parent ca49ede9567913a96563be9cd87dcad71ef431be
Author: sin <sin@2f30.org>
Date:   Mon, 23 Sep 2013 13:34:55 +0100

Use busybox init

Diffstat:
Dbin/poweroff | 15---------------
Dbin/reboot | 15---------------
Aetc/inittab | 13+++++++++++++
Detc/rc | 62--------------------------------------------------------------
Aetc/rc.boot | 53+++++++++++++++++++++++++++++++++++++++++++++++++++++
Aetc/rc.local | 1+
Aetc/rc.multi | 17+++++++++++++++++
Aetc/rc.shutdown | 26++++++++++++++++++++++++++
Dinit | 9---------
9 files changed, 110 insertions(+), 101 deletions(-)

diff --git a/bin/poweroff b/bin/poweroff @@ -1,15 +0,0 @@ -#!/bin/sh - -. /etc/rc.conf - -echo $SVC | sed 's/ /\n/g' | tac | while read s; do - echo Stopping $s - /etc/rc.d/$s stop -done - -echo Remounting root as read-only -mount -o remount, ro / -echo Syncing... -sync -sync -halt -p diff --git a/bin/reboot b/bin/reboot @@ -1,15 +0,0 @@ -#!/bin/sh - -. /etc/rc.conf - -echo $SVC | sed 's/ /\n/g' | tac | while read s; do - echo Stopping $s - /etc/rc.d/$s stop -done - -echo Remounting root as read-only -mount -o remount, ro / -echo Syncing... -sync -sync -halt -r diff --git a/etc/inittab b/etc/inittab @@ -0,0 +1,13 @@ +# Note that busybox uses a non-standard inittab. + +::sysinit:/etc/rc.boot +::once:/bin/rc.multi + +tty1::respawn:/bin/getty 38400 tty1 linux +tty2::respawn:/bin/getty 38400 tty2 linux +tty3::respawn:/bin/getty 38400 tty3 linux +tty4::respawn:/bin/getty 38400 tty4 linux + +::ctrlaltdel:/bin/busybox reboot -d 3 +::restart:/bin/busybox init +::shutdown:/bin/rc.shutdown diff --git a/etc/rc b/etc/rc @@ -1,62 +0,0 @@ -. /etc/rc.conf - -echo -echo -echo " Morpheus booting" -echo -echo - -echo Mounting filesystems -mkdir -p /dev/pts /dev/shm -mkdir -p /sys -mkdir -p /proc -mount -n -t proc proc /proc -mount -n -t sysfs sysfs /sys -mount -n -t devpts devpts /dev/pts - -echo Running smdev -smdev -s - -echo Setting smdev as the kernel hotplug -echo /bin/smdev > /proc/sys/kernel/hotplug - -echo "Setting hostname to $HOSTNAME" -hostname $HOSTNAME - -HWCLOCK_PARAMS="-s" -case $HARDWARECLOCK in - "") - ;; - UTC) - HWCLOCK_PARAMS="${HWCLOCK_PARAMS} -u" - ;; - localtime) - HWCLOCK_PARAMS="${HWCLOCK_PARAMS} -l" - ;; - *) - HWCLOCK_PARAMS="" - ;; -esac - -if [ -n "$HWCLOCK_PARAMS" ]; then - echo Setting hwclock - [ -n "$TIMEZONE" ] && export TZ="$TIMEZONE" - hwclock $HWCLOCK_PARAMS - unset TZ -fi - -ifconfig lo up - -echo Storing dmesg output to /var/log/dmesg.log -dmesg > /var/log/dmesg.log - -echo Generating dropbear keys -if [ -x /etc/dropbearkeys ]; then - /etc/dropbearkeys -fi -chmod 644 /etc/dropbearkeys - -for s in $SVC; do - echo Starting $s - /etc/rc.d/$s start -done diff --git a/etc/rc.boot b/etc/rc.boot @@ -0,0 +1,53 @@ +#!/bin/sh + +. /etc/rc.conf + +echo +echo +echo " Morpheus booting" +echo +echo + +echo Mounting filesystems +mkdir -p /dev/pts /dev/shm +mkdir -p /sys +mkdir -p /proc +mount -n -t proc proc /proc +mount -n -t sysfs sysfs /sys +mount -n -t devpts devpts /dev/pts + +echo Running smdev +smdev -s + +echo Setting smdev as the kernel hotplug +echo /bin/smdev > /proc/sys/kernel/hotplug + +echo "Setting hostname to $HOSTNAME" +hostname $HOSTNAME + +ifconfig lo up + +HWCLOCK_PARAMS="-s" +case $HARDWARECLOCK in + "") + ;; + UTC) + HWCLOCK_PARAMS="${HWCLOCK_PARAMS} -u" + ;; + localtime) + HWCLOCK_PARAMS="${HWCLOCK_PARAMS} -l" + ;; + *) + HWCLOCK_PARAMS="" + ;; +esac + +if [ -n "$HWCLOCK_PARAMS" ]; then + echo Setting hwclock + [ -n "$TIMEZONE" ] && export TZ="$TIMEZONE" + hwclock $HWCLOCK_PARAMS + unset TZ +fi + +echo Storing dmesg output to /var/log/dmesg.log +dmesg > /var/log/dmesg.log diff --git a/etc/rc.local b/etc/rc.local @@ -0,0 +1 @@ +#!/bin/sh diff --git a/etc/rc.multi b/etc/rc.multi @@ -0,0 +1,17 @@ +#!/bin/sh + +. /etc/rc.conf + +echo Generating dropbear keys +if [ -x /etc/dropbearkeys ]; then + /etc/dropbearkeys +fi +chmod 644 /etc/dropbearkeys + +for s in $SVC; do + echo Starting $s + /etc/rc.d/$s start +done + +echo Running rc.local +[ -x /etc/rc.local ] && /bin/rc.local diff --git a/etc/rc.shutdown b/etc/rc.shutdown @@ -0,0 +1,26 @@ +#!/bin/sh +PATH=/bin + +. /etc/rc.conf + +echo shutting down + +hwclock -u -w + +echo $SVC | sed 's/ /\n/g' | tac | while read s; do + echo Stopping $s + /etc/rc.d/$s stop +done + +killall5 -15 +sleep 5 +killall5 -9 + +dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2>/dev/null + +echo Mounting root read-only +mount -o remount,ro / + +sync +sleep 3 +wait diff --git a/init b/init @@ -1,9 +0,0 @@ -#!/bin/sh - -export PATH=/bin:/sbin - -. /etc/rc - -while :; do - /bin/getty 38400 tty1 linux -done