summaryrefslogtreecommitdiff
path: root/packages/openslug-init/openslug-init-0.10
diff options
context:
space:
mode:
authorJohn Bowler <jbowler@nslu2-linux.org>2005-06-19 17:37:12 +0000
committerJohn Bowler <jbowler@nslu2-linux.org>2005-06-19 17:37:12 +0000
commit32a426d6ac1b040e4e54047ed25a51da574d8ff5 (patch)
tree8ff5567a60a4136aa6ebcefd805345b0d69038b8 /packages/openslug-init/openslug-init-0.10
parentd928b8f09a9fcc88cd464db086c2a0b1e5703f7d (diff)
Boot recovery and turnup fixes
BKrev: 42b5ad48iyguDIZgY5zIazJA42ia2g
Diffstat (limited to 'packages/openslug-init/openslug-init-0.10')
-rw-r--r--packages/openslug-init/openslug-init-0.10/boot/disk49
-rw-r--r--packages/openslug-init/openslug-init-0.10/turnup6
2 files changed, 52 insertions, 3 deletions
diff --git a/packages/openslug-init/openslug-init-0.10/boot/disk b/packages/openslug-init/openslug-init-0.10/boot/disk
index e69de29bb2..ede33a3ee6 100644
--- a/packages/openslug-init/openslug-init-0.10/boot/disk
+++ b/packages/openslug-init/openslug-init-0.10/boot/disk
@@ -0,0 +1,49 @@
+#!/bin/sh
+# boot from the hard disk partition "$1" (which
+# must be given) using options from the rest of
+# the command line.
+#
+/sbin/leds -A '!gr'
+#
+# Use the standard init path (see /etc/init.d/rcS)
+export PATH=/sbin:/bin:/usr/sbin:/usr/bin
+#
+# Load the helper functions
+. /etc/default/functions
+#
+if test -n "$1"
+then
+ device="$1"
+ shift
+ echo "boot: rootfs: mount $* $device"
+ #
+ # wait if required
+ test "$sleep" -gt 0 && sleep "$sleep"
+ #
+ # Mount read-write because before exec'ing init
+ # this script creates the '.recovery' link to
+ # detect failed boot. No file type is given to
+ if mount "$@" "$device" /mnt
+ then
+ # checkmount checks for sh, init and no
+ # .recovery plus either mnt or initrd
+ if checkmount /mnt && :>/mnt/.recovery
+ then
+ # sync to ensure .recovery is written
+ sync
+ # pivot to /initrd if available, else /mnt
+ cd /
+ if test -d /mnt/initrd
+ then
+ swivel mnt initrd
+ else
+ swivel mnt mnt
+ fi
+ # swivel failed
+ fi
+ # Failure: unmount the partition
+ umount /mnt
+ fi
+fi
+# fallback - use the flash boot
+exec /boot/flash
diff --git a/packages/openslug-init/openslug-init-0.10/turnup b/packages/openslug-init/openslug-init-0.10/turnup
index ade85f0533..14756fc661 100644
--- a/packages/openslug-init/openslug-init-0.10/turnup
+++ b/packages/openslug-init/openslug-init-0.10/turnup
@@ -182,9 +182,9 @@ setup_var() {
#rm "$1"/etc/rc?.d/[KS]??populate-var.sh
# remove the /var tmpfs entry from the new /etc/fstab
case "$2" in
- disk) sed -i '\@\s/var\s\s*tmpfs\s@d' "$1"/etc/fstab
+ disk) sed -i '\@[ ]/var[ ][ ]*tmpfs[ ]@d' "$1"/etc/fstab
echo "turnup: tmpfs will no longer be mounted on /var" >&2;;
- nfs) sed -i '\@\s/var\s\s*tmpfs\s@s@\s/var@&/tmp@' "$1"/etc/fstab
+ nfs) sed -i '\@[ ]/var[ ][ ]*tmpfs[ ]@s@[ ]/var@&/tmp@' "$1"/etc/fstab
echo "turnup: tmpfs /var mount moved to /var/tmp" >&2;;
esac
#
@@ -280,7 +280,7 @@ setup_rootfs() {
# / with the correct options.
# bad, since sed won't fail even if it changes nothing.
setup_fstab() {
- sed -i '\@^[^ ]*\s\s*/\s@s@^.*$@'"$2 / $3 $4 1 1"'@' "$1"/etc/fstab
+ sed -i '\@^[^ ]*[ ][ ]*/[ ]@s@^.*$@'"$2 / $3 $4 1 1"'@' "$1"/etc/fstab
egrep -q "^$2 / $3 $4 1 1\$" "$1"/etc/fstab || {
echo "turnup: /etc/fstab: root(/) entry not changed" >&2
echo " you probably need to check the options in /etc/fstab" >&2