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