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