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