1#!/bin/sh
2#
3#	$NetBSD: install.md,v 1.9 2023/03/26 15:08:24 andvar Exp $
4#
5# Copyright (c) 1996 The NetBSD Foundation, Inc.
6# All rights reserved.
7#
8# This code is derived from software contributed to The NetBSD Foundation
9# by Jason R. Thorpe.
10#
11# Redistribution and use in source and binary forms, with or without
12# modification, are permitted provided that the following conditions
13# are met:
14# 1. Redistributions of source code must retain the above copyright
15#    notice, this list of conditions and the following disclaimer.
16# 2. Redistributions in binary form must reproduce the above copyright
17#    notice, this list of conditions and the following disclaimer in the
18#    documentation and/or other materials provided with the distribution.
19#
20# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
21# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
24# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30# POSSIBILITY OF SUCH DAMAGE.
31#
32
33#
34# machine dependent section of installation/upgrade script
35#
36
37# Machine-dependent install sets
38MDSETS="kern-GENERIC xbase xcomp xetc xfont xserver"
39
40md_set_term() {
41	if [ ! -z "$TERM" ]; then
42		return
43	fi
44	echo -n "Specify terminal type [vt220]: "
45	getresp "vt220"
46	TERM="$resp"
47	export TERM
48	# XXX call tset?
49}
50
51md_makerootwritable() {
52	# Was: do_mfs_mount "/tmp" "2048"
53	# /tmp is the mount point
54	# 2048 is the size in DEV_BIZE blocks
55
56	umount /tmp > /dev/null 2>&1
57	if ! mount_mfs -s 2048 swap /tmp ; then
58		cat << \__mfs_failed_1
59
60FATAL ERROR: Can't mount the memory filesystem.
61
62__mfs_failed_1
63		exit
64	fi
65
66	# Bleh.  Give mount_mfs a chance to DTRT.
67	sleep 2
68}
69
70md_get_diskdevs() {
71	# return available disk devices
72	mi_filter_dmesg | awk -F : '/^sd[0-9]*:.*cylinders/ { print $1; }' | sort -u
73}
74
75md_get_cddevs() {
76	# return available CD-ROM devices
77	mi_filter_dmesg | awk -F : '/cd[0-9]*:.*CD-ROM/ { print $1; }' | sort -u
78}
79
80md_get_ifdevs() {
81	# return available network interfaces
82	mi_filter_dmesg | awk -F : '/^ae[0-9]*:/ { print $1; }' | sort -u
83	mi_filter_dmesg | awk -F : '/^sn[0-9]*:/ { print $1; }' | sort -u
84}
85
86md_get_partition_range() {
87	# return an expression describing the valid partition id's
88	echo '[a-h]'
89}
90
91md_installboot() {
92	# $1 is the root disk
93
94	# We don't have boot blocks.  Sigh.
95}
96
97md_checkfordisklabel() {
98	# $1 is the disk to check
99
100	# We don't support labels on the mac68k port.  (Yet.)
101
102	rval="0"
103}
104
105md_labeldisk() {
106	# $1 is the disk to label
107
108	# We don't support labels on the mac68k port.  (Yet.)
109}
110
111md_prep_disklabel() {
112	# $1 is the root disk
113
114	# We don't support labels on the mac68k port.  (Yet.)
115}
116
117md_copy_kernel() {
118	echo -n "Copying kernel..."
119	cp -p /netbsd /mnt/netbsd
120	echo "done."
121}
122
123	# Note, while they might not seem machine-dependent, the
124	# welcome banner and the punt message may contain information
125	# and/or instructions specific to the type of machine.
126
127md_welcome_banner() {
128(
129	echo	""
130	echo	"Welcome to the NetBSD/${MACHINE} ${RELEASE} installation program."
131	cat << \__welcome_banner_1
132
133This program is designed to help you install NetBSD on your system in a
134simple and rational way.  You'll be asked several questions, and it would
135probably be useful to have your disk's hardware manual, the installation
136notes, and a calculator handy.
137
138In particular, you will need to know some reasonably detailed
139information about your disk's geometry.  This program can determine
140some limited information about certain specific types of HP-IB disks.
141If you have SCSI disks, however, prior knowledge of disk geometry
142is absolutely essential.  The kernel will attempt to display geometry
143information for SCSI disks during boot, if possible.  If you did not
144make it note of it before, you may wish to reboot and jot down your
145disk's geometry before proceeding.
146
147As with anything which modifies your hard disk's contents, this
148program can cause SIGNIFICANT data loss, and you are advised
149to make sure your hard drive is backed up before beginning the
150installation process.
151
152Default answers are displayed in brackets after the questions.
153You can hit Control-C at any time to quit, but if you do so at a
154prompt, you may have to hit return.  Also, quitting in the middle of
155installation may leave your system in an inconsistent state.
156
157__welcome_banner_1
158) | more
159}
160
161md_not_going_to_install() {
162		cat << \__not_going_to_install_1
163
164OK, then.  Enter 'halt' at the prompt to halt the machine.  Once the
165machine has halted, power-cycle the system to load new boot code.
166
167__not_going_to_install_1
168}
169
170md_congrats() {
171	cat << \__congratulations_1
172
173CONGRATULATIONS!  You have successfully installed NetBSD!  To boot the
174installed system, enter halt at the command prompt.  Once the system has
175halted, power-cycle the machine in order to load new boot code.  Make sure
176you boot from the root disk.
177
178__congratulations_1
179}
180
181md_native_fstype() {
182	# Nothing to do.
183}
184
185md_native_fsopts() {
186	# Nothing to do.
187}
188