home *** CD-ROM | disk | FTP | other *** search
/ PC World 2000 February / PCWorld_2000-02_cd.bin / live / usr / lib / dpkg / methods / multicd / update < prev   
Text File  |  1999-02-08  |  2KB  |  107 lines

  1. #!/bin/sh 
  2.  
  3. set -e
  4. vardir="$1"
  5. method=$2
  6. option=$3
  7. iarch=`dpkg --print-installation-architecture`
  8.  
  9. cd "$vardir/methods/$method"
  10.  
  11. . ./shvar.$option
  12.  
  13. #debug() { echo "DEBUG: $@"; }
  14. debug() { true; }
  15. ismulti() { debug $1 $2; test -e "$1/.disk/info" || test -e "$1$2/.disk/info"; }
  16.  
  17. if [ -z "$p_main_packages" -a -z "$p_ctb_packages" -a \
  18.      -z "$p_nf_packages" -a -z "$p_lcl_packages " ]
  19. then
  20.     echo '
  21. No Packages files available, cannot update available packages list.
  22. Hit RETURN to continue.  '
  23.     read response
  24.     exit 0
  25. fi
  26.  
  27. xit=1
  28. trap '
  29.     rm -f packages-{main,ctb,nf,nonus,lcl}
  30.     if [ -n "$umount" ]
  31.     then
  32.         umount "$umount" >/dev/null 2>&1
  33.     fi
  34.     exit $xit
  35. ' 0
  36.  
  37. if [ ! -b "$p_blockdev" ]
  38. then
  39.     loop=",loop"
  40. fi
  41.  
  42. if [ -n "$p_blockdev" ]
  43. then
  44.     umount="$p_mountpoint"
  45.     mount -rt "$p_fstype" -o nosuid,nodev${loop} "$p_blockdev" "$p_mountpoint"
  46. fi
  47.  
  48. if [ -n "$p_nfs" ]
  49. then
  50.     umount="$p_mountpoint"
  51.     mount -rt nfs "$p_nfs" -o nosuid,nodev "$p_mountpoint"
  52. fi
  53.  
  54. updatetype=update
  55.  
  56. if [ -z "$p_multi" ]; then
  57.     exit 1
  58. fi
  59.  
  60. for f in main ctb nf nonus lcl
  61. do
  62.     eval 'this_packages=$p_'$f'_packages'
  63.     case "$this_packages" in
  64.     '')
  65.         continue
  66.         ;;
  67.     scan)
  68.         eval 'this_binary=$p_'$f'_binary'
  69.         if [ -z "$this_binary" ]; then continue; fi
  70.         if [ "$updatetype" = update ]
  71.         then
  72.             dpkg --clear-avail
  73.             updatetype=merge
  74.         fi
  75.         echo Running dpkg --record-avail -R "$p_mountpoint$this_binary"
  76.         dpkg --record-avail -R "$p_mountpoint$this_binary"
  77.         ;;
  78.     *)
  79.         packagesfile="$p_mountpoint$this_packages"
  80.         case "$packagesfile" in
  81.         *.gz | *.Z | *.GZ | *.z)
  82.             echo -n "Uncompressing $packagesfile ... "
  83.             zcat <"$packagesfile" >packages-$f
  84.             echo done.
  85.             dpkg --$updatetype-avail packages-$f
  86.             updatetype=merge
  87.             ;;
  88.         '')
  89.             ;;
  90.         *)
  91.             dpkg --$updatetype-avail "$packagesfile"
  92.             updatetype=merge
  93.             ;;
  94.         esac
  95.         ;;
  96.     esac    
  97. done
  98.  
  99. cp -f $vardir/available $vardir/methods/$method
  100.  
  101. dpkg --forget-old-unavail
  102.  
  103. echo -n 'Update OK.  Hit RETURN.  '
  104. read response
  105.  
  106. xit=0
  107.