Add option to notify for security updates only https://github.com/webmin/webmin/issues/2075

This commit is contained in:
Jamie Cameron
2024-01-14 10:37:30 -08:00
parent b6b8398eb2
commit 5c8d5ee75e
3 changed files with 9 additions and 7 deletions

View File

@@ -217,7 +217,8 @@ print &ui_table_row($text{'index_email'},
# Install or just notify?
print &ui_table_row($text{'index_action'},
&ui_radio("action", int($config{'sched_action'}),
[ [ 0, $text{'index_action0'} ],
[ [ -1, $text{'index_action-1'} ],
[ 0, $text{'index_action0'} ],
[ 1, $text{'index_action1'} ],
[ 2, $text{'index_action2'} ] ]));

View File

@@ -19,7 +19,8 @@ index_schedd=day
index_schedw=week
index_email=Email updates report to
index_action=Action when update needed
index_action0=Just notify
index_action-1=Just notify for security updates
index_action0=Just notify for any updates
index_action1=Install security updates
index_action2=Install any updates
index_err=Failed to fetch package list

View File

@@ -12,9 +12,6 @@ if ($ARGV[0] eq "--debug" || $ARGV[0] eq "-debug") {
&flush_package_caches();
&clear_repository_cache();
@todo = &list_possible_updates();
foreach $a (@todo) {
$a->{'level'} = $a->{'security'} ? 1 : 2;
}
# Install packages that are needed
$tellcount = 0;
@@ -22,7 +19,8 @@ $tellcount = 0;
&start_update_progress([ map { $_->{'name'} } @todo ]);
foreach $t (@todo) {
next if ($already{$t->{'update'}});
if ($t->{'level'} <= $config{'sched_action'}) {
if ($config{'sched_action'} == 2 ||
$config{'sched_action'} == 1 && $t->{'security'}) {
# Can install
$body .= "An update to $t->{'name'} from $t->{'oldversion'} to $t->{'version'} is needed.\n";
($out, $done) = &capture_function_output(
@@ -37,7 +35,9 @@ foreach $t (@todo) {
$already{$p}++;
}
}
else {
elsif ($config{'sched_action'} == 1 ||
$config{'sched_action'} == 0 ||
$config{'sched_action'} == -1 && $t->{'security'}) {
# Just tell the user about it
$body .= "An update to $t->{'name'} from $t->{'oldversion'} to $t->{'version'} is available.\n\n";
$tellcount++;