1#! /bin/sh 2# @(#)get 4.13 07/19/83 3# 4# Shell script to build a mini-root file system 5# in preparation for building a distribution tape. 6# The file system created here is image copied onto 7# tape, then image copied onto disk as the "first" 8# step in a cold boot of 4.2 systems. 9# 10DISTROOT=/nbsd 11# 12if [ `pwd` = '/' ] 13then 14 echo You just '(almost)' destroyed the root 15 exit 16fi 17cp $DISTROOT/a/sys/GENERIC/vmunix . 18rm -rf bin; mkdir bin 19rm -rf etc; mkdir etc 20rm -rf a; mkdir a 21rm -rf tmp; mkdir tmp 22rm -rf usr; mkdir usr usr/mdec 23rm -rf sys; mkdir sys sys/floppy sys/cassette 24cp $DISTROOT/etc/disktab etc 25cp $DISTROOT/etc/newfs etc; strip etc/newfs 26cp $DISTROOT/etc/mkfs etc; strip etc/mkfs 27cp $DISTROOT/etc/restore etc; strip etc/restore 28cp $DISTROOT/etc/init etc; strip etc/init 29cp $DISTROOT/etc/mount etc; strip etc/mount 30cp $DISTROOT/etc/mknod etc; strip etc/mknod 31cp $DISTROOT/etc/fsck etc; strip etc/fsck 32cp $DISTROOT/etc/umount etc; strip etc/umount 33cp $DISTROOT/etc/arff etc; strip etc/arff 34cp $DISTROOT/etc/flcopy etc; strip etc/flcopy 35cp $DISTROOT/bin/mt bin; strip bin/mt 36cp $DISTROOT/bin/ls bin; strip bin/ls 37cp $DISTROOT/bin/sh bin; strip bin/sh 38cp $DISTROOT/bin/mv bin; strip bin/mv 39cp $DISTROOT/bin/sync bin; strip bin/sync 40cp $DISTROOT/bin/cat bin; strip bin/cat 41cp $DISTROOT/bin/mkdir bin; strip bin/mkdir 42cp $DISTROOT/bin/stty bin; strip bin/stty; ln bin/stty bin/STTY 43cp $DISTROOT/bin/echo bin; strip bin/echo 44cp $DISTROOT/bin/rm bin; strip bin/rm 45cp $DISTROOT/bin/cp bin; strip bin/cp 46cp $DISTROOT/bin/expr bin; strip bin/expr 47cp $DISTROOT/bin/awk bin; strip bin/awk 48cp $DISTROOT/bin/make bin; strip bin/make 49cp $DISTROOT/usr/mdec/* usr/mdec 50cp $DISTROOT/a/sys/floppy/[Ma-z0-9]* sys/floppy 51cp $DISTROOT/a/sys/cassette/[Ma-z0-9]* sys/cassette 52cp $DISTROOT/a/sys/stand/boot boot 53cp $DISTROOT/.profile .profile 54cat >etc/passwd <<EOF 55root::0:10::/:/bin/sh 56EOF 57cat >etc/group <<EOF 58wheel:*:0: 59staff:*:10: 60EOF 61cat >etc/fstab <<EOF 62/dev/hp0a:/a:xx:1:1 63/dev/up0a:/a:xx:1:1 64/dev/hk0a:/a:xx:1:1 65/dev/ra0a:/a:xx:1:1 66/dev/rb0a:/a:xx:1:1 67EOF 68cat >xtr <<'EOF' 69: ${disk?'Usage: disk=xx0 type=tt tape=yy xtr'} 70: ${type?'Usage: disk=xx0 type=tt tape=yy xtr'} 71: ${tape?'Usage: disk=xx0 type=tt tape=yy xtr'} 72echo 'Build root file system' 73newfs ${disk}a ${type} 74sync 75echo 'Check the file system' 76fsck /dev/r${disk}a 77mount /dev/${disk}a /a 78cd /a 79echo 'Rewind tape' 80mt -t /dev/${tape}0 rew 81echo 'Restore the dump image of the root' 82restore rsf 3 /dev/${tape}0 83cd / 84sync 85umount /dev/${disk}a 86sync 87fsck /dev/r${disk}a 88echo 'Root filesystem extracted' 89echo 90echo 'If this is a 780, update floppy' 91echo 'If this is a 730, update the cassette' 92EOF 93chmod +x xtr 94rm -rf dev; mkdir dev 95cp $DISTROOT/sys/dist/MAKEDEV dev 96chmod +x dev/MAKEDEV 97cp /dev/null dev/MAKEDEV.local 98cd dev 99./MAKEDEV std hp0 hk0 up0 ra0 rb0 100./MAKEDEV ts0; mv rmt12 ts0; rm *mt*; 101./MAKEDEV tm0; mv rmt12 tm0; rm *mt*; 102./MAKEDEV ht0; mv rmt12 ht0; rm *mt*; 103./MAKEDEV ut0; mv rmt12 ut0; rm *mt*; 104./MAKEDEV mt0; mv rmt4 xt0; rm *mt*; mv xt0 mt0 105cd .. 106sync 107