diff --git a/package-updates/package-updates-lib.pl b/package-updates/package-updates-lib.pl index 93f2aa60c..97a64b145 100644 --- a/package-updates/package-updates-lib.pl +++ b/package-updates/package-updates-lib.pl @@ -4,8 +4,7 @@ # XXX cron job to collect .. actually use webmin module collector # XXX re-check after package update # XXX test automatic notification -# XXX test on debian -# XXX show what will be done +# XXX show on system information page? BEGIN { push(@INC, ".."); }; eval "use WebminCore;"; diff --git a/software/apt-lib.pl b/software/apt-lib.pl index e22e2e23f..f066c9dab 100755 --- a/software/apt-lib.pl +++ b/software/apt-lib.pl @@ -66,6 +66,31 @@ else { print "$text{'apt_ok'}
\n"; } return @rv; } +# update_system_operations(packages) +# Given a list of packages, returns a list containing packages that will +# actually get installed, each of which is a hash ref with name and version. +sub update_system_operations +{ +my ($packages) = @_; +$ENV{'DEBIAN_FRONTEND'} = 'noninteractive'; +my $cmd = "apt-get -s install ". + join(" ", map { quotemeta($_) } split(/\s+/, $packages)). + " &1"; +my $out = &backquote_command($cmd); +my @rv; +foreach my $l (split(/\r?\n/, $out)) { + if ($l =~ /Inst\s+(\S+)\s+\[(\S+)\]/) { + my $pkg = { 'name' => $1, + 'version' => $2 }; + if ($pkg->{'version'} =~ s/^(\S+)://) { + $pkg->{'epoch'} = $1; + } + push(@rv, $pkg); + } + } +return @rv; +} + # update_system_form() # Shows a form for updating all packages on the system sub update_system_form