Log automatic package updates

This commit is contained in:
Jamie Cameron
2024-07-13 17:07:07 -07:00
parent 29da8ea3d0
commit 165af690c7
3 changed files with 10 additions and 0 deletions

View File

@@ -103,6 +103,7 @@ sched_yes=Scheduled checking for updates is now active.
sched_no=Scheduled checking for updates has been disabled.
log_update=Installed $1 updated packages
log_sched=Background installed $1 updated packages
log_sched=Enabled scheduled updates
log_unsched=Disabled scheduled updates
log_refresh=Refreshed available packages

View File

@@ -18,6 +18,9 @@ elsif ($type eq 'repo') {
elsif ($action eq 'update') {
return &text('log_update', $object);
}
elsif ($action eq 'sched') {
return &text('log_sched', $object);
}
elsif ($action eq 'sched') {
return $text{$object ? 'log_sched' : 'log_unsched'};
}

View File

@@ -17,6 +17,7 @@ if ($ARGV[0] eq "--debug" || $ARGV[0] eq "-debug") {
$tellcount = 0;
%already = ( );
&start_update_progress([ map { $_->{'name'} } @todo ]);
$icount = 0;
foreach $t (@todo) {
next if ($already{$t->{'update'}});
my $umsg = $t->{'security'} ? "security update" : "update";
@@ -24,6 +25,7 @@ foreach $t (@todo) {
$config{'sched_action'} == 1 && $t->{'security'}) {
# Can install
$body .= "An $umsg to $t->{'name'} from $t->{'oldversion'} to $t->{'version'} is needed.\n";
$icount++;
($out, $done) = &capture_function_output(
\&package_install, $t->{'update'});
if (@$done) {
@@ -70,3 +72,7 @@ if ($config{'sched_email'} && $body) {
}
}
# Log the update, if anything was installed
if ($icount) {
&webmin_log("sched", "packages", $icount);
}