install.sh revision 1.1
11.1Smartin#! /bin/sh
21.1Smartin# $NetBSD: install.sh,v 1.1 2010/04/19 04:41:36 martin Exp $
31.1Smartin#
41.1Smartin# -
51.1Smartin#  Copyright (c) 2010 The NetBSD Foundation, Inc.
61.1Smartin#  All rights reserved.
71.1Smartin# 
81.1Smartin#  This code is derived from software contributed to The NetBSD Foundation
91.1Smartin#  by Martin Husemann <martin@NetBSD.org>.
101.1Smartin# 
111.1Smartin#  Redistribution and use in source and binary forms, with or without
121.1Smartin#  modification, are permitted provided that the following conditions
131.1Smartin#  are met:
141.1Smartin#  1. Redistributions of source code must retain the above copyright
151.1Smartin#     notice, this list of conditions and the following disclaimer.
161.1Smartin#  2. Redistributions in binary form must reproduce the above copyright
171.1Smartin#     notice, this list of conditions and the following disclaimer in the
181.1Smartin#     documentation and/or other materials provided with the distribution.
191.1Smartin# 
201.1Smartin#  THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
211.1Smartin#  ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
221.1Smartin#  TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
231.1Smartin#  PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
241.1Smartin#  BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
251.1Smartin#  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
261.1Smartin#  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
271.1Smartin#  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
281.1Smartin#  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
291.1Smartin#  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
301.1Smartin#  POSSIBILITY OF SUCH DAMAGE.
311.1Smartin
321.1Smartin
331.1Smartin# setup basic environment
341.1SmartinPATH=/sbin:/bin:/usr/bin:/usr/sbin:/
351.1Smartinexport PATH
361.1Smartin
371.1Smartin# Check if we are on a framebuffer or on serial console and default
381.1Smartin# the terminal type accordingly.
391.1Smartin# There is no /var/db/dev.db, so sysctl might not map the devicename properly;
401.1Smartin# ttyE0 is 90,0 -> 0x5a00
411.1Smartincase $(sysctl -nx kern.consdev) in
421.1Smartin 002f000000000000)
431.1Smartin   TERM=wsvt25
441.1Smartin   ;;
451.1Smartin *)
461.1Smartin   TERM=vt220
471.1Smartin   ;;
481.1Smartinesac
491.1Smartin
501.1Smartinexport TERM
511.1SmartinHOME=/
521.1Smartinexport HOME
531.1SmartinBLOCKSIZE=1k
541.1Smartinexport BLOCKSIZE
551.1SmartinEDITOR=ed
561.1Smartinexport EDITOR
571.1Smartin
581.1Smartinumask 022
591.1Smartin
601.1Smartinstty newcrt werase ^W intr ^C kill ^U erase ^?
611.1Smartinif [ $TERM != "wsvt25" ]; then
621.1Smartin	cat << "EOM"
631.1Smartin
641.1Smartin
651.1SmartinYou are using a serial console, we do not know your terminal emulation.
661.1SmartinPlease select one, typical values are:
671.1Smartin
681.1Smartin	vt100
691.1Smartin	ansi
701.1Smartin	xterm
711.1Smartin
721.1SmartinEOM
731.1Smartin	echo -n "Terminal type (just hit ENTER for '$TERM'): "
741.1Smartin	read ans
751.1Smartin	if [ -n "$ans" ];then
761.1Smartin	    TERM=$ans
771.1Smartin	fi
781.1Smartinfi
791.1Smartin
801.1Smartin# run the installation or upgrade script.
811.1Smartin/sysinst || {
821.1Smartin	    echo "Oops, something went wrong - we will try again"; exit; }
831.1Smartin
841.1Smartinecho "To return to the installer, quit this shell by typing 'exit' or ^D."
851.1Smartinexec /bin/sh
86