From c9e2f8cb3637ad6b0d8f89c5ae9e3758686d880c Mon Sep 17 00:00:00 2001 From: Ilia Ross Date: Sun, 21 Apr 2024 15:02:33 +0300 Subject: [PATCH] Fix to wait for systemd to update ; fix getting status at right time [build] --- updateboot.pl | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/updateboot.pl b/updateboot.pl index 09e5a76e..f18e753c 100755 --- a/updateboot.pl +++ b/updateboot.pl @@ -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 ( @@ -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 ".