Home | History | Annotate | Line # | Download | only in prepare
install.md revision 1.1.1.1.18.1
      1  1.1.1.1.18.1  bouyer #	$NetBSD: install.md,v 1.1.1.1.18.1 2009/01/15 22:22:07 bouyer Exp $
      2           1.1     leo #
      3           1.1     leo #
      4           1.1     leo # Copyright (c) 1996 The NetBSD Foundation, Inc.
      5           1.1     leo # All rights reserved.
      6           1.1     leo #
      7           1.1     leo # This code is derived from software contributed to The NetBSD Foundation
      8           1.1     leo # by Jason R. Thorpe.
      9           1.1     leo #
     10           1.1     leo # Redistribution and use in source and binary forms, with or without
     11           1.1     leo # modification, are permitted provided that the following conditions
     12           1.1     leo # are met:
     13           1.1     leo # 1. Redistributions of source code must retain the above copyright
     14           1.1     leo #    notice, this list of conditions and the following disclaimer.
     15           1.1     leo # 2. Redistributions in binary form must reproduce the above copyright
     16           1.1     leo #    notice, this list of conditions and the following disclaimer in the
     17           1.1     leo #    documentation and/or other materials provided with the distribution.
     18           1.1     leo # 3. All advertising materials mentioning features or use of this software
     19           1.1     leo #    must display the following acknowledgement:
     20           1.1     leo #        This product includes software developed by the NetBSD
     21           1.1     leo #        Foundation, Inc. and its contributors.
     22           1.1     leo # 4. Neither the name of The NetBSD Foundation nor the names of its
     23           1.1     leo #    contributors may be used to endorse or promote products derived
     24           1.1     leo #    from this software without specific prior written permission.
     25           1.1     leo #
     26           1.1     leo # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     27           1.1     leo # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     28           1.1     leo # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     29           1.1     leo # PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     30           1.1     leo # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     31           1.1     leo # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     32           1.1     leo # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     33           1.1     leo # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     34           1.1     leo # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     35           1.1     leo # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     36           1.1     leo # POSSIBILITY OF SUCH DAMAGE.
     37           1.1     leo #
     38           1.1     leo 
     39           1.1     leo #
     40           1.1     leo # machine dependent section of installation/upgrade script.
     41           1.1     leo #
     42           1.1     leo 
     43           1.1     leo VERSION=				# filled in automatically (see list)
     44           1.1     leo export VERSION
     45           1.1     leo 
     46           1.1     leo md_set_term() {
     47           1.1     leo 	if [ ! -z "$TERM" ]; then
     48           1.1     leo 		return
     49           1.1     leo 	fi
     50           1.1     leo 	echo -n "Specify terminal type [vt220]: "
     51           1.1     leo 	getresp "vt220"
     52           1.1     leo 	TERM="$resp"
     53           1.1     leo 	export TERM
     54           1.1     leo }
     55           1.1     leo 
     56           1.1     leo md_makerootwritable() {
     57           1.1     leo 	# Mount root rw for convenience of the tester ;-)
     58           1.1     leo 	if [ ! -e /tmp/.root_writable ]; then
     59  1.1.1.1.18.1  bouyer 		rootdev=/dev/$(sysctl -n kern.root_device)$(sysctl -n kern.root_partition | sed y/0123456789/abcdefghij/)
     60  1.1.1.1.18.1  bouyer 		mount -t ffs -u $rootdev / > /dev/null 2>&1
     61           1.1     leo 		cp /dev/null /tmp/.root_writable
     62           1.1     leo 	fi
     63           1.1     leo }
     64           1.1     leo 
     65           1.1     leo md_get_diskdevs() {
     66           1.1     leo 	# return available disk devices
     67  1.1.1.1.18.1  bouyer 	sysctl -n hw.disknames | sed 'y/ /\n/' | sed -n '/^[sw]d[0-9]/p' \
     68  1.1.1.1.18.1  bouyer 		| sort -u
     69           1.1     leo }
     70           1.1     leo 
     71           1.1     leo md_prep_disklabel()
     72           1.1     leo {
     73           1.1     leo 	# $1 is the root disk
     74           1.1     leo 	# Note that the first part of this function is just a *very* verbose
     75           1.1     leo 	# version of md_label_disk().
     76           1.1     leo 
     77           1.1     leo 	cat << \__md_prep_disklabel_1
     78           1.1     leo You now have to prepare your root disk for the installation of NetBSD. This
     79           1.1     leo is further referred to as 'labeling' a disk.
     80           1.1     leo 
     81           1.1     leo First you get the chance to edit or create an AHDI compatible partitioning on
     82           1.1     leo the installation disk. Note that NetBSD can do without AHDI partitions,
     83           1.1     leo check the documentation.
     84           1.1     leo If you want to use an AHDI compatible partitioning, you have to assign some
     85           1.1     leo partitions to NetBSD before NetBSD is able to use the disk. Change the 'id'
     86           1.1     leo of all partitions you want to use for NetBSD filesystems to 'NBD'. Change
     87           1.1     leo the 'id' of the partition you wish to use for swap to 'SWP'.
     88           1.1     leo 
     89           1.1     leo Hit the <return> key when you have read this...
     90           1.1     leo __md_prep_disklabel_1
     91           1.1     leo 	getresp ""
     92           1.1     leo 	ahdilabel /dev/r${1}c
     93           1.1     leo 
     94           1.1     leo 	# display example
     95           1.1     leo 	cat << \__md_prep_disklabel_3
     96           1.1     leo Here is an example of what the partition information will look like once
     97           1.1     leo you have entered the disklabel editor. Disk partition sizes and offsets
     98           1.1     leo are in sector (most likely 512 bytes) units.
     99           1.1     leo 
    100           1.1     leo [Example]
    101           1.1     leo partition      start         (c/t/s)      nblks         (c/t/s)  type
    102           1.1     leo 
    103           1.1     leo  a (root)          0       (0/00/00)      31392     (109/00/00)  4.2BSD
    104           1.1     leo  b (swap)      31392     (109/00/00)      73440     (255/00/00)  swap
    105           1.1     leo  c (disk)          0       (0/00/00)    1070496    (3717/00/00)  unused
    106           1.1     leo  d (user)     104832     (364/00/00)      30528     (106/00/00)  4.2BSD
    107           1.1     leo  e (user)     135360     (470/00/00)      40896     (142/00/00)  4.2BSD
    108           1.1     leo  f (user)     176256     (612/00/00)      92160     (320/00/00)  4.2BSD
    109           1.1     leo  g (user)     268416     (932/00/00)     802080    (2785/00/00)  4.2BSD
    110           1.1     leo 
    111           1.1     leo [End of example]
    112           1.1     leo 
    113           1.1     leo Hit the <return> key when you have read this...
    114           1.1     leo 
    115           1.1     leo __md_prep_disklabel_3
    116           1.1     leo 	getresp ""
    117           1.1     leo 	edlabel /dev/r${1}c
    118           1.1     leo 
    119           1.1     leo 	cat << \__md_prep_disklabel_4
    120           1.1     leo 
    121           1.1     leo You will now be given the opportunity to place disklabels on any additional
    122           1.1     leo disks on your system.
    123           1.1     leo __md_prep_disklabel_4
    124           1.1     leo 
    125           1.1     leo 	_DKDEVS=`rmel ${1} ${_DKDEVS}`
    126           1.1     leo 	resp="X"	# force at least one iteration
    127           1.1     leo 	while [ "X$resp" != X"done" ]; do
    128           1.1     leo 		labelmoredisks
    129           1.1     leo 	done
    130           1.1     leo }
    131           1.1     leo 
    132           1.1     leo md_labeldisk() {
    133           1.1     leo 	edahdi /dev/r${1}c < /dev/null > /dev/null 2>&1
    134           1.1     leo 	[ $? -eq 0 ] && edahdi /dev/r${1}c
    135           1.1     leo 	edlabel /dev/r${1}c
    136           1.1     leo }
    137           1.1     leo 
    138           1.1     leo md_welcome_banner() {
    139           1.1     leo 	echo ""
    140           1.1     leo 	echo "Welcome to the NetBSD/atari ${VERSION} preparation program."
    141           1.1     leo 		cat << \__welcome_banner_1
    142           1.1     leo 
    143           1.1     leo This program is designed to partition your disk in preparation of the
    144           1.1     leo NetBSD installation. At this stage, the only thing you _must_ setup
    145           1.1     leo is a swap partition. If you wish, the remaining partitioning work might
    146           1.1     leo be delayed until the actual installation.
    147           1.1     leo 
    148           1.1     leo As with anything which modifies your disk's contents, this
    149           1.1     leo program can cause SIGNIFICANT data loss, and you are advised
    150           1.1     leo to make sure your data is backed up before beginning the
    151           1.1     leo preparation process.
    152           1.1     leo 
    153           1.1     leo Default answers are displayed in brackets after the questions.
    154           1.1     leo You can hit Control-C at any time to quit, but if you do so at a
    155           1.1     leo prompt, you may have to hit return.
    156           1.1     leo __welcome_banner_1
    157           1.1     leo }
    158           1.1     leo 
    159           1.1     leo md_not_going_to_install() {
    160           1.1     leo 	cat << \__not_going_to_install_1
    161           1.1     leo 
    162           1.1     leo OK, then.  Enter `halt' at the prompt to halt the machine.  Once the
    163           1.1     leo machine has halted, power-cycle the system to load new boot code.
    164           1.1     leo 
    165           1.1     leo Note: If you wish to have another try. Just type '^D' at the prompt. After
    166           1.1     leo       a moment, the program will restart itself.
    167           1.1     leo 
    168           1.1     leo __not_going_to_install_1
    169           1.1     leo }
    170           1.1     leo 
    171           1.1     leo md_congrats() {
    172           1.1     leo 	cat << __congratulations_1
    173           1.1     leo 
    174           1.1     leo CONGRATULATIONS!  You have successfully partitioned your disks!
    175           1.1     leo Now you can use file2swap.ttp to transfer the install.fs to your
    176           1.1     leo swap partition and continue the installation.
    177           1.1     leo Enter halt at the command prompt. Once the system has halted, reset the
    178           1.1     leo machine and re-boot it.
    179           1.1     leo 
    180           1.1     leo Note: If you wish to have another try. Just type '^D' at the prompt. After
    181           1.1     leo       a moment, the installer will restart itself.
    182           1.1     leo 
    183           1.1     leo __congratulations_1
    184           1.1     leo }
    185