Skip to content

Commit

Permalink
Fix to preserve service state webmin/webmin#2133
Browse files Browse the repository at this point in the history
[build]
  • Loading branch information
iliajie committed Apr 21, 2024
1 parent 8e3ba8c commit 68d7f49
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions updateboot.pl
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,26 @@
$l =~ s/(WEBMIN_[A-Z]+)/$ENV{$1}/g;
}
&flush_file_lines($temp);

my $status = &backquote_logged("systemctl is-enabled ".
quotemeta($product).".service 2>&1");
$status = &trim($status);

copy_source_dest($temp, "$systemd_root/$product.service");

system("systemctl daemon-reload >/dev/null 2>&1");
system("systemctl enable $product >/dev/null 2>&1");

if ($status eq "disabled") {
system("systemctl disable ".
quotemeta($product).".service >/dev/null 2>&1");
}
elsif ($status eq "masked") {
system("systemctl mask ".
quotemeta($product).".service >/dev/null 2>&1");
}
else {
system("systemctl enable ".
quotemeta($product).".service >/dev/null 2>&1");
}
}
elsif (-d "/etc/init.d") {
copy_source_dest("usermin-init", "/etc/init.d/$product");
Expand Down

0 comments on commit 68d7f49

Please sign in to comment.