From 6950e496815f69df7b50f4664b654ac6b3e4f7de Mon Sep 17 00:00:00 2001 From: John Bowler Date: Mon, 30 May 2005 06:12:33 +0000 Subject: Initscripts patch. This changes the order of the shutdown scripts in openslug to ensure that the network shutdown does not happen before network file systems have been unmounted. It also adds some missing scripts - hwclock.sh (load/save the hwclock, otherwise it gets loaded but not saved, in the absence of NTP). alignment.sh (added to openslug, was in 'arm' before), and umountfs (excluded from oe). The file system unmount scripts use /proc/mounts (not fstab) and unmount in the correct order (the old scripts only worked if nothing was mounted within a mounted file system). Scripts have been patched (openslug only patches) to make them work correctly with openslug NFS, flash and disk root and to arrange for syslog to run as long as possible (it's now in S/0/6, not in the user run levels). Directory struction of openslug-init has been tidied up, with all the initscripts in a sub-dirctory. initscritps-openslug is an openslug specific variant of initscripts which tracks it and fails safe (an update/change to initscripts will cause initscripts-openslug to fail rather than build strangeness). turnup also contains a fix for slugbug 150. BKrev: 429aaed1D-1XOdk8brF2bP9C9EEEJQ --- packages/openslug-init/openslug-init-0.10/turnup | 152 +++++++++++++++++++---- 1 file changed, 129 insertions(+), 23 deletions(-) (limited to 'packages/openslug-init/openslug-init-0.10/turnup') diff --git a/packages/openslug-init/openslug-init-0.10/turnup b/packages/openslug-init/openslug-init-0.10/turnup index b688bc3051..d22e15c208 100644 --- a/packages/openslug-init/openslug-init-0.10/turnup +++ b/packages/openslug-init/openslug-init-0.10/turnup @@ -8,6 +8,55 @@ # force: override certain checks force= # +# fstype new +# The type of the file system mounted on "new" Outputs the last +# piece of information found, which should be the one for the +# currently visible mount! +fstype() { + local cwd dev mp type options pass freq result + cwd="$(cd "$1"; /bin/pwd)" + result= + while read dev mp type options pass freq + do + case "$mp" in + "$cwd") result="$type";; + esac + done # Make sure the candidate rootfs is empty check_rootfs() { @@ -87,8 +136,8 @@ setup_dev() { return 1 } echo "done" >&2 - # now remove the startup links which mount the ramfs on /dev - rm "$1"/etc/rc?.d/[KS]??devices + # now prevent this being done each time + :>"$1"/dev/.permanent return 0 } @@ -128,8 +177,8 @@ setup_var() { echo "turnup: /var: could not populate directory" >&2 return 1 } - # and remove the startup links - rm "$1"/etc/rc?.d/[KS]??populate-var.sh + # the startup link is left for the moment, this seems safer + #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 @@ -138,10 +187,9 @@ setup_var() { echo "turnup: tmpfs /var mount moved to /var/tmp" >&2;; esac # - # warn the user - it's not enough to put the /var mount back, it - # is necessary to reinsert the populate-var.sh links! - echo " If you remount tmpfs on /var it must be populated at boot, use:" >&2 - echo " update-rc.d populate-var.sh start 37 S ." >&2 + # Previous versions of turnup removed populate-var.sh from the + # startup links, this one doesn't, so /var can be made back into + # a tmpfs just by a change to /etc/fstab. return 0 } @@ -224,6 +272,23 @@ setup_rootfs() { # return code of last setup function } +# +# setup_fstab new fsdev fstype fsoptions +# Alters the /etc/fstab entry for / to refer to the correct device and +# have the correct type and options. Essential for checkroot to remount +# / 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 + 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 + echo " to ensure that the root partition is mounted correctly" >&2 + return 1 + } +} + + # # boot_rootfs [options] # Change the flash partition (not the current root!) to boot off @@ -342,7 +407,7 @@ mountflash() { # disk [-m] [-i] [-s