home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 4 / DATAFILE_PDCD4.iso / unix / riscbsd / datafile / misc / inst_12_df / .commonutils next >
Encoding:
Text File  |  1996-07-07  |  3.7 KB  |  134 lines

  1. # $NetBSD: dot.commonutils,v 1.1 1996/05/16 19:59:04 mark Exp $
  2. #
  3. # Copyright (c) 1994 Christopher G. Demetriou
  4. # All rights reserved.
  5. # Redistribution and use in source and binary forms, with or without
  6. # modification, are permitted provided that the following conditions
  7. # are met:
  8. # 1. Redistributions of source code must retain the above copyright
  9. #    notice, this list of conditions and the following disclaimer.
  10. # 2. Redistributions in binary form must reproduce the above copyright
  11. #    notice, this list of conditions and the following disclaimer in the
  12. #    documentation and/or other materials provided with the distribution.
  13. # 3. All advertising materials mentioning features or use of this software
  14. #    must display the following acknowledgement:
  15. #    This product includes software developed by Christopher G. Demetriou.
  16. # 4. The name of the author may not be used to endorse or promote products
  17. #    derived from this software without specific prior written permission
  18. #
  19. # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  20. # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  21. # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  22. # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
  23. # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  24. # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  25. # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  26. # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  27. # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  28. # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  29. #
  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 "unless you booted with a ramdisk."
  79.     echo ""
  80.  
  81.     while [ "$which" != "0" -a "$which" != "1" ]; do
  82.         echo -n    "Read from which floppy drive ('0' or '1')? [0] "
  83.         read which
  84.         if [ "X$which" = "X" ]; then
  85.             which=0
  86.         fi
  87.     done
  88.     echo    ""
  89.     echo    "WARNING: during the floppy loading process, you should only"
  90.     echo    "use Control-C at the prompt."
  91.     echo    ""
  92.     while echo -n \
  93.         "Insert floppy (hit Control-C to terminate, enter to load): "
  94.     do
  95.         read foo
  96.         mount -t msdos /dev/fd${which}a /mnt2
  97.         cp -rp /mnt2/* .
  98.         umount /mnt2
  99.     done
  100. }
  101.  
  102. Load_tape()
  103. {
  104.     Tmp_dir
  105.     echo -n    "Which tape drive will you be using? [rst0] "
  106.     read which
  107.     if [ "X$which" = "X" ]; then
  108.         which=rst0
  109.     fi
  110.     echo -n "Insert the tape into the tape drive and hit return to "
  111.     echo -n "continue..."
  112.     read foo
  113.     echo    "Extracting files from the tape..."
  114.     $TAR xvpf --unlink /dev/$which
  115.     echo    "Done."
  116. }
  117.  
  118. Extract()
  119. {
  120.     Tmp_dir
  121.     echo -n "Would you like to list the files as they're extracted? [n] "
  122.     read verbose
  123.     case $verbose in
  124.     y*|Y*)
  125.         tarverbose=v
  126.         ;;
  127.     *)
  128.         tarverbose=
  129.         ;;
  130.     esac
  131.     cat "$1"* | $GUNZIP | (cd $dest_dir ; $TAR  --unlink -xp"$tarverbose"f - )
  132. }
  133.