home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 4 / DATAFILE_PDCD4.iso / unix / riscbsd / datafile / misc / inst_11_fs / .commonutils next >
Encoding:
Text File  |  1995-12-08  |  3.7 KB  |  133 lines

  1. #
  2. # Copyright (c) 1994 Christopher G. Demetriou
  3. # All rights reserved.
  4. # Redistribution and use in source and binary forms, with or without
  5. # modification, are permitted provided that the following conditions
  6. # are met:
  7. # 1. Redistributions of source code must retain the above copyright
  8. #    notice, this list of conditions and the following disclaimer.
  9. # 2. Redistributions in binary form must reproduce the above copyright
  10. #    notice, this list of conditions and the following disclaimer in the
  11. #    documentation and/or other materials provided with the distribution.
  12. # 3. All advertising materials mentioning features or use of this software
  13. #    must display the following acknowledgement:
  14. #    This product includes software developed by Christopher G. Demetriou.
  15. # 4. The name of the author may not be used to endorse or promote products
  16. #    derived from this software without specific prior written permission
  17. #
  18. # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  19. # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  20. # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  21. # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
  22. # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  23. # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  24. # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  25. # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  26. # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  27. # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  28. #
  29. #    $Id: dot.commonutils,v 1.4 1994/10/18 07:03:06 glass Exp $
  30.  
  31. # Installation utilites (functions), to get NetBSD installed on
  32. # the hard disk.  These are meant to be invoked from the shell prompt,
  33. # by people installing NetBSD.
  34.  
  35. # we know that /etc/fstab is only generated on the hard drive
  36. dest_dir=/
  37. if [ ! -f /etc/fstab ]; then
  38.     dest_dir=/mnt/
  39. fi
  40.  
  41. # counter for possible shared library confusion
  42. TAR=/usr/bin/tar
  43. GUNZIP=/usr/bin/gunzip
  44.  
  45. Set_tmp_dir()
  46. {
  47.     def_tmp_dir=`pwd`
  48.     if [ "$def_tmp_dir" = "/" -o "$def_tmp_dir" = "/mnt" ]; then
  49.         def_tmp_dir="$dest_dir"usr/distrib
  50.     fi
  51.  
  52.     echo -n    "What directory should be used to find and/or store "
  53.     echo    "installtion"
  54.     echo -n    "files? [$def_tmp_dir] "
  55.     read tmp_dir
  56.     if [ "$tmp_dir" = "" ]; then
  57.         tmp_dir=$def_tmp_dir
  58.     fi
  59.     if [ ! -d "$tmp_dir" ]; then
  60.         /bin/rm -rf $tmp_dir
  61.         mkdir -p $tmp_dir
  62.     fi
  63. }
  64.  
  65. Tmp_dir()
  66. {
  67.     if [ "$tmp_dir" = "" ]; then
  68.         Set_tmp_dir
  69.     fi
  70.     cd $tmp_dir
  71. }
  72.  
  73. Load_fd()
  74. {
  75.     Tmp_dir
  76.     which=
  77.     echo "Don't forget that you can't load from the drive you booted from."
  78.     echo ""
  79.  
  80.     while [ "$which" != "0" -a "$which" != "1" ]; do
  81.         echo -n    "Read from which floppy drive ('0' or '1')? [0] "
  82.         read which
  83.         if [ "X$which" = "X" ]; then
  84.             which=0
  85.         fi
  86.     done
  87.     echo    ""
  88.     echo    "WARNING: during the floppy loading process, you should only"
  89.     echo    "use Control-C at the prompt."
  90.     echo    ""
  91.     while echo -n \
  92.         "Insert floppy (hit Control-C to terminate, enter to load): "
  93.     do
  94.         read foo
  95.         mount -t msdos /dev/fd${which}a /mnt2
  96.         cp -rp /mnt2/* .
  97.         umount /mnt2
  98.     done
  99. }
  100.  
  101. Load_tape()
  102. {
  103.     Tmp_dir
  104.     echo -n    "Which tape drive will you be using? [rst0] "
  105.     read which
  106.     if [ "X$which" = "X" ]; then
  107.         which=rst0
  108.     fi
  109.     echo -n "Insert the tape into the tape drive and hit return to "
  110.     echo -n "continue..."
  111.     read foo
  112.     echo    "Extracting files from the tape..."
  113.     $TAR xvpf --unlink /dev/$which
  114.     echo    "Done."
  115. }
  116.  
  117. Extract()
  118. {
  119.     Tmp_dir
  120.     echo -n "Would you like to list the files as they're extracted? [n] "
  121.     read verbose
  122.     case $verbose in
  123.     y*|Y*)
  124.         tarverbose=v
  125.         ;;
  126.     *)
  127.         tarverbose=
  128.         ;;
  129.     esac
  130.     cat "$1"* | $GUNZIP | (cd $dest_dir ; $TAR  --unlink -xp"$tarverbose"f - )
  131. }
  132.