1#!/bin/sh - 2# 3# Copyright (c) 1990 The Regents of the University of California. 4# All rights reserved. 5# 6# %sccs.include.redist.sh% 7# 8# @(#)get 4.27 (Berkeley) 07/05/90 9# 10 11# Shell script to build a mini-root file system in preparation for building 12# a distribution tape. The file system created here is image copied onto 13# tape, then image copied onto disk as the "first" step in a cold boot o 14# 4.3 systems. 15 16DISTROOT=/mnt 17DISTUSR=/mnt/usr/DISTUSR 18 19if [ `pwd` = '/' ] 20then 21 echo You just '(almost)' destroyed the root 22 exit 23fi 24cp /tmp/stripped_vmunix vmunix 25 26# create necessary directories 27DIRLIST="bin dev etc a tmp stand sbin usr usr/mdec sys sys/floppy \ 28 sys/cassette sys/consolerl" 29rm -rf $DIRLIST 30mkdir $DIRLIST 31 32ETC="disktab" 33for i in $ETC; do 34 cp $DISTROOT/etc/$i etc/$i 35done 36 37# disklabel 38SBIN="fsck ifconfig init mknod mount newfs restore \ 39 rrestore umount" 40USBIN="arff flcopy" 41for i in $SBIN; do 42 cp $DISTROOT/sbin/$i sbin/$i 43done 44for i in $USBIN; do 45 cp $DISTUSR/sbin/$i sbin/$i 46done 47 48# ed 49BIN="[ cat cp dd echo expr ls mkdir mv rcp rm sh stty sync" 50UBIN="awk make mt" 51for i in $BIN; do 52 cp $DISTROOT/bin/$i bin/$i 53done 54for i in $UBIN; do 55 cp $DISTUSR/bin/$i bin/$i 56done 57ln bin/stty bin/STTY 58 59cp /nbsd/sys/floppy/[Ma-z0-9]* sys/floppy 60cp /nbsd/sys/consolerl/[Ma-z0-9]* sys/consolerl 61#cp -r /nbsd/sys/cassette/[Ma-z0-9]* sys/cassette 62cp /nbsd/sys/cassette/[Ma-z0-9]* sys/cassette 63cp $DISTROOT/boot boot 64cp $DISTROOT/pcs750.bin pcs750.bin 65cp $DISTROOT/.profile .profile 66 67cat >etc/passwd <<EOF 68root::0:10::/:/bin/sh 69EOF 70 71cat >etc/group <<EOF 72wheel:*:0: 73staff:*:10: 74EOF 75 76cat >etc/fstab <<EOF 77/dev/hp0a:/a:xx:1:1 78/dev/up0a:/a:xx:1:1 79/dev/hk0a:/a:xx:1:1 80/dev/ra0a:/a:xx:1:1 81/dev/rb0a:/a:xx:1:1 82EOF 83 84cat >xtr <<'EOF' 85: ${disk?'Usage: disk=xx0 type=tt tape=yy xtr'} 86: ${type?'Usage: disk=xx0 type=tt tape=yy xtr'} 87: ${tape?'Usage: disk=xx0 type=tt tape=yy xtr'} 88echo 'Build root file system' 89newfs ${disk}a ${type} 90sync 91echo 'Check the file system' 92fsck /dev/r${disk}a 93mount /dev/${disk}a /a 94cd /a 95echo 'Rewind tape' 96mt -f /dev/${tape}0 rew 97echo 'Restore the dump image of the root' 98restore rsf 3 /dev/${tape}0 99cd / 100sync 101umount /dev/${disk}a 102sync 103fsck /dev/r${disk}a 104echo 'Root filesystem extracted' 105echo 106echo 'If this is an 8650 or 8600, update the console rl02' 107echo 'If this is a 780 or 785, update the floppy' 108echo 'If this is a 730, update the cassette' 109EOF 110chmod +x xtr 111rm -rf dev; mkdir dev 112cp $DISTROOT/dev/MAKEDEV dev 113chmod +x dev/MAKEDEV 114cp /dev/null dev/MAKEDEV.local 115cd dev 116./MAKEDEV std hp0 hk0 up0 ra0 rb0 117./MAKEDEV ts0; mv rmt12 ts0; rm *mt*; 118./MAKEDEV tm0; mv rmt12 tm0; rm *mt*; 119./MAKEDEV ht0; mv rmt12 ht0; rm *mt*; 120./MAKEDEV ut0; mv rmt12 ut0; rm *mt*; 121./MAKEDEV mt0; mv rmt12 xt0; rm *mt*; mv xt0 mt0 122cd .. 123sync 124