xref: /csrg-svn/sys/tahoe/dist/get (revision 44904)
134744Sbostic#!/bin/sh -
230861Skarels#
3*44904Sbostic# Copyright (c) 1990 The Regents of the University of California.
434744Sbostic# All rights reserved.
530861Skarels#
6*44904Sbostic# %sccs.include.redist.sh%
730861Skarels#
8*44904Sbostic#	@(#)get	1.7 (Berkeley) 07/04/90
930861Skarels#
10*44904Sbostic
1134744Sbostic# Shell script to build a mini-root file system in preparation for building
1234744Sbostic# a distribution tape.  The file system created here is image copied onto
1334744Sbostic# tape, then image copied onto disk as the "first" step in a cold boot of
1434744Sbostic# 4.3BSD systems.
1534744Sbostic#
1630861SkarelsDISTROOT=/nbsd
1730861Skarels#
1830861Skarelsif [ `pwd` = '/' ]
1930861Skarelsthen
2030861Skarels	echo You just '(almost)' destroyed the root
2130861Skarels	exit
2230861Skarelsfi
2334744Sbostic
2434744Sbostic# copy in kernel
25*44904Sbosticcp $DISTROOT/sys/GENERIC.alltahoe/vmunix .
2634744Sbostic
2734744Sbostic# create necessary directories
28*44904SbosticDIRLIST="bin dev etc a tmp stand sbin"
2934744Sbosticrm -rf $DIRLIST
3034744Sbosticmkdir $DIRLIST
3134744Sbostic
32*44904SbosticETC="disktab"
33*44904Sbosticfor i in $ETC; do
3434744Sbostic	cp $DISTROOT/etc/$i etc/$i
3534744Sbosticdone
3634744Sbostic
37*44904SbosticSBIN="disklabel fsck ifconfig init mknod mount newfs restore \
38*44904Sbostic	rrestore umount"
39*44904Sbosticfor i in $SBIN; do
40*44904Sbostic	cp $DISTROOT/sbin/$i sbin/$i
41*44904Sbosticdone
42*44904Sbostic
43*44904SbosticBIN="[ cat cp dd echo ed expr ls mkdir mv rcp rm sh stty sync"
44*44904SbosticUBIN="awk make mt"
45*44904Sbosticfor i in $BIN; do
4634744Sbostic	cp $DISTROOT/bin/$i bin/$i
4734744Sbosticdone
48*44904Sbosticfor i in $UBIN; do
49*44904Sbostic	cp $DISTROOT/usr/bin/$i bin/$i
50*44904Sbosticdone
5134744Sbosticln bin/stty bin/STTY
5234744Sbostic
53*44904SbosticSTAND="copy vdformat"
54*44904Sbosticfor i in $STAND; do
5534744Sbostic	cp $DISTROOT/stand/$i stand/$i
5634744Sbosticdone
5734744Sbostic
58*44904SbosticDOT=".profile boot fppoc fppwcs poc poc1 poc2 wcs"
59*44904Sbostic#DOT=".profile boot"
60*44904Sbosticfor i in $DOT; do
6134744Sbostic	cp $DISTROOT/$i $i
6234744Sbosticdone
6334744Sbostic
6434744Sbostic# initialize /dev
6534744Sbosticcp $DISTROOT/dev/MAKEDEV dev/MAKEDEV
6634744Sbosticchmod +x dev/MAKEDEV
6734744Sbosticcp /dev/null dev/MAKEDEV.local
6840822Sbostic(cd dev; ./MAKEDEV std hd0; ./MAKEDEV cy0; mv rmt12 cy0; rm *mt*)
6934744Sbostic
7034744Sbostic# initialize /etc/passwd
7130861Skarelscat >etc/passwd <<EOF
7230861Skarelsroot::0:10::/:/bin/sh
7330861SkarelsEOF
7434744Sbostic
7534744Sbostic# initialize /etc/group
7630861Skarelscat >etc/group <<EOF
7730861Skarelswheel:*:0:
7830861Skarelsstaff:*:10:
7930861SkarelsEOF
8034744Sbostic
8134744Sbostic# initialize /etc/fstab
8230861Skarelscat >etc/fstab <<EOF
8330861Skarels/dev/xfd0a:/a:xx:1:1
8440822Sbostic/dev/hd0a:/a:xx:1:1
8530861SkarelsEOF
8634744Sbostic
8734744Sbostic# 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
105*44904Sbosticumount /a
10630861Skarelssync
10730861Skarelsfsck /dev/r${disk}a
10830861Skarelsecho 'Root filesystem extracted'
10930861SkarelsEOF
11034744Sbostic
11134744Sbostic# make xtr script executable
11230861Skarelschmod +x xtr
11334744Sbostic
11430861Skarelssync
115