Skip to content

Commit

Permalink
Merge branch 'master' of github.com:webmin/usermin
Browse files Browse the repository at this point in the history
  • Loading branch information
jcameron committed Jun 2, 2024
2 parents 4b64816 + c9e2f8c commit 12743db
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions updateboot.pl
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
if (-d "/etc/systemd" &&
&has_command("systemctl") &&
&execute_command("systemctl list-units") == 0) {
# Save status of service
my $status = &backquote_logged("systemctl is-enabled ".
quotemeta($product).".service 2>&1");
$status = &trim($status) if ($status);
# Delete all possible service files
my $systemd_root = &get_systemd_root();
foreach my $p (
Expand All @@ -34,10 +38,23 @@
$l =~ s/(WEBMIN_[A-Z]+)/$ENV{$1}/g;
}
&flush_file_lines($temp);

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

system("systemctl daemon-reload >/dev/null 2>&1");
system("systemctl enable $product >/dev/null 2>&1");
sleep(3); # Wait for systemd to update configuration

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 12743db

Please sign in to comment.