install.sh revision 1.1 1 1.1 jym #! /bin/sh
2 1.1 jym # $NetBSD: install.sh,v 1.1 2011/01/18 00:16:13 jym Exp $
3 1.1 jym #
4 1.1 jym # -
5 1.1 jym # Copyright (c) 2010 The NetBSD Foundation, Inc.
6 1.1 jym # All rights reserved.
7 1.1 jym #
8 1.1 jym # This code is derived from software contributed to The NetBSD Foundation
9 1.1 jym # by Martin Husemann <martin (at] NetBSD.org>.
10 1.1 jym #
11 1.1 jym # Redistribution and use in source and binary forms, with or without
12 1.1 jym # modification, are permitted provided that the following conditions
13 1.1 jym # are met:
14 1.1 jym # 1. Redistributions of source code must retain the above copyright
15 1.1 jym # notice, this list of conditions and the following disclaimer.
16 1.1 jym # 2. Redistributions in binary form must reproduce the above copyright
17 1.1 jym # notice, this list of conditions and the following disclaimer in the
18 1.1 jym # documentation and/or other materials provided with the distribution.
19 1.1 jym #
20 1.1 jym # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
21 1.1 jym # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22 1.1 jym # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 1.1 jym # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
24 1.1 jym # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 1.1 jym # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 1.1 jym # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 1.1 jym # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 1.1 jym # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 1.1 jym # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 1.1 jym # POSSIBILITY OF SUCH DAMAGE.
31 1.1 jym
32 1.1 jym
33 1.1 jym # setup basic environment
34 1.1 jym PATH=/sbin:/bin:/usr/bin:/usr/sbin:/
35 1.1 jym export PATH
36 1.1 jym
37 1.1 jym # Check if we are on a framebuffer or on serial console and default
38 1.1 jym # the terminal type accordingly.
39 1.1 jym # There is no /var/db/dev.db, so sysctl might not map the devicename properly;
40 1.1 jym # ttyE0 is 90,0 -> 0x5a00
41 1.1 jym case $(sysctl -nx kern.consdev) in
42 1.1 jym 002f000000000000)
43 1.1 jym TERM=wsvt25
44 1.1 jym ;;
45 1.1 jym *)
46 1.1 jym TERM=vt220
47 1.1 jym ;;
48 1.1 jym esac
49 1.1 jym
50 1.1 jym export TERM
51 1.1 jym HOME=/
52 1.1 jym export HOME
53 1.1 jym BLOCKSIZE=1k
54 1.1 jym export BLOCKSIZE
55 1.1 jym EDITOR=ed
56 1.1 jym export EDITOR
57 1.1 jym
58 1.1 jym umask 022
59 1.1 jym
60 1.1 jym stty newcrt werase ^W intr ^C kill ^U erase ^?
61 1.1 jym if [ $TERM != "wsvt25" ]; then
62 1.1 jym cat << "EOM"
63 1.1 jym
64 1.1 jym
65 1.1 jym You are using a serial console, we do not know your terminal emulation.
66 1.1 jym Please select one, typical values are:
67 1.1 jym
68 1.1 jym vt100
69 1.1 jym ansi
70 1.1 jym xterm
71 1.1 jym
72 1.1 jym EOM
73 1.1 jym echo -n "Terminal type (just hit ENTER for '$TERM'): "
74 1.1 jym read ans
75 1.1 jym if [ -n "$ans" ];then
76 1.1 jym TERM=$ans
77 1.1 jym fi
78 1.1 jym fi
79 1.1 jym
80 1.1 jym # run the installation or upgrade script.
81 1.1 jym /sysinst || {
82 1.1 jym echo "Oops, something went wrong - we will try again"; exit; }
83 1.1 jym
84 1.1 jym echo "To return to the installer, quit this shell by typing 'exit' or ^D."
85 1.1 jym exec /bin/sh
86