Commit | Line | Data |
---|---|---|
d90ac6b0 KB |
1 | #!/bin/sh - |
2 | # | |
8b7b8572 | 3 | # Copyright (c) 1990 The Regents of the University of California. |
d90ac6b0 | 4 | # All rights reserved. |
5010fcc1 | 5 | # |
8b7b8572 | 6 | # %sccs.include.redist.sh% |
5010fcc1 | 7 | # |
a44927d2 | 8 | # @(#)get 1.8 (Berkeley) %G% |
5010fcc1 | 9 | # |
8b7b8572 | 10 | |
d90ac6b0 KB |
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 of | |
14 | # 4.3BSD systems. | |
5010fcc1 MK |
15 | # |
16 | DISTROOT=/nbsd | |
17 | # | |
18 | if [ `pwd` = '/' ] | |
19 | then | |
20 | echo You just '(almost)' destroyed the root | |
21 | exit | |
22 | fi | |
d90ac6b0 KB |
23 | |
24 | # copy in kernel | |
8b7b8572 | 25 | cp $DISTROOT/sys/GENERIC.alltahoe/vmunix . |
d90ac6b0 KB |
26 | |
27 | # create necessary directories | |
8b7b8572 | 28 | DIRLIST="bin dev etc a tmp stand sbin" |
d90ac6b0 KB |
29 | rm -rf $DIRLIST |
30 | mkdir $DIRLIST | |
31 | ||
8b7b8572 KB |
32 | ETC="disktab" |
33 | for i in $ETC; do | |
d90ac6b0 KB |
34 | cp $DISTROOT/etc/$i etc/$i |
35 | done | |
36 | ||
8b7b8572 KB |
37 | SBIN="disklabel fsck ifconfig init mknod mount newfs restore \ |
38 | rrestore umount" | |
39 | for i in $SBIN; do | |
40 | cp $DISTROOT/sbin/$i sbin/$i | |
41 | done | |
42 | ||
43 | BIN="[ cat cp dd echo ed expr ls mkdir mv rcp rm sh stty sync" | |
44 | UBIN="awk make mt" | |
45 | for i in $BIN; do | |
d90ac6b0 KB |
46 | cp $DISTROOT/bin/$i bin/$i |
47 | done | |
8b7b8572 KB |
48 | for i in $UBIN; do |
49 | cp $DISTROOT/usr/bin/$i bin/$i | |
50 | done | |
d90ac6b0 KB |
51 | ln bin/stty bin/STTY |
52 | ||
8b7b8572 KB |
53 | STAND="copy vdformat" |
54 | for i in $STAND; do | |
d90ac6b0 KB |
55 | cp $DISTROOT/stand/$i stand/$i |
56 | done | |
57 | ||
8b7b8572 KB |
58 | DOT=".profile boot fppoc fppwcs poc poc1 poc2 wcs" |
59 | #DOT=".profile boot" | |
60 | for i in $DOT; do | |
d90ac6b0 KB |
61 | cp $DISTROOT/$i $i |
62 | done | |
63 | ||
64 | # initialize /dev | |
65 | cp $DISTROOT/dev/MAKEDEV dev/MAKEDEV | |
66 | chmod +x dev/MAKEDEV | |
67 | cp /dev/null dev/MAKEDEV.local | |
a44927d2 | 68 | (cd dev; ./MAKEDEV std hd0 hd1 dk0 dk1; ./MAKEDEV cy0; mv rmt12 cy0; rm *mt*) |
d90ac6b0 KB |
69 | |
70 | # initialize /etc/passwd | |
5010fcc1 MK |
71 | cat >etc/passwd <<EOF |
72 | root::0:10::/:/bin/sh | |
73 | EOF | |
d90ac6b0 KB |
74 | |
75 | # initialize /etc/group | |
5010fcc1 MK |
76 | cat >etc/group <<EOF |
77 | wheel:*:0: | |
78 | staff:*:10: | |
79 | EOF | |
d90ac6b0 KB |
80 | |
81 | # initialize /etc/fstab | |
5010fcc1 | 82 | cat >etc/fstab <<EOF |
a44927d2 MK |
83 | /dev/dk0a /a ufs xx 1 1 |
84 | /dev/hd0a /a ufs xx 1 1 | |
5010fcc1 | 85 | EOF |
d90ac6b0 KB |
86 | |
87 | # create xtr script | |
5010fcc1 | 88 | cat >xtr <<'EOF' |
61a674aa | 89 | #!/bin/sh -e |
a44927d2 MK |
90 | : ${disk?'Usage: disk=xx0 tape=yy [type=zz] xtr'} |
91 | : ${tape?'Usage: disk=xx0 tape=yy [type=zz] xtr'} | |
5010fcc1 | 92 | echo 'Build root file system' |
a44927d2 | 93 | newfs ${disk}a ${type} |
5010fcc1 MK |
94 | sync |
95 | echo 'Check the file system' | |
96 | fsck /dev/r${disk}a | |
97 | mount /dev/${disk}a /a | |
98 | cd /a | |
99 | echo 'Rewind tape' | |
100 | mt -f /dev/${tape}0 rew | |
101 | echo 'Restore the dump image of the root' | |
102 | restore rsf 3 /dev/${tape}0 | |
103 | cd / | |
104 | sync | |
8b7b8572 | 105 | umount /a |
5010fcc1 MK |
106 | sync |
107 | fsck /dev/r${disk}a | |
108 | echo 'Root filesystem extracted' | |
109 | EOF | |
d90ac6b0 KB |
110 | |
111 | # make xtr script executable | |
5010fcc1 | 112 | chmod +x xtr |
d90ac6b0 | 113 | |
5010fcc1 | 114 | sync |