Show what will happen on Debian

This commit is contained in:
Jamie Cameron
2009-10-03 14:00:27 -07:00
parent d3178eedf5
commit e56a9da7dd
2 changed files with 26 additions and 2 deletions

View File

@@ -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;";

View File

@@ -66,6 +66,31 @@ else { print "<b>$text{'apt_ok'}</b><p>\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)).
" </dev/null 2>&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