Skip to content

Commit

Permalink
Fix to wait for systemd to update ; fix getting status at right time …
Browse files Browse the repository at this point in the history
…[build]
  • Loading branch information
iliajie committed Apr 21, 2024
1 parent 68d7f49 commit c9e2f8c
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 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 @@ -35,12 +39,9 @@
}
&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");
sleep(3); # Wait for systemd to update configuration

if ($status eq "disabled") {
system("systemctl disable ".
Expand Down

0 comments on commit c9e2f8c

Please sign in to comment.