dot.profile revision 1.7
11.7Sjoerg# $NetBSD: dot.profile,v 1.7 2012/06/03 21:42:45 joerg Exp $
21.1Slukem#
31.1Slukem# Copyright (c) 1997 Perry E. Metzger
41.1Slukem# Copyright (c) 1994 Christopher G. Demetriou
51.1Slukem# All rights reserved.
61.1Slukem# 
71.1Slukem# Redistribution and use in source and binary forms, with or without
81.1Slukem# modification, are permitted provided that the following conditions
91.1Slukem# are met:
101.1Slukem# 1. Redistributions of source code must retain the above copyright
111.1Slukem#    notice, this list of conditions and the following disclaimer.
121.1Slukem# 2. Redistributions in binary form must reproduce the above copyright
131.1Slukem#    notice, this list of conditions and the following disclaimer in the
141.1Slukem#    documentation and/or other materials provided with the distribution.
151.1Slukem# 3. All advertising materials mentioning features or use of this software
161.1Slukem#    must display the following acknowledgement:
171.1Slukem#          This product includes software developed for the
181.3Ssalo#          NetBSD Project.  See http://www.NetBSD.org/ for
191.1Slukem#          information about NetBSD.
201.1Slukem# 4. The name of the author may not be used to endorse or promote products
211.1Slukem#    derived from this software without specific prior written permission.
221.1Slukem# 
231.1Slukem# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
241.1Slukem# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
251.1Slukem# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
261.1Slukem# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
271.1Slukem# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
281.1Slukem# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
291.1Slukem# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
301.1Slukem# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
311.1Slukem# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
321.1Slukem# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
331.1Slukem# 
341.1Slukem# <<Id: LICENSE,v 1.2 2000/06/14 15:57:33 cgd Exp>>
351.1Slukem
361.1SlukemPATH=/sbin:/bin:/usr/bin:/usr/sbin:/
371.1Slukemexport PATH
381.1Slukem
391.4Smartin# Check if we are on a framebuffer or on serial console and default
401.4Smartin# the terminal type accordingly.
411.7Sjoerg# There is no /var/db/dev.cdb, so sysctl might not map the devicename properly;
421.4Smartin# ttyE0 is 90,0 -> 0x5a00
431.5Smartincase $(sysctl -nx kern.consdev) in
441.5Smartin 0000000000005a0*)
451.4Smartin   TERM=wsvt25
461.4Smartin   ;;
471.4Smartin *)
481.4Smartin   TERM=vt220
491.4Smartin   ;;
501.4Smartinesac
511.4Smartin
521.1Slukemexport TERM
531.1SlukemHOME=/
541.1Slukemexport HOME
551.1SlukemBLOCKSIZE=1k
561.1Slukemexport BLOCKSIZE
571.1SlukemEDITOR=ed
581.1Slukemexport EDITOR
591.6SmartinSHELL=/bin/sh
601.6Smartinexport SHELL
611.1Slukem
621.1Slukemumask 022
631.1Slukem
641.1Slukemif [ "X${DONEPROFILE}" = "X" ]; then
651.1Slukem	DONEPROFILE=YES
661.1Slukem	export DONEPROFILE
671.1Slukem
681.1Slukem	# set up some sane defaults
691.1Slukem	echo 'erase ^?, werase ^W, kill ^U, intr ^C'
701.1Slukem	stty newcrt werase ^W intr ^C kill ^U erase ^? 9600
711.1Slukem	echo ''
721.1Slukem
731.4Smartin	if [ $TERM != "wsvt25" ]; then
741.4Smartin		cat << "EOM"
751.4SmartinYou are using a serial console, we do not know your terminal emulation.
761.4SmartinPlease select one, typical values are:
771.4Smartin
781.4Smartin	vt100
791.4Smartin	ansi
801.4Smartin	xterm
811.4Smartin
821.4SmartinEOM
831.4Smartin		echo -n "Terminal type (just hit ENTER for '$TERM'): "
841.4Smartin		read ans
851.4Smartin		if [ -n "$ans" ];then
861.4Smartin		    TERM=$ans
871.4Smartin		fi
881.1Slukem	fi
891.1Slukem
901.1Slukem	# mount the kern_fs so that we can find the root device, and also
911.1Slukem	# examine the dmesg state
921.1Slukem	mount -t kernfs /kern /kern
931.1Slukem
941.1Slukem	# hack to get around bugs in kernfs's rootdev/rrootdev lookup.
951.1Slukem	ls -l /dev/* > /dev/null 2>&1
961.1Slukem
971.1Slukem	# mount the ramdisk read write
981.1Slukem	mount -t ffs -u /kern/rootdev /
991.1Slukem
1001.1Slukem	# run the installation or upgrade script.
1011.6Smartin	sysinst
1021.6Smartin	if [ $? = 4 ]; then
1031.6Smartin		echo "Oops, something went wrong - we will try again"
1041.6Smartin		exit
1051.6Smartin	fi
1061.6Smartin	echo
1071.6Smartin	echo "To return to the installer, quit this shell by typing 'exit'" \
1081.6Smartin		"or ^D."
1091.1Slukemfi
110