curpri => curpriority
[unix-history] / usr / src / sys / tahoe / dist / get
CommitLineData
d90ac6b0
KB
1#!/bin/sh -
2#
8b7b8572 3# Copyright (c) 1990 The Regents of the University of California.
d90ac6b0 4# All rights reserved.
5010fcc1 5#
8b7b8572 6# %sccs.include.redist.sh%
5010fcc1 7#
a44927d2 8# @(#)get 1.8 (Berkeley) %G%
5010fcc1 9#
8b7b8572 10
d90ac6b0
KB
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.
5010fcc1
MK
15#
16DISTROOT=/nbsd
17#
18if [ `pwd` = '/' ]
19then
20 echo You just '(almost)' destroyed the root
21 exit
22fi
d90ac6b0
KB
23
24# copy in kernel
8b7b8572 25cp $DISTROOT/sys/GENERIC.alltahoe/vmunix .
d90ac6b0
KB
26
27# create necessary directories
8b7b8572 28DIRLIST="bin dev etc a tmp stand sbin"
d90ac6b0
KB
29rm -rf $DIRLIST
30mkdir $DIRLIST
31
8b7b8572
KB
32ETC="disktab"
33for i in $ETC; do
d90ac6b0
KB
34 cp $DISTROOT/etc/$i etc/$i
35done
36
8b7b8572
KB
37SBIN="disklabel fsck ifconfig init mknod mount newfs restore \
38 rrestore umount"
39for i in $SBIN; do
40 cp $DISTROOT/sbin/$i sbin/$i
41done
42
43BIN="[ cat cp dd echo ed expr ls mkdir mv rcp rm sh stty sync"
44UBIN="awk make mt"
45for i in $BIN; do
d90ac6b0
KB
46 cp $DISTROOT/bin/$i bin/$i
47done
8b7b8572
KB
48for i in $UBIN; do
49 cp $DISTROOT/usr/bin/$i bin/$i
50done
d90ac6b0
KB
51ln bin/stty bin/STTY
52
8b7b8572
KB
53STAND="copy vdformat"
54for i in $STAND; do
d90ac6b0
KB
55 cp $DISTROOT/stand/$i stand/$i
56done
57
8b7b8572
KB
58DOT=".profile boot fppoc fppwcs poc poc1 poc2 wcs"
59#DOT=".profile boot"
60for i in $DOT; do
d90ac6b0
KB
61 cp $DISTROOT/$i $i
62done
63
64# initialize /dev
65cp $DISTROOT/dev/MAKEDEV dev/MAKEDEV
66chmod +x dev/MAKEDEV
67cp /dev/null dev/MAKEDEV.local
a44927d2 68(cd dev; ./MAKEDEV std hd0 hd1 dk0 dk1; ./MAKEDEV cy0; mv rmt12 cy0; rm *mt*)
d90ac6b0
KB
69
70# initialize /etc/passwd
5010fcc1
MK
71cat >etc/passwd <<EOF
72root::0:10::/:/bin/sh
73EOF
d90ac6b0
KB
74
75# initialize /etc/group
5010fcc1
MK
76cat >etc/group <<EOF
77wheel:*:0:
78staff:*:10:
79EOF
d90ac6b0
KB
80
81# initialize /etc/fstab
5010fcc1 82cat >etc/fstab <<EOF
a44927d2
MK
83/dev/dk0a /a ufs xx 1 1
84/dev/hd0a /a ufs xx 1 1
5010fcc1 85EOF
d90ac6b0
KB
86
87# create xtr script
5010fcc1 88cat >xtr <<'EOF'
61a674aa 89#!/bin/sh -e
a44927d2
MK
90: ${disk?'Usage: disk=xx0 tape=yy [type=zz] xtr'}
91: ${tape?'Usage: disk=xx0 tape=yy [type=zz] xtr'}
5010fcc1 92echo 'Build root file system'
a44927d2 93newfs ${disk}a ${type}
5010fcc1
MK
94sync
95echo 'Check the file system'
96fsck /dev/r${disk}a
97mount /dev/${disk}a /a
98cd /a
99echo 'Rewind tape'
100mt -f /dev/${tape}0 rew
101echo 'Restore the dump image of the root'
102restore rsf 3 /dev/${tape}0
103cd /
104sync
8b7b8572 105umount /a
5010fcc1
MK
106sync
107fsck /dev/r${disk}a
108echo 'Root filesystem extracted'
109EOF
d90ac6b0
KB
110
111# make xtr script executable
5010fcc1 112chmod +x xtr
d90ac6b0 113
5010fcc1 114sync