xref: /csrg-svn/sys/tahoe/dist/get (revision 49839)
134744Sbostic#!/bin/sh -
230861Skarels#
344904Sbostic# Copyright (c) 1990 The Regents of the University of California.
434744Sbostic# All rights reserved.
530861Skarels#
644904Sbostic# %sccs.include.redist.sh%
730861Skarels#
8*49839Skarels#	@(#)get	1.8 (Berkeley) 05/21/91
930861Skarels#
1044904Sbostic
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
2544904Sbosticcp $DISTROOT/sys/GENERIC.alltahoe/vmunix .
2634744Sbostic
2734744Sbostic# create necessary directories
2844904SbosticDIRLIST="bin dev etc a tmp stand sbin"
2934744Sbosticrm -rf $DIRLIST
3034744Sbosticmkdir $DIRLIST
3134744Sbostic
3244904SbosticETC="disktab"
3344904Sbosticfor i in $ETC; do
3434744Sbostic	cp $DISTROOT/etc/$i etc/$i
3534744Sbosticdone
3634744Sbostic
3744904SbosticSBIN="disklabel fsck ifconfig init mknod mount newfs restore \
3844904Sbostic	rrestore umount"
3944904Sbosticfor i in $SBIN; do
4044904Sbostic	cp $DISTROOT/sbin/$i sbin/$i
4144904Sbosticdone
4244904Sbostic
4344904SbosticBIN="[ cat cp dd echo ed expr ls mkdir mv rcp rm sh stty sync"
4444904SbosticUBIN="awk make mt"
4544904Sbosticfor i in $BIN; do
4634744Sbostic	cp $DISTROOT/bin/$i bin/$i
4734744Sbosticdone
4844904Sbosticfor i in $UBIN; do
4944904Sbostic	cp $DISTROOT/usr/bin/$i bin/$i
5044904Sbosticdone
5134744Sbosticln bin/stty bin/STTY
5234744Sbostic
5344904SbosticSTAND="copy vdformat"
5444904Sbosticfor i in $STAND; do
5534744Sbostic	cp $DISTROOT/stand/$i stand/$i
5634744Sbosticdone
5734744Sbostic
5844904SbosticDOT=".profile boot fppoc fppwcs poc poc1 poc2 wcs"
5944904Sbostic#DOT=".profile boot"
6044904Sbosticfor 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
68*49839Skarels(cd dev; ./MAKEDEV std hd0 hd1 dk0 dk1; ./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
83*49839Skarels/dev/dk0a /a		ufs	xx 1 1
84*49839Skarels/dev/hd0a /a		ufs	xx 1 1
8530861SkarelsEOF
8634744Sbostic
8734744Sbostic# create xtr script
8830861Skarelscat >xtr <<'EOF'
8930877Skarels#!/bin/sh -e
90*49839Skarels: ${disk?'Usage: disk=xx0 tape=yy [type=zz] xtr'}
91*49839Skarels: ${tape?'Usage: disk=xx0 tape=yy [type=zz] xtr'}
9230861Skarelsecho 'Build root file system'
93*49839Skarelsnewfs ${disk}a ${type}
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
10544904Sbosticumount /a
10630861Skarelssync
10730861Skarelsfsck /dev/r${disk}a
10830861Skarelsecho 'Root filesystem extracted'
10930861SkarelsEOF
11034744Sbostic
11134744Sbostic# make xtr script executable
11230861Skarelschmod +x xtr
11334744Sbostic
11430861Skarelssync
115