diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2009-06-03 23:44:54 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2009-06-03 23:44:54 +0000 |
commit | e8877b75733dcf628ddaf0bbd789002f71c88efe (patch) | |
tree | 7990584bb0bb9a18bc3b137e18b35ecd454b7d9b /distrib/miniroot/dot.profile | |
parent | ddaa8b7f4cc533663f83963b7ce1af897682ef2e (diff) |
Add hw.machine and kern.osrelease to install media sysctl. Using
these rather than hard coded variables allows the rationalization
of the greeting by moving it into dot.profile. Whack at dot.profile
a lot. Eliminate the 'Proceed with ...' question as unneeded.
Eliminate welcome().
ok deraadt@ "I like" todd@
Diffstat (limited to 'distrib/miniroot/dot.profile')
-rw-r--r-- | distrib/miniroot/dot.profile | 75 |
1 files changed, 48 insertions, 27 deletions
diff --git a/distrib/miniroot/dot.profile b/distrib/miniroot/dot.profile index 871c731a538..f2f85485a40 100644 --- a/distrib/miniroot/dot.profile +++ b/distrib/miniroot/dot.profile @@ -1,6 +1,7 @@ -# $OpenBSD: dot.profile,v 1.8 2008/08/03 14:18:00 krw Exp $ +# $OpenBSD: dot.profile,v 1.9 2009/06/03 23:44:53 krw Exp $ # $NetBSD: dot.profile,v 1.1 1995/12/18 22:54:43 pk Exp $ # +# Copyright (c) 2009 Kenneth R. Westerback # Copyright (c) 1995 Jason R. Thorpe # Copyright (c) 1994 Christopher G. Demetriou # All rights reserved. @@ -31,39 +32,59 @@ # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # +export VNAME=$(sysctl -n kern.osrelease) +export VERSION="${VNAME%.*}${VNAME#*.}" +export ARCH=$(sysctl -n hw.machine) +export OBSD="OpenBSD/$ARCH $VNAME" + export PATH=/sbin:/bin:/usr/bin:/usr/sbin:/ umask 022 # emacs-style command line editing set -o emacs -# Extract rootdisk from last 'root on wd0a swap on wd0b dump on wd0b' line. -set -- `dmesg | sed -n '/^root on /h;${g;p;}'` +# Extract rootdisk from last 'root on ...' line. e.g. +# root on wd0a swap on wd0b dump on wd0b +set -- $(dmesg | sed -n '/^root on /h;${g;p;}') rootdisk=$3 -if [ "X${DONEPROFILE}" = "X" ]; then - DONEPROFILE=YES +mount -u /dev/${rootdisk:-rd0a} / + +# set up some sane defaults +echo 'erase ^?, werase ^W, kill ^U, intr ^C, status ^T' +stty newcrt werase ^W intr ^C kill ^U erase ^? status ^T + +# Installing or upgrading? +while :; do + cat <<__EOT + +Welcome to the $OBSD installation program. + +This program can install $OBSD, or upgrade an existing +OpenBSD installation. + +At any prompt except password prompts you can escape to a shell by +typing '!'. Default answers are shown in []'s and are selected by +pressing RETURN. At any time you can exit this program by pressing +Control-C, but exiting during an $MODE can leave your system in an +inconsistent state. - mount -u /dev/${rootdisk:-rd0a} / +__EOT + read REPLY?'(I)nstall, (U)pgrade or (S)hell? ' + case $REPLY in + i*|I*) echo "\nCool! Let's get to it." + /install && break + ;; + u*|U*) + cat <<__EOT - # set up some sane defaults - echo 'erase ^?, werase ^W, kill ^U, intr ^C, status ^T' - stty newcrt werase ^W intr ^C kill ^U erase ^? status ^T +NOTE: Once your system has been upgraded, you must manually merge any +changes to files in the 'etc' set into the files already on your system. +sysmerge(8) can help. - # Installing or upgrading? - _forceloop="" - while [ "X$_forceloop" = "X" ]; do - echo -n '(I)nstall' - [ -f upgrade ] && echo -n ', (U)pgrade' - echo -n ' or (S)hell? ' - read _forceloop - case "$_forceloop" in - i*|I*) /install - ;; - u*|U*) /upgrade - ;; - s*|S*) ;; - *) _forceloop="" - ;; - esac - done -fi +__EOT + /upgrade && break + ;; + s*|S*) break + ;; + esac +done |