xref: /original-bsd/sys/pmax/dist/get (revision ab6c2785)
1#!/bin/sh -
2#
3# Copyright (c) 1992 The Regents of the University of California.
4# All rights reserved.
5#
6# %sccs.include.redist.sh%
7#
8#	@(#)get	7.2 (Berkeley) 05/24/93
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=
17#
18if [ `pwd` = '/' ]
19then
20	echo You just '(almost)' destroyed the root
21	exit
22fi
23
24# copy in kernel
25cp $DISTROOT/sys/GENERIC.pmax/vmunix .
26
27# create necessary directories
28DIRLIST="bin dev etc a tmp stand sbin usr usr/mdec"
29rm -rf $DIRLIST
30mkdir $DIRLIST
31
32ETC="disktab services"
33for i in $ETC; do
34	cp $DISTROOT/etc/$i etc/$i
35done
36
37SBIN="disklabel fsck ifconfig init mknod mount newfs restore umount"
38USBIN="pwd_mkdb"
39for i in $SBIN; do
40	cp $DISTROOT/sbin/$i sbin/$i
41done
42for i in $USBIN; do
43	cp $DISTROOT/usr/sbin/$i sbin/$i
44done
45ln sbin/restore sbin/rrestore
46
47BIN="[ cat cp dd echo ed expr ls mkdir mv rcp rm sh stty sync"
48UBIN="awk mt"
49for i in $BIN; do
50	cp $DISTROOT/bin/$i bin/$i
51done
52for i in $UBIN; do
53	cp $DISTROOT/usr/bin/$i bin/$i
54done
55ln bin/[ bin/test
56
57MDEC="rzboot bootrz"
58for i in $MDEC; do
59	cp $DISTROOT/usr/mdec/$i usr/mdec/$i
60done
61
62DOT=".profile"
63for i in $DOT; do
64	cp $DISTROOT/$i $i
65done
66
67# initialize /dev
68cp $DISTROOT/dev/MAKEDEV dev/MAKEDEV
69chmod +x dev/MAKEDEV
70cp /dev/null dev/MAKEDEV.local
71(cd dev; ./MAKEDEV std dc0 scc0 rz0 rz1 rz2 rz3 rz4 tz0 tz1 \
72	pm0 cfb0 xcfb0 mfb0 pty0)
73
74# initialize /etc/passwd
75cat >etc/passwd <<EOF
76root::0:10::/:/bin/sh
77daemon:*:1:1::/:
78EOF
79
80# initialize /etc/group
81cat >etc/group <<EOF
82system:*:0:
83daemon:*:1:
84uucp:*:2:
85kmem:*:3:
86bin:*:4:
87news:*:8:
88staff:*:10:
89operator:*:28:
90EOF
91
92# initialize /etc/fstab
93cat >etc/fstab <<EOF
94/dev/rz0a	/	ufs	xx	1 1
95/dev/rz0g	/usr	ufs	xx	1 2
96EOF
97
98# create xtr script
99cat >xtr <<'EOF'
100#!/bin/sh -e
101: ${disk?'Usage: disk=xx0 tape=yy [type=zz] xtr'}
102: ${tape?'Usage: disk=xx0 tape=yy [type=zz] xtr'}
103echo 'Build root file system'
104disklabel -W ${disk}c ${type}
105disklabel -w -r ${disk}c ${type}
106newfs ${disk}a ${type}
107sync
108echo 'Check the file system'
109fsck /dev/r${disk}a
110mount /dev/${disk}a /a
111cd /a
112echo 'Rewind tape'
113mt -f /dev/${tape}0 rew
114echo 'Restore the dump image of the root'
115restore rsf 2 /dev/${tape}0
116cd /
117sync
118umount /a
119sync
120fsck /dev/r${disk}a
121echo 'Root filesystem extracted'
122EOF
123
124# make xtr script executable
125chmod +x xtr
126
127sync
128