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

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