xref: /csrg-svn/sys/tahoe/dist/get (revision 34744)
1*34744Sbostic#!/bin/sh -
230861Skarels#
3*34744Sbostic# Copyright (c) 1988 Regents of the University of California.
4*34744Sbostic# All rights reserved.
530861Skarels#
6*34744Sbostic# Redistribution and use in source and binary forms are permitted
7*34744Sbostic# provided that this notice is preserved and that due credit is given
8*34744Sbostic# to the University of California at Berkeley. The name of the University
9*34744Sbostic# may not be used to endorse or promote products derived from this
10*34744Sbostic# software without specific prior written permission. This software
11*34744Sbostic# is provided ``as is'' without express or implied warranty.
1230861Skarels#
13*34744Sbostic#	@(#)get	1.4 (Berkeley) 06/15/88
1430861Skarels#
15*34744Sbostic# Shell script to build a mini-root file system in preparation for building
16*34744Sbostic# a distribution tape.  The file system created here is image copied onto
17*34744Sbostic# tape, then image copied onto disk as the "first" step in a cold boot of
18*34744Sbostic# 4.3BSD systems.
19*34744Sbostic#
2030861SkarelsDISTROOT=/nbsd
2130861Skarels#
2230861Skarelsif [ `pwd` = '/' ]
2330861Skarelsthen
2430861Skarels	echo You just '(almost)' destroyed the root
2530861Skarels	exit
2630861Skarelsfi
27*34744Sbostic
28*34744Sbostic# copy in kernel
2930861Skarelscp $DISTROOT/sys/GENERIC/vmunix .
30*34744Sbostic
31*34744Sbostic# create necessary directories
32*34744SbosticDIRLIST="bin dev etc a tmp stand"
33*34744Sbosticrm -rf $DIRLIST
34*34744Sbosticmkdir $DIRLIST
35*34744Sbostic
36*34744Sbostic# copy in files from /etc
37*34744SbosticETCFILE="disklabel disktab fsck ifconfig init mknod mount newfs restore \
38*34744Sbostic	rrestore umount"
39*34744Sbosticfor i in $ETCFILE; do
40*34744Sbostic	cp $DISTROOT/etc/$i etc/$i
41*34744Sbosticdone
42*34744Sbostic
43*34744Sbostic# copy in files from /bin
44*34744SbosticBINFILE="[ awk cat cp dd echo ed expr ls make mkdir mt mv rcp rm sh stty \
45*34744Sbostic	sync"
46*34744Sbosticfor i in $BINFILE; do
47*34744Sbostic	cp $DISTROOT/bin/$i bin/$i
48*34744Sbosticdone
49*34744Sbosticln bin/stty bin/STTY
50*34744Sbostic
51*34744Sbostic# copy in files from /stand
52*34744SbosticSTANDFILE="copy vdformat"
53*34744Sbosticfor i in $STANDFILE; do
54*34744Sbostic	cp $DISTROOT/stand/$i stand/$i
55*34744Sbosticdone
56*34744Sbostic
57*34744Sbostic# copy in files from /
58*34744Sbostic#DOTFILE=".profile boot fppoc fppwcs poc poc1 poc2 wcs"
59*34744SbosticDOTFILE=".profile boot wcs"
60*34744Sbosticfor i in $DOTFILE; do
61*34744Sbostic	cp $DISTROOT/$i $i
62*34744Sbosticdone
63*34744Sbostic
64*34744Sbostic# initialize /dev
65*34744Sbosticcp $DISTROOT/dev/MAKEDEV dev/MAKEDEV
66*34744Sbosticchmod +x dev/MAKEDEV
67*34744Sbosticcp /dev/null dev/MAKEDEV.local
68*34744Sbostic(cd dev; ./MAKEDEV std dk0; ./MAKEDEV cy0; mv rmt12 cy0; rm *mt*)
69*34744Sbostic
70*34744Sbostic# initialize /etc/passwd
7130861Skarelscat >etc/passwd <<EOF
7230861Skarelsroot::0:10::/:/bin/sh
7330861SkarelsEOF
74*34744Sbostic
75*34744Sbostic# initialize /etc/group
7630861Skarelscat >etc/group <<EOF
7730861Skarelswheel:*:0:
7830861Skarelsstaff:*:10:
7930861SkarelsEOF
80*34744Sbostic
81*34744Sbostic# initialize /etc/fstab
8230861Skarelscat >etc/fstab <<EOF
8330861Skarels/dev/xfd0a:/a:xx:1:1
8430861Skarels/dev/dk0a:/a:xx:1:1
8530861SkarelsEOF
86*34744Sbostic
87*34744Sbostic# create xtr script
8830861Skarelscat >xtr <<'EOF'
8930877Skarels#!/bin/sh -e
9030861Skarels: ${disk?'Usage: disk=xx0 tape=yy xtr'}
9130861Skarels: ${tape?'Usage: disk=xx0 tape=yy xtr'}
9230861Skarelsecho 'Build root file system'
9330861Skarelsnewfs ${disk}a
9430861Skarelssync
9530861Skarelsecho 'Check the file system'
9630861Skarelsfsck /dev/r${disk}a
9730861Skarelsmount /dev/${disk}a /a
9830861Skarelscd /a
9930861Skarelsecho 'Rewind tape'
10030861Skarelsmt -f /dev/${tape}0 rew
10130861Skarelsecho 'Restore the dump image of the root'
10230861Skarelsrestore rsf 3 /dev/${tape}0
10330861Skarelscd /
10430861Skarelssync
10530861Skarelsumount /dev/${disk}a
10630861Skarelssync
10730861Skarelsfsck /dev/r${disk}a
10830861Skarelsecho 'Root filesystem extracted'
10930861SkarelsEOF
110*34744Sbostic
111*34744Sbostic# make xtr script executable
11230861Skarelschmod +x xtr
113*34744Sbostic
11430861Skarelssync
115