home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / bsd_srcs / sys / tahoe / dist / get < prev    next >
Encoding:
Text File  |  1991-05-21  |  3.8 KB  |  141 lines

  1. #!/bin/sh -
  2. #
  3. # Copyright (c) 1990 The Regents of the University of California.
  4. # All rights reserved.
  5. #
  6. # Redistribution and use in source and binary forms, with or without
  7. # modification, are permitted provided that the following conditions
  8. # are met:
  9. # 1. Redistributions of source code must retain the above copyright
  10. #    notice, this list of conditions and the following disclaimer.
  11. # 2. Redistributions in binary form must reproduce the above copyright
  12. #    notice, this list of conditions and the following disclaimer in the
  13. #    documentation and/or other materials provided with the distribution.
  14. # 3. All advertising materials mentioning features or use of this software
  15. #    must display the following acknowledgement:
  16. #    This product includes software developed by the University of
  17. #    California, Berkeley and its contributors.
  18. # 4. Neither the name of the University nor the names of its contributors
  19. #    may be used to endorse or promote products derived from this software
  20. #    without specific prior written permission.
  21. #
  22. # THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  23. # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  24. # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  25. # ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  26. # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  27. # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  28. # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  29. # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  30. # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  31. # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  32. # SUCH DAMAGE.
  33. #
  34. #    @(#)get    1.8 (Berkeley) 5/21/91
  35. #
  36.  
  37. # Shell script to build a mini-root file system in preparation for building
  38. # a distribution tape.  The file system created here is image copied onto
  39. # tape, then image copied onto disk as the "first" step in a cold boot of
  40. # 4.3BSD systems.
  41. #
  42. DISTROOT=/nbsd
  43. #
  44. if [ `pwd` = '/' ]
  45. then
  46.     echo You just '(almost)' destroyed the root
  47.     exit
  48. fi
  49.  
  50. # copy in kernel
  51. cp $DISTROOT/sys/GENERIC.alltahoe/vmunix .
  52.  
  53. # create necessary directories
  54. DIRLIST="bin dev etc a tmp stand sbin"
  55. rm -rf $DIRLIST
  56. mkdir $DIRLIST
  57.  
  58. ETC="disktab"
  59. for i in $ETC; do
  60.     cp $DISTROOT/etc/$i etc/$i
  61. done
  62.  
  63. SBIN="disklabel fsck ifconfig init mknod mount newfs restore \
  64.     rrestore umount"
  65. for i in $SBIN; do
  66.     cp $DISTROOT/sbin/$i sbin/$i
  67. done
  68.  
  69. BIN="[ cat cp dd echo ed expr ls mkdir mv rcp rm sh stty sync"
  70. UBIN="awk make mt"
  71. for i in $BIN; do
  72.     cp $DISTROOT/bin/$i bin/$i
  73. done
  74. for i in $UBIN; do
  75.     cp $DISTROOT/usr/bin/$i bin/$i
  76. done
  77. ln bin/stty bin/STTY
  78.  
  79. STAND="copy vdformat"
  80. for i in $STAND; do
  81.     cp $DISTROOT/stand/$i stand/$i
  82. done
  83.  
  84. DOT=".profile boot fppoc fppwcs poc poc1 poc2 wcs"
  85. #DOT=".profile boot"
  86. for i in $DOT; do
  87.     cp $DISTROOT/$i $i
  88. done
  89.  
  90. # initialize /dev
  91. cp $DISTROOT/dev/MAKEDEV dev/MAKEDEV
  92. chmod +x dev/MAKEDEV
  93. cp /dev/null dev/MAKEDEV.local
  94. (cd dev; ./MAKEDEV std hd0 hd1 dk0 dk1; ./MAKEDEV cy0; mv rmt12 cy0; rm *mt*)
  95.  
  96. # initialize /etc/passwd
  97. cat >etc/passwd <<EOF
  98. root::0:10::/:/bin/sh
  99. EOF
  100.  
  101. # initialize /etc/group
  102. cat >etc/group <<EOF
  103. wheel:*:0:
  104. staff:*:10:
  105. EOF
  106.  
  107. # initialize /etc/fstab
  108. cat >etc/fstab <<EOF
  109. /dev/dk0a /a        ufs    xx 1 1
  110. /dev/hd0a /a        ufs    xx 1 1
  111. EOF
  112.  
  113. # create xtr script
  114. cat >xtr <<'EOF'
  115. #!/bin/sh -e
  116. : ${disk?'Usage: disk=xx0 tape=yy [type=zz] xtr'}
  117. : ${tape?'Usage: disk=xx0 tape=yy [type=zz] xtr'}
  118. echo 'Build root file system'
  119. newfs ${disk}a ${type}
  120. sync
  121. echo 'Check the file system'
  122. fsck /dev/r${disk}a
  123. mount /dev/${disk}a /a
  124. cd /a
  125. echo 'Rewind tape'
  126. mt -f /dev/${tape}0 rew
  127. echo 'Restore the dump image of the root'
  128. restore rsf 3 /dev/${tape}0
  129. cd /
  130. sync
  131. umount /a
  132. sync
  133. fsck /dev/r${disk}a
  134. echo 'Root filesystem extracted'
  135. EOF
  136.  
  137. # make xtr script executable
  138. chmod +x xtr
  139.  
  140. sync
  141.