Commit | Line | Data |
---|---|---|
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 |
10 | DISTROOT=/nbsd |
11 | # | |
e2973259 SL |
12 | if [ `pwd` = '/' ] |
13 | then | |
14 | echo You just '(almost)' destroyed the root | |
15 | exit | |
16 | fi | |
157748eb | 17 | cp $DISTROOT/a/sys/GENERIC/vmunix . |
e2973259 SL |
18 | rm -rf bin; mkdir bin |
19 | rm -rf etc; mkdir etc | |
20 | rm -rf a; mkdir a | |
edd8b1e6 SL |
21 | rm -rf tmp; mkdir tmp |
22 | rm -rf usr; mkdir usr usr/mdec | |
23 | rm -rf sys; mkdir sys sys/floppy sys/cassette | |
157748eb | 24 | cp $DISTROOT/etc/disktab etc |
a93e539e | 25 | cp $DISTROOT/etc/newfs etc; strip etc/newfs |
157748eb | 26 | cp $DISTROOT/etc/mkfs etc; strip etc/mkfs |
f4902232 | 27 | cp $DISTROOT/etc/restore etc; strip etc/restore |
157748eb SL |
28 | cp $DISTROOT/etc/init etc; strip etc/init |
29 | cp $DISTROOT/etc/mount etc; strip etc/mount | |
30 | cp $DISTROOT/etc/mknod etc; strip etc/mknod | |
31 | cp $DISTROOT/etc/fsck etc; strip etc/fsck | |
32 | cp $DISTROOT/etc/umount etc; strip etc/umount | |
33 | cp $DISTROOT/etc/arff etc; strip etc/arff | |
34 | cp $DISTROOT/etc/flcopy etc; strip etc/flcopy | |
35 | cp $DISTROOT/bin/mt bin; strip bin/mt | |
36 | cp $DISTROOT/bin/ls bin; strip bin/ls | |
37 | cp $DISTROOT/bin/sh bin; strip bin/sh | |
38 | cp $DISTROOT/bin/mv bin; strip bin/mv | |
39 | cp $DISTROOT/bin/sync bin; strip bin/sync | |
40 | cp $DISTROOT/bin/cat bin; strip bin/cat | |
41 | cp $DISTROOT/bin/mkdir bin; strip bin/mkdir | |
42 | cp $DISTROOT/bin/stty bin; strip bin/stty; ln bin/stty bin/STTY | |
43 | cp $DISTROOT/bin/echo bin; strip bin/echo | |
44 | cp $DISTROOT/bin/rm bin; strip bin/rm | |
45 | cp $DISTROOT/bin/cp bin; strip bin/cp | |
46 | cp $DISTROOT/bin/expr bin; strip bin/expr | |
754b1261 | 47 | cp $DISTROOT/bin/[ bin; strip bin/[ |
157748eb | 48 | cp $DISTROOT/bin/awk bin; strip bin/awk |
f4902232 | 49 | cp $DISTROOT/bin/make bin; strip bin/make |
157748eb | 50 | cp $DISTROOT/usr/mdec/* usr/mdec |
f4902232 SL |
51 | cp $DISTROOT/a/sys/floppy/[Ma-z0-9]* sys/floppy |
52 | cp $DISTROOT/a/sys/cassette/[Ma-z0-9]* sys/cassette | |
157748eb SL |
53 | cp $DISTROOT/a/sys/stand/boot boot |
54 | cp $DISTROOT/.profile .profile | |
aa9df5c4 SL |
55 | cat >etc/passwd <<EOF |
56 | root::0:10::/:/bin/sh | |
57 | EOF | |
58 | cat >etc/group <<EOF | |
157748eb | 59 | wheel:*:0: |
aa9df5c4 SL |
60 | staff:*:10: |
61 | EOF | |
e2973259 SL |
62 | cat >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 | |
68 | EOF | |
69 | cat >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 | 73 | echo 'Build root file system' |
ed504d30 | 74 | newfs ${disk}a ${type} |
e2973259 | 75 | sync |
4d286db3 | 76 | echo 'Check the file system' |
ed504d30 SL |
77 | fsck /dev/r${disk}a |
78 | mount /dev/${disk}a /a | |
157748eb | 79 | cd /a |
4d286db3 | 80 | echo 'Rewind tape' |
4ab5225e | 81 | mt -t /dev/${tape}0 rew |
4d286db3 | 82 | echo 'Restore the dump image of the root' |
f4902232 | 83 | restore rsf 3 /dev/${tape}0 |
157748eb | 84 | cd / |
e2973259 | 85 | sync |
ed504d30 | 86 | umount /dev/${disk}a |
e2973259 | 87 | sync |
ed504d30 | 88 | fsck /dev/r${disk}a |
e2973259 SL |
89 | echo 'Root filesystem extracted' |
90 | echo | |
fe9e0195 | 91 | echo 'If this is a 780 or 785, update the floppy' |
e2973259 SL |
92 | echo 'If this is a 730, update the cassette' |
93 | EOF | |
94 | chmod +x xtr | |
95 | rm -rf dev; mkdir dev | |
157748eb SL |
96 | cp $DISTROOT/sys/dist/MAKEDEV dev |
97 | chmod +x dev/MAKEDEV | |
aa9df5c4 | 98 | cp /dev/null dev/MAKEDEV.local |
e2973259 SL |
99 | cd 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 |
106 | cd .. | |
107 | sync |