dot.profile revision 1.4
11.4Smartin# $NetBSD: dot.profile,v 1.4 2010/03/12 21:36:52 martin 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.4Smartin# There is no /var/db/dev.db, so sysctl might not map the devicename properly; 421.4Smartin# ttyE0 is 90,0 -> 0x5a00 431.4Smartincase $(sysctl kern.consdev 2>/dev/null) in 441.4Smartin kern.consdev\ =\ ttyE*|kern.consdev\ =\ 0x5a0*) 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.1Slukem 601.1Slukemumask 022 611.1Slukem 621.1Slukemif [ "X${DONEPROFILE}" = "X" ]; then 631.1Slukem DONEPROFILE=YES 641.1Slukem export DONEPROFILE 651.1Slukem 661.1Slukem # set up some sane defaults 671.1Slukem echo 'erase ^?, werase ^W, kill ^U, intr ^C' 681.1Slukem stty newcrt werase ^W intr ^C kill ^U erase ^? 9600 691.1Slukem echo '' 701.1Slukem 711.4Smartin if [ $TERM != "wsvt25" ]; then 721.4Smartin cat << "EOM" 731.4SmartinYou are using a serial console, we do not know your terminal emulation. 741.4SmartinPlease select one, typical values are: 751.4Smartin 761.4Smartin vt100 771.4Smartin ansi 781.4Smartin xterm 791.4Smartin 801.4SmartinEOM 811.4Smartin echo -n "Terminal type (just hit ENTER for '$TERM'): " 821.4Smartin read ans 831.4Smartin if [ -n "$ans" ];then 841.4Smartin TERM=$ans 851.4Smartin fi 861.1Slukem fi 871.1Slukem 881.1Slukem # mount the kern_fs so that we can find the root device, and also 891.1Slukem # examine the dmesg state 901.1Slukem mount -t kernfs /kern /kern 911.1Slukem 921.1Slukem # hack to get around bugs in kernfs's rootdev/rrootdev lookup. 931.1Slukem ls -l /dev/* > /dev/null 2>&1 941.1Slukem 951.1Slukem # mount the ramdisk read write 961.1Slukem mount -t ffs -u /kern/rootdev / 971.1Slukem 981.1Slukem # run the installation or upgrade script. 991.4Smartin sysinst || { 1001.4Smartin echo "Oops, something went wrong - we will try again"; exit; } 1011.1Slukemfi 102