Commit | Line | Data |
---|---|---|
d90ac6b0 KB |
1 | #!/bin/sh - |
2 | # | |
3 | # Copyright (c) 1988 Regents of the University of California. | |
4 | # All rights reserved. | |
5010fcc1 | 5 | # |
d90ac6b0 | 6 | # Redistribution and use in source and binary forms are permitted |
8d59605c KB |
7 | # provided that the above copyright notice and this paragraph are |
8 | # duplicated in all such forms and that any documentation, | |
9 | # advertising materials, and other materials related to such | |
10 | # distribution and use acknowledge that the software was developed | |
11 | # by the University of California, Berkeley. The name of the | |
12 | # University may not be used to endorse or promote products derived | |
13 | # from this software without specific prior written permission. | |
14 | # THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR | |
15 | # IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED | |
16 | # WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. | |
5010fcc1 | 17 | # |
8d59605c | 18 | # @(#)get 1.5 (Berkeley) %G% |
5010fcc1 | 19 | # |
d90ac6b0 KB |
20 | # Shell script to build a mini-root file system in preparation for building |
21 | # a distribution tape. The file system created here is image copied onto | |
22 | # tape, then image copied onto disk as the "first" step in a cold boot of | |
23 | # 4.3BSD systems. | |
5010fcc1 MK |
24 | # |
25 | DISTROOT=/nbsd | |
26 | # | |
27 | if [ `pwd` = '/' ] | |
28 | then | |
29 | echo You just '(almost)' destroyed the root | |
30 | exit | |
31 | fi | |
d90ac6b0 KB |
32 | |
33 | # copy in kernel | |
5010fcc1 | 34 | cp $DISTROOT/sys/GENERIC/vmunix . |
d90ac6b0 KB |
35 | |
36 | # create necessary directories | |
37 | DIRLIST="bin dev etc a tmp stand" | |
38 | rm -rf $DIRLIST | |
39 | mkdir $DIRLIST | |
40 | ||
41 | # copy in files from /etc | |
42 | ETCFILE="disklabel disktab fsck ifconfig init mknod mount newfs restore \ | |
43 | rrestore umount" | |
44 | for i in $ETCFILE; do | |
45 | cp $DISTROOT/etc/$i etc/$i | |
46 | done | |
47 | ||
48 | # copy in files from /bin | |
49 | BINFILE="[ awk cat cp dd echo ed expr ls make mkdir mt mv rcp rm sh stty \ | |
50 | sync" | |
51 | for i in $BINFILE; do | |
52 | cp $DISTROOT/bin/$i bin/$i | |
53 | done | |
54 | ln bin/stty bin/STTY | |
55 | ||
56 | # copy in files from /stand | |
57 | STANDFILE="copy vdformat" | |
58 | for i in $STANDFILE; do | |
59 | cp $DISTROOT/stand/$i stand/$i | |
60 | done | |
61 | ||
62 | # copy in files from / | |
63 | #DOTFILE=".profile boot fppoc fppwcs poc poc1 poc2 wcs" | |
64 | DOTFILE=".profile boot wcs" | |
65 | for i in $DOTFILE; do | |
66 | cp $DISTROOT/$i $i | |
67 | done | |
68 | ||
69 | # initialize /dev | |
70 | cp $DISTROOT/dev/MAKEDEV dev/MAKEDEV | |
71 | chmod +x dev/MAKEDEV | |
72 | cp /dev/null dev/MAKEDEV.local | |
73 | (cd dev; ./MAKEDEV std dk0; ./MAKEDEV cy0; mv rmt12 cy0; rm *mt*) | |
74 | ||
75 | # initialize /etc/passwd | |
5010fcc1 MK |
76 | cat >etc/passwd <<EOF |
77 | root::0:10::/:/bin/sh | |
78 | EOF | |
d90ac6b0 KB |
79 | |
80 | # initialize /etc/group | |
5010fcc1 MK |
81 | cat >etc/group <<EOF |
82 | wheel:*:0: | |
83 | staff:*:10: | |
84 | EOF | |
d90ac6b0 KB |
85 | |
86 | # initialize /etc/fstab | |
5010fcc1 MK |
87 | cat >etc/fstab <<EOF |
88 | /dev/xfd0a:/a:xx:1:1 | |
89 | /dev/dk0a:/a:xx:1:1 | |
90 | EOF | |
d90ac6b0 KB |
91 | |
92 | # create xtr script | |
5010fcc1 | 93 | cat >xtr <<'EOF' |
61a674aa | 94 | #!/bin/sh -e |
5010fcc1 MK |
95 | : ${disk?'Usage: disk=xx0 tape=yy xtr'} |
96 | : ${tape?'Usage: disk=xx0 tape=yy xtr'} | |
97 | echo 'Build root file system' | |
98 | newfs ${disk}a | |
99 | sync | |
100 | echo 'Check the file system' | |
101 | fsck /dev/r${disk}a | |
102 | mount /dev/${disk}a /a | |
103 | cd /a | |
104 | echo 'Rewind tape' | |
105 | mt -f /dev/${tape}0 rew | |
106 | echo 'Restore the dump image of the root' | |
107 | restore rsf 3 /dev/${tape}0 | |
108 | cd / | |
109 | sync | |
110 | umount /dev/${disk}a | |
111 | sync | |
112 | fsck /dev/r${disk}a | |
113 | echo 'Root filesystem extracted' | |
114 | EOF | |
d90ac6b0 KB |
115 | |
116 | # make xtr script executable | |
5010fcc1 | 117 | chmod +x xtr |
d90ac6b0 | 118 | |
5010fcc1 | 119 | sync |