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