update 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. #!/bin/sh
  2. set -e
  3. vardir="$1"
  4. method=$2
  5. option=$3
  6. cd "$vardir/methods/floppy"
  7. mountpoint="$vardir/methods/mnt"
  8. . ./shvar.$option
  9. help () {
  10. echo '
  11. First I need the disk(s) which contain the Packages file(s) for
  12. the parts of the archive you wish to be able to install. If you
  13. want to install packages from the non-free and contrib areas of
  14. the FTP site you need a floppy with a Packages file for each of
  15. those, in addition to the main Packages file for the main Debian
  16. distribution. If you don'\''t then you just need one Packages file.'
  17. }
  18. help
  19. xit=1
  20. trap '
  21. if [ -n "$umount" ]
  22. then
  23. umount "$umount"
  24. fi
  25. exit $xit
  26. ' 0
  27. tryupdate () {
  28. if [ $success = 1 ]; then return; fi
  29. if [ ! -f "$mountpoint/Packages" ]; then
  30. echo "$mountpoint/Packages does not exist.";
  31. return
  32. fi
  33. if dpkg --admindir $vardir --merge-avail "$mountpoint/Packages"
  34. then
  35. success=1
  36. echo '
  37. You may incorporate another Packages file from another floppy if you wish.'
  38. fi
  39. }
  40. while [ $xit = 1 ]
  41. do
  42. echo -n '
  43. Insert a disk containing a Packages file, or type q to quit. '
  44. read response
  45. case "$response" in
  46. [Qq] | [Qq][Uu][Ii][Tt] )
  47. xit=0
  48. ;;
  49. * )
  50. umount="$defaultfloppy"
  51. if mount -rt "$defaultfstype" "$defaultfloppy" "$mountpoint"
  52. then
  53. success=0
  54. tryupdate Packages
  55. tryupdate packages
  56. tryupdate PACKAGES
  57. umount "$defaultfloppy"
  58. fi
  59. umount=""
  60. ;;
  61. esac
  62. done
  63. echo '
  64. OK, continuting with installation.'
  65. xit=0