Debian Codegraph @

bin/install_packages

raw
1 #!/usr/bin/perl
2
3 #*********************************************************************
4 #
5 # install_packages -- read package config and install packages via apt-get
6 #
7 # This script is part of FAI (Fully Automatic Installation)
8 # (c) 2000-2026, Thomas Lange, [email protected]
9 # (c) 2003-2004, Henning Glawe, [email protected]
10 # (c) 2004 , Jonas Hoffmann, [email protected]
11 # PRELOAD feature from Thomas Gebhardt <[email protected]>
12 # (c) 2019 , TUXEDO Computers GmbH, [email protected]
13 #
14 #*********************************************************************
15 # This program is free software; you can redistribute it and/or modify
16 # it under the terms of the GNU General Public License as published by
17 # the Free Software Foundation; either version 2 of the License, or
18 # (at your option) any later version.
19 #
20 # This program is distributed in the hope that it will be useful, but
21 # WITHOUT ANY WARRANTY; without even the implied warranty of
22 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23 # General Public License for more details.
24 #
25 # You should have received a copy of the GNU General Public License
26 # along with this program; see the file COPYING. If not, write to the
27 # Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
28 # MA 02111-1307, USA.
29 #*********************************************************************
30
31 $0=~ s#.+/##; # remove path from program name
32
33 # import variables: $verbose, $MAXPACKAGES, $classes, $FAI, $FAI_ROOT, $aptoptions, $FAI_DEBSOURCESDIR
34
35 use strict;
36 use Getopt::Std;
37 use utf8; # needed for Eval::Logic
38
39 my $debug=0;
40 # global variables
41 our ($opt_c,$opt_d,$opt_G,$opt_l,$opt_L,$opt_v,$opt_h,$opt_H,$opt_m,$opt_n,$opt_N,$opt_p,$opt_s,$opt_P);
42 my $listonly; # flag, that indicates that only a list of packages will be printed
43 our %command;
44 our $atype; # type of action (for apt-get, aptitude,..) that will be performed
45 our $pkgopt; # additional option for packages
46 our $pkgrel; # additional release info for packages
47 my $dryrun=0;
48 my $verbose;
49 my $FAI_ROOT;
50 my @classes;
51 our @clvar;
52 my $classpath;
53 my $rootcmd;
54 my @preloadlist;
55 my @preloadrmlist;
56 my $_config;
57 my $_system;
58 my $hasdebian=0; # some Debian related commands/types are used in package_config
59 my %list; # hash of arrays, key=type (yumi,aptitude,..), list of packages
60 my %types; # hash containing the types found in all loaded package_config files
61 my %classisdef;
62 my $maxpl; # maximum length of package list
63 my @known; # list of all known packages
64 my $execerrors; # counts execution errors
65 my $aptopt='-y -o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confnew --allow-change-held-packages';
66 my $aptitudeopt='-y -o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confnew';
67 my $pacmanopts=' --noconfirm ';
68 my $qopt;
69 my $downloaddir="/var/cache/apt/archives/partial/"; # where to download packages that gets only unpacked
70 my $debsourcesdir='/var/lib/fai/packages';
71 my @ls;
72 my %pname; # hash of all available packages
73 my %install; # key is package names, value says if we want to install it
74 my %pmap; # map package name from the configs (including +-/=) to real package names
75 my @newlist; # list of packages, but unknown packages removed
76
77 $| = 1;
78
79
80 # @commands is the order of the commands that are executed
81 our @commands = qw/y2i y2r zypper zypper-pattern zypper-product zypper-rm yast rpmr urpmi urpme yumgroup yumi yumr dnfgroup dnfi dnfr smarti smartr hold taskrm taskinst clean-internal cupt cupt-r install install-norec aptitude aptitude-r apt unpack remove dselect-upgrade pacman-Rns pacman-S apk-add apk-del/;
82 %command = (
83 "install" => "apt-get $aptopt --fix-missing install",
84 "install-norec" => "apt-get $aptopt --fix-missing install --no-install-recommends",
85 "remove" => "apt-get $aptopt --purge remove",
86 "dselect-upgrade" => "apt-get $aptopt dselect-upgrade",
87 "pacman-S" => "pacman $pacmanopts -S ",
88 "pacman-Rns" => "pacman $pacmanopts -Rns ",
89 "taskinst" => "tasksel install",
90 "taskrm" => "tasksel remove",
91 "hold" => "dpkg --set-selections",
92 "clean-internal" => "apt-get clean",
93 "aptitude" => "aptitude -R $aptitudeopt install",
94 "aptitude-r" => "aptitude -r $aptitudeopt install",
95 "apt" => "apt $aptopt install",
96 "cupt" => "cupt -R $aptopt install",
97 "cupt-r" => "cupt $aptopt install",
98 "unpack" => "cd $downloaddir; apt download",
99 "unpack-internal" => "dpkg --unpack --recursive $downloaddir; rm $downloaddir/*.deb",
100 "pending-internal" => "dpkg --configure --pending",
101 "dpkgc-internal" => "dpkg -C",
102 "urpmi" => "urpmi --auto --foce --allow-force --keep",
103 "urpme" => "urpme --auto --foce --allow-force --keep",
104 "yumi" => "yum -y install",
105 "yumr" => "yum -y remove",
106 "yumgroup" => "yum -y groupinstall",
107 "dnfi" => "dnf -y install",
108 "dnfr" => "dnf -y remove",
109 "dnfgroup" => "dnf -y group install",
110 "y2i" => "y2pmsh isc",
111 "y2r" => "y2pmsh remove",
112 "yast" => "yast -i",
113 "zypper" => "zypper -n install -l",
114 "zypper-pattern" => "zypper -n install -l -t pattern",
115 "zypper-product" => "zypper -n install -l -t product",
116 "zypper-rm" => "zypper -n remove",
117 "rpmr" => "rpm -e",
118 "smarti" => "smart install -y",
119 "smartr" => "smart remove -y",
120 "smartc-internal" => "smart clean",
121 "apk-add" => "apk add",
122 "apk-del" => "apk del",
123 );
124
125 getopts('cdGhHvlLm:p:nNsP');
126
127 $opt_d=1 if $opt_c;
128 $listonly = $opt_l || $opt_L;
129 $opt_h && usage();
130 $opt_H && showcommands();
131 $dryrun=1 if $opt_n;
132 $verbose=$ENV{verbose} || $opt_v;
133 $qopt="-qq" unless $verbose;
134 $qopt.=" --print-uris" if $opt_P;
135 $maxpl=$ENV{MAXPACKAGES} || $opt_m ;
136 $maxpl && $verbose && warn "Maximum number of packages installed at a time set to $maxpl\n";
137 $opt_d && setdownloadonly();
138 $maxpl or $maxpl = 99 ; # set default value
139 $opt_N=$ENV{FAI_DISABLE_PACKAGE_NAME_CHECK} || $opt_N;
140
141 my $devnull=">/dev/null" unless $verbose;
142
143 $FAI_ROOT = $ENV{FAI_ROOT};
144 $classpath = $opt_p || "$ENV{FAI}/package_config";
145 $rootcmd = ($FAI_ROOT eq "/" or not defined $FAI_ROOT ) ? '' : "chroot $FAI_ROOT";
146 @classes = grep { !/^#|^\s*$/ } split(/[\s\n]+/,$ENV{classes});
147 foreach (@classes) { $classisdef{$_}=1;}
148 # define an array of arguments for subroutine call: the class names, set to 1
149 @clvar = map { $_,1 } map { s/-/Ö/gr } @classes;
150
151 warn "$0: reading config files from directory $classpath\n" if $verbose;
152 foreach (@classes) {
153 &readconfig($classpath,$_) if -f "$classpath/$_"; # read all package config files
154 }
155
156 # check if any Debian related commands/types are used in package_config
157 my @debiantypes= qw/taskinst cupt cupt-r apt aptitude aptitude-r install install-norec remove dselect-upgrade smarti/;
158 foreach my $dt (@debiantypes) {
159 $types{$dt} and $hasdebian=1;
160 }
161
162 if ($types{'smarti'}) { # smarti is used in a packages_config file
163 $command{'clean-internal'} = $command{'smartc-internal'};
164 $command{'pending-internal'} = "true";
165 $command{'dpkgc-internal'} = "true";
166 }
167
168 # get files which must exist before installing packages
169 foreach my $entry (@preloadlist,@preloadrmlist) {
170 my ($url, $directory) = @$entry;
171 if ($url =~ m!^file:/(.+)!) {
172 my $file = $1;
173 execute("cp $FAI_ROOT/$file $FAI_ROOT/$directory") unless $listonly;
174 } else {
175 execute("cd $FAI_ROOT/$directory; curl -# -O $url") unless $listonly;
176 }
177 }
178
179 $hasdebian && create_debian_pkg_list();
180
181 # - - - - - - - - - - - - - - - - - - - - - - - - - - -
182 # begin of the big foreach loop
183 # - - - - - - - - - - - - - - - - - - - - - - - - - - -
184 # call apt-get or tasksel for each type of command whith the list of packages
185 foreach $atype (@commands) {
186
187 if ($atype eq "clean-internal" && $hasdebian) {
188 execute("$rootcmd $command{'clean-internal'}") unless $listonly;
189 next;
190 }
191
192 # skip if empty list
193 next unless defined $list{$atype};
194 my $pkglist;
195
196 foreach $pkgopt (sort keys %{$list{$atype}}) {
197 $pkglist = $list{$atype}{$pkgopt}; # create an alias
198 # skip if empty list
199 next unless defined $pkglist;
200
201 # map release= option to -t
202 undef $pkgrel;
203 if ($pkgopt =~ /release=(\S+)/) {
204 $pkgrel=" -t $1";
205 }
206
207 if ($atype eq "dselect-upgrade") {
208 dselectupgrade($atype);
209 next;
210 }
211
212 my $packlist = join(' ',@{$pkglist});
213
214 if ($atype eq "hold") {
215 my $hold = join " hold\n", @{$list{hold}{$pkgopt}}, "";
216 execute("echo \"$hold\" | $rootcmd $command{hold}");
217 next;
218 }
219
220 if ($atype eq "install" || $atype eq "install-norec" || $atype eq "smarti" || $atype eq "cupt"|| $atype eq "cupt-r"|| $atype eq "apt" || $atype eq "aptitude" || $atype eq "aptitude-r" || $atype eq "unpack" || $opt_l || $opt_L) {
221
222 mkpackagelist(@{$pkglist}); # create lists of known and unknown packages
223 getsources(); # retrieve sources
224 if ($opt_l) {
225 print join " " , sort(@known), "\n";
226 next;
227 }
228 if ($opt_L) {
229 # only print the package list, only works for install and instal-norec
230 execute("$rootcmd $command{$atype} -s @known | egrep ^Inst");
231 next;
232 }
233
234 # pass only maxpl packages to apt-get
235 while (@known) {
236 my $shortlist = join(' ', splice @known,0,$maxpl);
237
238 # we can skip a package it's already processed,
239 if ($maxpl == 1 && $shortlist) {
240 @ls=<$ENV{FAI_ARCHIVE_DIR}/${shortlist}_*deb>;
241 next if @ls;
242 }
243 execute("$rootcmd $command{$atype} $pkgrel $shortlist") if $shortlist;
244 execute("$rootcmd $command{'clean-internal'}") if $hasdebian;
245 execute("$rootcmd $command{'unpack-internal'}") if ($atype eq "unpack"); # unpack and rm deb files
246 }
247 next;
248 }
249
250 if ($atype eq "taskinst" || $atype eq "taskrm") {
251 foreach my $tsk (@{$list{$atype}}) {
252 execute("$rootcmd $command{$atype} $tsk");
253 }
254 next;
255 }
256
257 # other types
258 execute("$rootcmd $command{$atype} $packlist") if $packlist;
259 } # foreach $pkgopt
260 }
261 # - - - - - - - - - - - - - - - - - - - - - - - - - - -
262 # end of the big foreach loop
263 # - - - - - - - - - - - - - - - - - - - - - - - - - - -
264 if ($opt_L || $opt_l) {
265 exit 0;
266 }
267
268 # remove preloaded files
269 foreach my $entry (@preloadrmlist) {
270 my ($url, $directory) = @$entry;
271 $url =~ m#/([^/]+$)#;
272 my $file = "$directory/$1";
273 print "rm $file\n" if $verbose;
274 unlink $file || warn "Can't remove $file\n";
275 }
276
277 if ($hasdebian) {
278 # in case of unconfigured packages because of apt errors
279 # retry configuration
280 execute("$rootcmd $command{'pending-internal'}");
281 # check if all went right
282 execute("$rootcmd $command{'dpkgc-internal'}");
283 # clean apt cache
284 execute("$rootcmd $command{'clean-internal'}");
285 }
286
287 if ($execerrors) {
288 warn "$execerrors errors during executing of $0\n";
289 exit 3;
290 }
291
292 exit 0; # end of program
293 # - - - - - - - - - - - - - - - - - - - - - - - - - - -
294 sub readconfig {
295
296 my ($path,$file) = @_;
297 my ($package,$type,$cllist,@oclasses,$doit);
298 my $pkgoption;
299
300 open (FILE,"$path/$file") || warn "ERROR $0: Can't read config file: $path/$file\n";
301 warn "$0: read config file $file\n" if $verbose;
302
303 while (<FILE>) {
304 next if /^#/; # skip comments
305 s/#.*$//; # delete comments
306 next if /^\s*$/; # skip empty lines
307 chomp;
308 /^PRELOAD\s+(\S+)\s+(\S+)/ and push(@preloadlist, [$1,$2]),next;
309 /^PRELOADRM\s+(\S+)\s+(\S+)/ and push(@preloadrmlist, [$1,$2]),next;
310
311 if (/^PACKAGES\s+(\S+)\s*(\S+=\S+)?\s*/) {
312 ($type,$pkgoption,$cllist) = ($1,$2,$');
313
314 warn "ERROR: PACKAGES option $pkgoption not allowed\n" unless ( ! defined $pkgoption or $pkgoption =~ /^release=/);
315
316 warn "WARNING: Unknown action $type after PACKAGES\n" unless defined $command{$type};
317
318 # by default no classes are listed after this command so doit
319 $doit = 1;
320 if ($cllist) {
321 next if ($opt_G && $cllist =~ /!/); # if we have a negation in the regex we need to download for fai-mirror
322 # check if we only have a list of classes or some logical expression
323 if ($cllist =~ /[!&|()]/) { # we found a logical expression
324 eval "require Eval::Logic" or
325 die "Perl module Eval::Logic is not available\n";
326 $cllist =~ s/-/Ö/g;
327 my $expr = Eval::Logic->new ( "$cllist" );
328 $expr->undef_default ( 0 ); # set default value for undefined classes
329 $doit = $expr->evaluate( @clvar );
330 print "FILE: $file LINE: $_ REGEX: $cllist = $doit\n" if $debug;
331 } else {
332 # use packages only for the list of classes (like a logical or for all classes)
333 $doit = 0; # assume no class is defined
334 @oclasses = split(/\s+/,$cllist);
335 # if a listed class is defined, add the packaes, otherwise skip these packages
336 foreach (@oclasses) { exists $classisdef{$_} and $doit = 1;}
337 }
338 }
339 next;
340 }
341
342 # warning if uppercase letters are found (package are always lowercase)
343 warn "WARNING: Uppercase character found in package name in line $_\n" if $_ =~ /[A-Z]/;
344 unless ($type) {
345 warn "ERROR: PACKAGES .. line missing in $file\n";
346 next;
347 }
348 push @{$list{$type}{$pkgoption}}, split if $doit;
349 $types{$type}=1 if $doit; # remember which types are used in package_config
350 }
351 }
352 # - - - - - - - - - - - - - - - - - - - - - - - - - - -
353 sub execute {
354
355 # execute a command or only print it
356 my @cmds = @_;
357
358 # TODO: split cmds into array except when a pipe is found
359
360 my $command = join (' ',@cmds);
361 $command =~ s/\s+/ /g;
362 my $error;
363
364 return if ($command eq ' true'); # do not execute noop command
365 $dryrun and $verbose = 1;
366 $verbose and warn "$0: executing $command\n";
367 $dryrun and return;
368
369 # @cmds should me more efficient
370 $error = system @cmds;
371 warn "ERROR: $error $?\n" if $error;
372 my $rc = $?>>8;
373 warn "ERROR: $cmds[0] return code $rc\n" if $rc;
374 $execerrors++ if $rc;
375 }
376 # - - - - - - - - - - - - - - - - - - - - - - - - - - -
377 sub dselectupgrade {
378
379 my $type = shift;
380 my ($package,$action,$list);
381 my $tempfile = "$FAI_ROOT/var/lib/fai/dpkg-selections.tmp"; # TODO: use better uniq filename
382 while (@{$list{$type}}) {
383 $package = shift @{$list{$type}};
384 $action = shift @{$list{$type}};
385 $list .= "$package $action\n";
386 }
387
388 open TMP,"> $tempfile" || die " Can't write to $tempfile";
389 print TMP $list;
390 close TMP;
391
392 execute("$rootcmd dpkg --set-selections < $tempfile");
393 execute("$rootcmd $command{$type}");
394 unlink $tempfile;
395 }
396 # - - - - - - - - - - - - - - - - - - - - - - - - - - -
397 sub mkpackagelist {
398
399 my @complete = @_; # copy original list
400 # @known contains the known packages
401
402 # on Debian system, clean list of packages
403 if ( ! $opt_N && $hasdebian ) {
404 @known = clean_pkg_list(@complete);
405 } else {
406 @known = @complete;
407 }
408
409 return if $opt_c;
410 writepackages();
411 return;
412 }
413
414 # - - - - - - - - - - - - - - - - - - - - - - - - - - -
415 sub writepackages {
416
417 # write package list to log file
418
419 return if $opt_d; # do not write the list if we only download packages
420 return if $opt_l; # do not write the list to a file, just print it
421 return if $dryrun;
422
423 open(LIST,"> $FAI_ROOT/var/log/install_packages.list") || warn "ERROR $0: Can't write package list file: $!\n";
424 print LIST "# List of all packages that will be installed via install_packages\n";
425 for (@known) { print LIST "$_\n"; }
426 close(LIST);
427 }
428 # - - - - - - - - - - - - - - - - - - - - - - - - - - -
429 # download debian source packages
430 sub getsources {
431
432 return unless $opt_s;
433
434 print "Trying to retrieve sources as specified via -s option for install_packages\n" if $verbose;
435
436 if (!$ENV{'FAI_DEBSOURCESDIR'}) {
437 die "Error: FAI_DEBSOURCESDIR is not set, can not retrieve sources.";
438 }
439
440 execute("mkdir -p $FAI_ROOT/$debsourcesdir;");
441 execute("mkdir -p $ENV{'FAI_DEBSOURCESDIR'};");
442 for (@known) {
443 execute("$rootcmd sh -c \"cd $debsourcesdir ; apt-get --download-only source $_\"");
444 execute("mv $FAI_ROOT/$debsourcesdir/* $ENV{'FAI_DEBSOURCESDIR'}");
445 }
446 }
447 # - - - - - - - - - - - - - - - - - - - - - - - - - - -
448 sub usage {
449
450 print << "EOF";
451 install_packages
452
453 Please read the manual pages install_packages(8).
454 EOF
455 exit 0;
456 }
457 # - - - - - - - - - - - - - - - - - - - - - - - - - - -
458 sub setdownloadonly {
459
460 # Definitions for install_packages(8) for download only mode
461 # Used by fai-mirror(1)
462
463 # we are using a variable from %ENV
464 # for debugging remove >/dev/null and -q
465
466 undef @commands;
467 undef %command;
468
469 $maxpl //= 9999;
470 @commands = qw/taskinst cupt cupt-r aptitude aptitude-r install install-norec apt unpack/;
471 %command = (
472 "install" => "apt-get $qopt -d $ENV{aptoptions} -y --fix-missing install",
473 "install-norec" => "apt-get $qopt -d $ENV{aptoptions} -y --fix-missing install --no-install-recommends",
474 "taskinst" => "aptitude -d $ENV{aptoptions} -y install $devnull",
475 "apt" => "apt $qopt -d $ENV{aptoptions} -y install $devnull",
476 "aptitude" => "aptitude -R -d $ENV{aptoptions} -y install $devnull",
477 "aptitude-r" => "aptitude -r -d $ENV{aptoptions} -y install $devnull",
478 "cupt" => "cupt -R --download-only $ENV{aptoptions} -y install $devnull",
479 "cupt-r" => "cupt --download-only $ENV{aptoptions} -y install $devnull",
480 "unpack" => "cd $downloaddir; aptitude download",
481 "clean-internal" => 'true',
482 "pending-internal" => 'true',
483 "dpkgc-internal" => 'true',
484 );
485
486 }
487 # - - - - - - - - - - - - - - - - - - - - - - - - - - -
488 sub showcommands {
489
490 # show all available commands
491 print "List of known commands for package_config files\n";
492 print "Short list:\n";
493 foreach (sort keys %command) {
494 next if /-internal/; # skip internal commands
495 print "$_\n";
496 }
497
498 print "\nLong list:\n";
499 foreach (sort keys %command) {
500 next if /-internal/; # skip internal commands
501 printf "%15s $command{$_}\n",$_;
502 }
503 exit 0;
504 }
505 # - - - - - - - - - - - - - - - - - - - - - - - - - - -
506 sub create_debian_pkg_list {
507 # build a hash of all known package names
508 open(IN,"$rootcmd apt-cache $ENV{aptoptions} dumpavail |") || die;
509 while (<IN>) {
510 chomp;
511 if (s/^Package: //) {
512 $pname{$_} = 1;
513 } elsif (s/^Provides: //) {
514 foreach (split /\s*,\s*/) {
515 $pname{$_} = 1;
516 }
517 }
518 }
519 close(IN);
520 }
521 # - - - - - - - - - - - - - - - - - - - - - - - - - - -
522 sub insert_pkg {
523
524 # if package name is known, insert package into data structure, return success
525
526 # parameters
527 # orig: is the pkg name as found in the config file (including - + /backports :amd64
528 # pack: pkg name with those extensions
529 # install: 0/1 if package should be installed/downloaded
530 # msg: a debug message
531
532 # insert orig package name and modified name into %pmap
533 # %pmap maps orig name (including +-=) to real package names
534 # save status install/remove of each package in %install
535
536 my ($orig, $pack, $install, $msg) = @_;
537
538 if ($pname{$pack}) {
539 print "$msg\n" if $debug;
540 push @newlist, $orig;
541 $pmap{$orig} = "$pack";
542 $install{$pack} = $install;
543 return 1;
544 }
545 return 0;
546 }
547 # - - - - - - - - - - - - - - - - - - - - - - - - - - -
548 sub clean_pkg_list {
549
550 # clean up the list of packages, remove unknown packages,
551 # "merge" things like: pkgA pkgA-
552
553 my @inlist = @_;
554 my $pack;
555 my @unknown;
556 my @final; # final list of packages
557
558 # clean global hashes
559 undef %pmap;
560 undef %install;
561
562 foreach my $n (@inlist) {
563 $pack = $n;
564
565 # substitute $varname in package name, also pkgname$var
566 if ( $pack =~ m#(\S*)\$\{?(\w+)\}?#) {
567 $pack = "$1$ENV{$2}";
568 print "VARIABLE in $n : $1 has variable $2 = $ENV{$2} RESULT: $pack\n" if $debug;
569 }
570
571 # plain package name is known, this also matches g++, memtest86+, ...
572 insert_pkg($n, $pack, 1, "$n found") && next;
573
574 # handle packagename-
575 if ( $pack =~ s/-$//) {
576 next if $opt_G; # ignore pkgname- for generic
577 insert_pkg($n, $pack, 0, "$pack - removed") && next;
578 }
579
580 # handle packagename+, where packagename itself does not include a +
581 if ( $pack =~ s/\+$//) {
582 insert_pkg($n, $pack, 1, "$pack + added") && next;
583 }
584
585 # remove /distribution or =version from package name
586 if ( $pack =~ s#[/=].+##) {
587 insert_pkg($n, $pack, 1, "$n using $pack found") && next;
588 }
589
590 # remove :arch from package name
591 if ( $pack =~ s/:\S+//) {
592 insert_pkg($n, $pack, 1, "$n using $pack found") && next;
593 }
594
595 # else package is unknown
596 push @unknown, $n;
597 }
598
599 warn "WARNING: These unknown packages are removed from the installation list: " . join(' ', @unknown) . "\n" if @unknown;
600 $opt_c && return;
601
602 print "-"x30,"\n" if $debug;
603 print join ' ' ," ORIG:", @inlist, "\n" if $debug;
604 print join ' ' ,"INSTALL:", @newlist, "\n" if $debug;
605
606
607 # create new list of packages (incl. +-/=) that should be installed or removed
608 foreach (@newlist) {
609
610 push @final, $_ if ($install{$pmap{$_}} == 0 && $_ =~/-$/); # pkg names with - that should be not installed
611 next if ($install{$pmap{$_}} == 1 && $_ =~/-$/);
612 next unless $install{$pmap{$_}}; # do not include package that are marked as do not install
613 push @final, $_;
614 }
615
616 print join ' ' ,"DO INST:", @final, "\n" if $debug;
617 return @final;
618 }