diff options
Diffstat (limited to 'distrib/sparc/floppies/upgr/dot.profile')
-rw-r--r-- | distrib/sparc/floppies/upgr/dot.profile | 76 |
1 files changed, 70 insertions, 6 deletions
diff --git a/distrib/sparc/floppies/upgr/dot.profile b/distrib/sparc/floppies/upgr/dot.profile index ab45a640172..6cf74e029dd 100644 --- a/distrib/sparc/floppies/upgr/dot.profile +++ b/distrib/sparc/floppies/upgr/dot.profile @@ -1,4 +1,4 @@ -# $OpenBSD: dot.profile,v 1.2 1997/05/01 11:30:58 niklas Exp $ +# $OpenBSD: dot.profile,v 1.3 1997/05/05 16:31:39 grr Exp $ # # Copyright (c) 1994 Christopher G. Demetriou # All rights reserved. @@ -31,18 +31,82 @@ PATH=/sbin:/bin:/usr/bin:/usr/sbin:/ export PATH -TERM=pc3 -export TERM umask 022 +# XXX +# the TERM/EDITOR stuff is really well enough parameterized to be moved +# into install.sub where it could use the routines there and be invoked +# from the various (semi) MI install and upgrade scripts + +# terminals believed to be in termcap, default TERM +TERMS="sun vt100 dumb" +TERM=sun + +# editors believed to be in $EDITBIN, smart and dumb defaults +EDITORS="ed" +EDITOR=ed +DUMB=ed +EDITBIN=/bin + if [ "X${DONEPROFILE}" = "X" ]; then DONEPROFILE=YES + # mount kernfs and re-mount the boot media (perhaps r/w) + mount_kernfs /kern /kern + mount_ffs -o update /kern/rootdev / + # set up some sane defaults - echo 'erase ^?, werase ^W, kill ^U, intr ^C' - stty newcrt werase ^W intr ^C kill ^U erase ^? 9600 - echo '' + echo 'erase ^H, werase ^W, kill ^U, intr ^C' + stty newcrt werase ^W intr ^C kill ^U erase ^H 9600 + + # get the terminal type + _forceloop="" + while [ "X$_forceloop" = X"" ]; do + echo "Supported terminals are: $TERMS" + eval `tset -s -m ":?$TERM"` + if [ "X$TERM" != X"unknown" ]; then + _forceloop="done" + fi + done + export TERM + + # get the editor preference + if [ "X$TERM" = "Xdumb" -o "X$TERM" = "Xunknown" ]; then + echo -n "$TERM can't handle $EDITOR" + EDITOR="$DUMB" + echo ", using $EDITOR as text editor!" + elif [ "X$EDITOR" = "X$EDITORS" ]; then + echo "Only one editor available, you get to use $EDITOR!" + else + _forceloop="" + while [ "X$_forceloop" = X"" ]; do + echo "Supported editors are: $EDITORS" + echo -n "text editor? [$EDITOR] " + read _choice + if [ "X$_choice" = "X" ]; then + _choice="$EDITOR" + _forceloop="$_choice" + else + for _editor in $EDITORS; do + if [ "X$_choice" = "X$_editor" ]; then + _forceloop="$_choice" + break + fi + done + fi + if [ "X$_forceloop" != "X" -a ! -x $EDITBIN/$_choice ] + then + _forceloop="" + fi + if [ "X$_forceloop" = "X" ]; then + echo "Sorry, $_choice isn't available." + _forceloop="" + fi + done + EDITOR="$_choice" + fi + export EDITOR # pull in the functions that people will use from the shell prompt. . /.commonutils |