from Jerry Berkman
[unix-history] / usr / src / sys / vax / dist / get
CommitLineData
157748eb 1#! /bin/sh
fe9e0195 2# @(#)get 4.15 %G%
157748eb 3#
e2973259
SL
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"
edd8b1e6 8# step in a cold boot of 4.2 systems.
e2973259 9#
157748eb
SL
10DISTROOT=/nbsd
11#
e2973259
SL
12if [ `pwd` = '/' ]
13then
14 echo You just '(almost)' destroyed the root
15 exit
16fi
157748eb 17cp $DISTROOT/a/sys/GENERIC/vmunix .
e2973259
SL
18rm -rf bin; mkdir bin
19rm -rf etc; mkdir etc
20rm -rf a; mkdir a
edd8b1e6
SL
21rm -rf tmp; mkdir tmp
22rm -rf usr; mkdir usr usr/mdec
23rm -rf sys; mkdir sys sys/floppy sys/cassette
157748eb 24cp $DISTROOT/etc/disktab etc
a93e539e 25cp $DISTROOT/etc/newfs etc; strip etc/newfs
157748eb 26cp $DISTROOT/etc/mkfs etc; strip etc/mkfs
f4902232 27cp $DISTROOT/etc/restore etc; strip etc/restore
157748eb
SL
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
754b1261 47cp $DISTROOT/bin/[ bin; strip bin/[
157748eb 48cp $DISTROOT/bin/awk bin; strip bin/awk
f4902232 49cp $DISTROOT/bin/make bin; strip bin/make
157748eb 50cp $DISTROOT/usr/mdec/* usr/mdec
f4902232
SL
51cp $DISTROOT/a/sys/floppy/[Ma-z0-9]* sys/floppy
52cp $DISTROOT/a/sys/cassette/[Ma-z0-9]* sys/cassette
157748eb
SL
53cp $DISTROOT/a/sys/stand/boot boot
54cp $DISTROOT/.profile .profile
aa9df5c4
SL
55cat >etc/passwd <<EOF
56root::0:10::/:/bin/sh
57EOF
58cat >etc/group <<EOF
157748eb 59wheel:*:0:
aa9df5c4
SL
60staff:*:10:
61EOF
e2973259
SL
62cat >etc/fstab <<EOF
63/dev/hp0a:/a:xx:1:1
64/dev/up0a:/a:xx:1:1
65/dev/hk0a:/a:xx:1:1
66/dev/ra0a:/a:xx:1:1
67/dev/rb0a:/a:xx:1:1
68EOF
69cat >xtr <<'EOF'
ed504d30
SL
70: ${disk?'Usage: disk=xx0 type=tt tape=yy xtr'}
71: ${type?'Usage: disk=xx0 type=tt tape=yy xtr'}
72: ${tape?'Usage: disk=xx0 type=tt tape=yy xtr'}
4d286db3 73echo 'Build root file system'
ed504d30 74newfs ${disk}a ${type}
e2973259 75sync
4d286db3 76echo 'Check the file system'
ed504d30
SL
77fsck /dev/r${disk}a
78mount /dev/${disk}a /a
157748eb 79cd /a
4d286db3 80echo 'Rewind tape'
4ab5225e 81mt -t /dev/${tape}0 rew
4d286db3 82echo 'Restore the dump image of the root'
f4902232 83restore rsf 3 /dev/${tape}0
157748eb 84cd /
e2973259 85sync
ed504d30 86umount /dev/${disk}a
e2973259 87sync
ed504d30 88fsck /dev/r${disk}a
e2973259
SL
89echo 'Root filesystem extracted'
90echo
fe9e0195 91echo 'If this is a 780 or 785, update the floppy'
e2973259
SL
92echo 'If this is a 730, update the cassette'
93EOF
94chmod +x xtr
95rm -rf dev; mkdir dev
157748eb
SL
96cp $DISTROOT/sys/dist/MAKEDEV dev
97chmod +x dev/MAKEDEV
aa9df5c4 98cp /dev/null dev/MAKEDEV.local
e2973259
SL
99cd dev
100./MAKEDEV std hp0 hk0 up0 ra0 rb0
101./MAKEDEV ts0; mv rmt12 ts0; rm *mt*;
102./MAKEDEV tm0; mv rmt12 tm0; rm *mt*;
103./MAKEDEV ht0; mv rmt12 ht0; rm *mt*;
ed001f41 104./MAKEDEV ut0; mv rmt12 ut0; rm *mt*;
e2973259
SL
105./MAKEDEV mt0; mv rmt4 xt0; rm *mt*; mv xt0 mt0
106cd ..
107sync