dpkg (1.18.25) stretch; urgency=medium
[dpkg] / dselect / methods / floppy / update
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
16 set -e
17 vardir="$1"
18 method=$2
19 option=$3
20
21 cd "$vardir/methods/floppy"
22
23 mountpoint="$vardir/methods/mnt"
24
25 . ./shvar.$option
26
27 help () {
28 echo '
29 First I need the disk(s) which contain the Packages file(s) for
30 the parts of the archive you wish to be able to install. If you
31 want to install packages from the non-free and contrib areas of
32 the FTP site you need a floppy with a Packages file for each of
33 those, in addition to the main Packages file for the main Debian
34 distribution. If you don'\''t then you just need one Packages file.'
35 }
36
37 help
38
39 xit=1
40 trap '
41 if [ -n "$umount" ]
42 then
43 umount "$umount"
44 fi
45 exit $xit
46 ' 0
47
48 tryupdate () {
49 if [ $success = 1 ]; then return; fi
50 if [ ! -f "$mountpoint/Packages" ]; then
51 echo "$mountpoint/Packages does not exist.";
52 return
53 fi
54 if dpkg --admindir $vardir --merge-avail "$mountpoint/Packages"
55 then
56 success=1
57 echo '
58 You may incorporate another Packages file from another floppy if you wish.'
59 fi
60 }
61
62 while [ $xit = 1 ]
63 do
64 echo -n '
65 Insert a disk containing a Packages file, or type q to quit. '
66 read response
67 case "$response" in
68 [Qq] | [Qq][Uu][Ii][Tt] )
69 xit=0
70 ;;
71 * )
72 umount="$defaultfloppy"
73 if mount -rt "$defaultfstype" "$defaultfloppy" "$mountpoint"
74 then
75 success=0
76 tryupdate Packages
77 tryupdate packages
78 tryupdate PACKAGES
79 umount "$defaultfloppy"
80 fi
81 umount=""
82 ;;
83 esac
84 done
85
86 echo '
87 OK, continuing with installation.'
88
89 xit=0