update 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. #!/bin/sh
  2. #
  3. # This program is free software; you can redistribute it and/or modify
  4. # it under the terms of the GNU General Public License as published by
  5. # the Free Software Foundation; either version 2 of the License, or
  6. # (at your option) any later version.
  7. #
  8. # This program is distributed in the hope that it will be useful,
  9. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. # GNU General Public License for more details.
  12. #
  13. # You should have received a copy of the GNU General Public License
  14. # along with this program. If not, see <https://www.gnu.org/licenses/>.
  15. set -e
  16. vardir="$1"
  17. method=$2
  18. option=$3
  19. cd "$vardir/methods/floppy"
  20. mountpoint="$vardir/methods/mnt"
  21. . ./shvar.$option
  22. help () {
  23. echo '
  24. First I need the disk(s) which contain the Packages file(s) for
  25. the parts of the archive you wish to be able to install. If you
  26. want to install packages from the non-free and contrib areas of
  27. the FTP site you need a floppy with a Packages file for each of
  28. those, in addition to the main Packages file for the main Debian
  29. distribution. If you don'\''t then you just need one Packages file.'
  30. }
  31. help
  32. xit=1
  33. trap '
  34. if [ -n "$umount" ]
  35. then
  36. umount "$umount"
  37. fi
  38. exit $xit
  39. ' 0
  40. tryupdate () {
  41. if [ $success = 1 ]; then return; fi
  42. if [ ! -f "$mountpoint/Packages" ]; then
  43. echo "$mountpoint/Packages does not exist.";
  44. return
  45. fi
  46. if dpkg --admindir $vardir --merge-avail "$mountpoint/Packages"
  47. then
  48. success=1
  49. echo '
  50. You may incorporate another Packages file from another floppy if you wish.'
  51. fi
  52. }
  53. while [ $xit = 1 ]
  54. do
  55. echo -n '
  56. Insert a disk containing a Packages file, or type q to quit. '
  57. read response
  58. case "$response" in
  59. [Qq] | [Qq][Uu][Ii][Tt] )
  60. xit=0
  61. ;;
  62. * )
  63. umount="$defaultfloppy"
  64. if mount -rt "$defaultfstype" "$defaultfloppy" "$mountpoint"
  65. then
  66. success=0
  67. tryupdate Packages
  68. tryupdate packages
  69. tryupdate PACKAGES
  70. umount "$defaultfloppy"
  71. fi
  72. umount=""
  73. ;;
  74. esac
  75. done
  76. echo '
  77. OK, continuting with installation.'
  78. xit=0