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.
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.
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/>.
21 cd "$vardir/methods/file"
30 predep
="$vardir/predep-package"
33 dpkg
--admindir "$vardir" --predep-package >"$predep"
42 ($binaryprefix,$predep) = @ARGV;
43 $binaryprefix =~ s,/*$,/, if length($binaryprefix);
44 open(P, "< $predep") or die "cannot open $predep: $!\n";
47 $package = $_ if s/^Package: //i;
48 @filename = split(/ /,$_) if s/^Filename: //i;
49 @msdosfilename = split(/ /,$_) if s/^MSDOS-Filename: //i;
51 die "internal error - no package" if length($package) == 0;
52 die "internal error - no filename" if not @filename;
53 die "internal error - mismatch >@filename< >@msdosfilename<"
54 if @filename && @msdosfilename &&
55 @filename != @msdosfilename;
57 for ($i = 0; $i <= $#filename; $i++) {
59 print "Looking for part $ppart of $package ... ";
60 if (-f "$binaryprefix$filename[$i]") {
61 $print = $filename[$i];
62 $invoke = "$binaryprefix$filename[$i]";
63 } elsif (-f "$binaryprefix$msdosfilename[$i]") {
64 $print = $msdosfilename[$i];
65 $invoke = "$binaryprefix$msdosfilename[$i]";
67 $base = $filename[$i]; $base =~ s,.*/,,;
68 $msdosbase = $msdosfilename[$i]; $msdosbase =~ s,.*/,,;
71 die "failed to fork for find: $!\n";
75 length($binaryprefix) ?
77 "-name",$base,"-o","-name",$msdosbase);
78 die "failed to exec find: $!\n";
80 while (chop($invoke = <X>)) { last if -f $invoke; }
82 if (substr($print,0,length($binaryprefix)+1) eq
84 $print = substr($print,length($binaryprefix));
87 if (!length($invoke)) {
90 Cannot find the appropriate file(s) anywhere needed to install or upgrade
91 package $package. Expecting version $version or later, as listed in the
94 Perhaps the package was downloaded with an unexpected name? In any case,
95 you must find the file(s) and then either place it with the correct
96 filename(s) (as listed in the Packages file or in $vardir/available)
97 and rerun the installation, or upgrade the package by using
98 \"dpkg --install --auto-deconfigure" by hand.
104 push(@invoke,$invoke);
106 print "Running dpkg -iB for $package ...\n";
107 exec("dpkg","--admindir",$vardir,"-iB","--",@invoke);
108 die "failed to exec dpkg: $!\n";
109 ' -- "$p_mountpoint$p_main_binary" "$predep"
112 for f
in main ctb nf lcl
; do
113 eval 'this_binary=$p_'$f'_binary'
114 if [ -z "$this_binary" ]; then
117 echo Running dpkg
--admindir $vardir -iGROEB "$p_mountpoint$this_binary"
118 dpkg
--admindir $vardir -iGROEB "$p_mountpoint$this_binary"
121 echo -n 'Installation OK. Hit RETURN. '