chiark / gitweb /
dpkg (1.18.25) stretch; urgency=medium
[dpkg] / dselect / methods / floppy / install
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 Now I need the disks containing the packages to be installed.
30 I shall keep telling you what is left to be done, in case that
31 is helpful deciding which floppy to use.'
32 }
33
34 help
35
36 xit=1
37 trap '
38         if [ -n "$umount" ]
39         then
40                 umount "$umount"
41         fi
42         exit $xit
43 ' 0
44
45 while [ -z "$goconfigure" ]
46 do
47         yet="`dpkg --admindir $vardir --yet-to-unpack`"
48         if [ -z "$yet" ]
49         then
50                 echo '
51 All packages unpacked, going on to configure them.
52 '
53                 goconfigure=1
54                 continue
55         fi
56         echo '
57 Packages yet to be unpacked:'
58         echo "$yet"
59         dpkg-split -l
60
61         echo -n '
62 Insert a disk containing *.deb files, or type q to quit.  '
63         read response
64         case "$response" in
65         [Qq] | [Qq][Uu][Ii][Tt] )
66                 goconfigure=1
67                 ;;
68         * )
69                 umount="$defaultfloppy"
70                 if mount -rt "$defaultfstype" "$defaultfloppy" "$mountpoint"
71                 then
72                         echo
73                         dpkg --admindir $vardir --unpack -GROEB "$mountpoint" || true
74                         umount "$defaultfloppy"
75                 fi
76                 umount=""
77                 ;;
78         esac
79 done
80
81 if ! [ -z "$yet" ]
82 then
83         response=""
84         while [ -z "$response" ]
85         do
86                 echo -n '
87 Not all the packages have yet been unpacked.  Shall I try to
88 proceed with configuration anyay ?  If any of the packages which
89 have been unpacked so far depend on any that haven'\''t then you'\''ll
90 see error messages; on the other hand if you say no those packages that
91 could have been configured will not be.   (y/n)  '
92                 read response
93                 case "$response" in
94                 [Nn]* )
95                         echo '
96 OK.  Be sure to come back to this, because unpacked-but-not-configured
97 packages are not in general useable.  Alternatively, use the Configure
98 option on the dselect menu.
99 '
100                         exit 1
101                         ;;
102                 [Yy]* )
103                         ;;
104                 * )
105                         response=""
106                         ;;
107                 esac
108         done
109 fi
110
111 dpkg --admindir $vardir --configure --pending
112
113 xit=0