1#!/bin/sh - 2# 3# Copyright (c) 1992 The Regents of the University of California. 4# All rights reserved. 5# 6# %sccs.include.redist.sh% 7# 8# @(#)get 7.1 (Berkeley) 04/20/92 9# 10 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 o 14# 4.3 systems. 15 16DISTROOT=/mnt 17DISTUSR=/mnt/usr/DISTUSR 18 19if [ `pwd` = '/' ] 20then 21 echo You just '(almost)' destroyed the root 22 exit 23fi 24#cp /tmp/stripped_vmunix vmunix 25 26# create necessary directories 27DIRLIST="bin dev etc a tmp stand sbin usr usr/mdec sys" 28rm -rf $DIRLIST 29mkdir $DIRLIST 30 31ETC="disktab" 32for i in $ETC; do 33 cp $DISTROOT/etc/$i etc/$i 34done 35 36SBIN="disklabel fsck ifconfig init mknod mount newfs restore \ 37 rrestore umount" 38for i in $SBIN; do 39 cp $DISTROOT/sbin/$i sbin/$i 40done 41 42# ed 43BIN="[ cat cp dd echo expr ls mkdir mv rcp rm sh stty sync" 44UBIN="awk make mt" 45for i in $BIN; do 46 cp $DISTROOT/bin/$i bin/$i 47done 48for i in $UBIN; do 49 cp $DISTUSR/bin/$i bin/$i 50done 51ln bin/stty bin/STTY 52 53cp $DISTROOT/.profile .profile 54 55cat >etc/passwd <<EOF 56root::0:10::/:/bin/sh 57daemon:*:1:1::/: 58EOF 59 60cat >etc/group <<EOF 61system:*:0: 62daemon:*:1: 63uucp:*:2: 64kmem:*:3: 65bin:*:4: 66news:*:8: 67staff:*:10: 68operator:*:28: 69EOF 70 71cat >etc/fstab <<EOF 72/dev/rz0a / ufs rw 1 1 73/dev/rz0g /usr ufs rw 1 2 74EOF 75 76cat >xtr <<'EOF' 77: ${disk?'Usage: disk=xx0 type=tt tape=yy xtr'} 78: ${type?'Usage: disk=xx0 type=tt tape=yy xtr'} 79: ${tape?'Usage: disk=xx0 type=tt tape=yy xtr'} 80echo 'Build root file system' 81disklabel -r ${disk}c ${type} 82newfs ${disk}a ${type} 83sync 84echo 'Check the file system' 85fsck /dev/r${disk}a 86mount /dev/${disk}a /a 87cd /a 88echo 'Rewind tape' 89mt -f /dev/${tape}0 rew 90echo 'Restore the dump image of the root' 91restore rsf 3 /dev/${tape}0 92cd / 93sync 94umount /dev/${disk}a 95sync 96fsck /dev/r${disk}a 97echo 'Root filesystem extracted' 98EOF 99chmod +x xtr 100rm -rf dev; mkdir dev 101cp $DISTROOT/dev/MAKEDEV dev 102chmod +x dev/MAKEDEV 103cp /dev/null dev/MAKEDEV.local 104cd dev 105./MAKEDEV std dc0 rz0 rz1 rz2 rz3 rz4 tz0 tz1 pm0 pty0 106cd .. 107sync 108