home *** CD-ROM | disk | FTP | other *** search
/ Chip 1994 February / CHIP0294.ISO / digital / test / linux / bootdisk / rootdisk.18 / bin / prep_use < prev    next >
Encoding:
Text File  |  1994-06-09  |  3.6 KB  |  171 lines

  1. #!/bin/sh
  2. #
  3. # prep_use/not_use/what_use/remote_use              LST Entpack-Utility
  4. # Version: 0.2
  5. # Last changed: 23.05.94
  6. #
  7. # Copyright (c) Ralf Flaxa, Linux Support Team Erlangen 1993, 1994
  8. #
  9. # Depending on the name under which you call it can unpack, remote-unpack,
  10. # delete and show the concerned group of files.
  11. #
  12. # This utility was build for the Golden Boot/Rootdisk and probably only
  13. # makes sense in that context ;-)
  14. #
  15. callname=`basename $0`
  16. ACTION="echo"
  17. REMOTESPACE=
  18. CANDELETE=
  19.  
  20. NETFILES="/sbin/ifconfig /sbin/route /bin/netstat /bin/ping /sbin/ifsetup"
  21. SLIPFILES="/sbin/dip"
  22. NETLUXUS="/usr/bin/telnet /usr/bin/ftp /usr/sbin/inetd /sbin/arp"
  23. TAPEFILES="/sbin/tapetool /usr/bin/mt"
  24. FTAPEFILES="/boot/ftape/ftape.o /sbin/insmod /sbin/rmmod /sbin/lsmod /sbin/startftape"
  25. LILOFILES="/sbin/lilo /sbin/activate"
  26. KEYBDFILES="/usr/bin/loadkeys /usr/lib/kbd/keytables/gr-lat1"
  27. REPAIRFILES="/sbin/e2fsck"
  28. LUXUS="$NETLUXUS /usr/bin/tr /bin/ed $REPAIRFILES"
  29. BRAUCHBAR="/LSTLIB/FULLINDEX /LSTLIB/DATABASE"
  30. DOCLUXUS="/DOC/COPYING"
  31. # we also need /bin/date, but that is hardcoded in the profile ...
  32. NEEDED="/bin/tar /usr/bin/sed /usr/bin/fgrep /usr/bin/expr /usr/bin/filesize /usr/bin/wc /usr/bin/free"
  33. FORDIALOG=/bin/dialog
  34. NEEDED1="/sbin/doinstall"
  35. NEEDED2="/sbin/sysinstall"
  36. NEEDED3="/sbin/bootsetup"
  37. debug()
  38. {
  39.     if [ "$DEBUG" != "" ]; then 
  40.         echo "$@"
  41.     fi
  42. }
  43.  
  44. checkramdisk()
  45. {
  46.     if [ " `rdev` " != " /dev/ram / " ]; then
  47.         echo "Sie benutzen keine Ramdisk !"
  48.         echo "Auf der Diskette kann nichts gel÷scht werden"
  49.         export CANDELETE=false
  50. #        exit 1
  51.     else
  52.         export CANDELETE=true
  53.         return 0 
  54.     fi
  55. }
  56.  
  57. makeloop()
  58. {
  59.     if [ $# -eq 0 ]; then
  60.         return
  61.     fi
  62.     for j in $* ; do
  63.         if [ "$ACTION" = "gzip -dc" ]; then
  64.             debug "$j.gz in $REMOTESPACE$j ausgepackt "
  65.             mkdir -p ` dirname $REMOTESPACE$j `
  66.             if [ ! -f $REMOTESPACE$j ]; then
  67.                 cp -a $j.gz $REMOTESPACE$j.gz
  68.                 gzip -d $REMOTESPACE$j.gz 
  69.             fi
  70.             if  [ "$CANDELETE" = "true" ]; then
  71.                 rm $j.gz
  72.                 ln -fs $REMOTESPACE$j $j
  73.             else
  74.                 echo "Warnung ! $j nicht removed und neu verlinkt "
  75.             fi
  76.             continue
  77.         fi
  78.         if  [ "$ACTION" != "echo" -a "$CANDELETE" = "false" ]; then
  79.             # besser nicht ...
  80.             debug "Skipping $ACTION $j ..."
  81.             continue
  82.         fi
  83.                 
  84.         if [ -f $j.gz ]; then
  85.             # echo "$ACTION $j.gz"
  86.             $ACTION $j.gz
  87.         elif [ -f $j ]; then
  88.             # echo "$ACTION $j"
  89.             $ACTION $j
  90.         else
  91.             debug "Weder $j noch $j.gz gefunden ..."
  92.         fi
  93.     done
  94. }
  95.  
  96. checkramdisk
  97.  
  98. # parse loop
  99. #
  100. case $callname in 
  101. what_use)
  102.     ACTION='echo'
  103.     ;;
  104. not_use)
  105.     debug "L÷sche Pakete $@ aus der Ramdisk ... "
  106.     ACTION='rm -f'
  107.     ;;
  108. prep_use)
  109.     debug "Dekomprimiere Pakete $@ in der Ramdisk ... "
  110.     ACTION='gzip -d'
  111.     ;;
  112. remote_use)
  113.     ACTION='gzip -dc'
  114.     export REMOTESPACE=$1
  115.     shift 1
  116.     ;;
  117. *)
  118.     ACTION="unknown"
  119.     return 1
  120.     ;;
  121. esac
  122.  
  123.  
  124. while [ 1 ]; do
  125.     if [ $# = 0 ]; then
  126.         break
  127.     elif [ "$1" = "net" ]; then
  128.         makeloop "$NETFILES"
  129.         shift 1
  130.     elif [ "$1" = "slip" ]; then
  131.         makeloop "$SLIPFILES"
  132.         shift 1
  133.     elif [ "$1" = "tape" ]; then
  134.         makeloop "$TAPEFILES"
  135.         shift 1
  136.     elif [ "$1" = "ftape" ]; then
  137.         makeloop "$FTAPEFILES"
  138.         shift 1
  139.     elif [ "$1" = "lilo" ]; then
  140.         makeloop "$LILOFILES"
  141.         shift 1
  142.     elif [ "$1" = "keyboard" ]; then
  143.         makeloop "$KEYBDFILES"
  144.         shift 1
  145.     elif [     "$1" = "minimum" ]; then
  146.         makeloop "$NEEDED"
  147.         shift 1
  148.     elif [     "$1" = "phase1" ]; then
  149.         makeloop "$NEEDED1"
  150.         shift 1
  151.     elif [     "$1" = "phase2" ]; then
  152.         makeloop "$NEEDED2"
  153.         shift 1
  154.     elif [     "$1" = "phase3" ]; then
  155.         makeloop "$NEEDED3"
  156.         shift 1
  157.     elif [     "$1" = "goodies" ]; then
  158.         makeloop "$BRAUCHBAR"
  159.         shift 1
  160.     elif [     "$1" = "dialog" ]; then
  161.         makeloop "$FORDIALOG"
  162.         shift 1
  163.     elif [     "$1" = "luxus" ]; then
  164.         makeloop "$LUXUS"
  165.         shift 1
  166.     else
  167.         makeloop "$@"
  168.         shift 1
  169.     fi
  170. done
  171.