tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

/sbin/fast{boot,halt}



A while ago, my attention was drawn to a script that arranged for
the root filesystem to be read only, and them immediately afterwards
did "rm /fastboot"...

That's clearly never going to work - of course, on a read only root,
/fastboot will never (normally) exist in the first place.

I had intended to file a PR, and ask that the offending "rm" line
be removed (from the standard NetBSD rc scripts) on the assumption that
it was an ancient relic that no-one had notiiced, I had assumed that
the fastboot and fasthalt scripts had long gone.

But no, they're still around.  I cannot imagine that anyone uses them
any more, they come from a time when neither fsck -p nor (more importantly)
the file system "clean" flag existed, and where a reboot could take a
half hour or more if all the fsck's were allowed to complete (this was
also pre networking, and so obviously, pre NFS, so development systems
need to have (for the time) lots of space with lots of files).

Personally, I'd be quite happy to see them vanish (the scripts from
/sbin and all support for them from the startup scripts).

If that's too radical, then please at least consider replacing the
scripts by the following.   The current scripts are examples of
copyright noise gone wild (each is approx 2KB containing about 50 bytes
that aren't comments).

This is a single script that can be linked to both /fastboot and /fasthalt
(I guess someone will ened to add a $NetBSD$ comment line to it...)

The script is appended below (no MIME noise, it is simple).

#! /bin/sh

# fastboot / fasthalt
# Derived (but not copied) from BSD programs (scripts) of the same name.
# This file is explicitly (unconditionally) released to the public domain.

set -e
>/fastboot
/bin/sync

case "$0" in
*halt) exec /sbin/halt "$@" ;;
*boot) exec /sbin/reboot "$@" ;;
esac

/bin/rm -f /fastboot
echo "What Am I?" >&2
exit 1



Home | Main Index | Thread Index | Old Index