Fix not to run check_reboot_required on initial load

This commit is contained in:
iliajie
2023-03-03 22:29:48 +02:00
parent 8e083d044e
commit 0ead391e47
4 changed files with 8 additions and 5 deletions

View File

@@ -677,10 +677,13 @@ return $mode eq 'updates' || $mode eq 'security' ?
&list_possible_updates($nocache) : &list_available($nocache);
}
# check_reboot_required(after-flag)
# check_reboot_required([no-collect])
# Returns 1 if the package system thinks a reboot is needed
# If the no-collect flag is set, then check won't happen
sub check_reboot_required
{
my ($no_collect) = @_;
return 0 if ($no_collect);
if ($gconfig{'os_type'} eq 'debian-linux') {
return -e "/var/run/reboot-required" ? 1 : 0;
}

View File

@@ -108,7 +108,7 @@ else {
}
else {
# Check if a reboot was required before
$reboot_before = &check_reboot_required(0);
$reboot_before = &check_reboot_required();
# Do it
$msg = $in{'mode'} eq 'new' ? 'update_pkg2' : 'update_pkg';
@@ -165,7 +165,7 @@ else {
}
# Check if a reboot is required now
if (!$reboot_before && &check_reboot_required(1) &&
if (!$reboot_before && &check_reboot_required() &&
&foreign_check("init")) {
print &ui_form_start(
"@{[&get_webprefix()]}/init/reboot.cgi");