Fix to save status of service correctly [build]

This commit is contained in:
Ilia Ross
2024-04-21 14:59:12 +03:00
parent 975ae7b497
commit 1f2a7902c6

View File

@@ -11,6 +11,10 @@ $< == 0 || die "updateboot.pl must be run as root";
# Update boot script
if ($product) {
if ($init_mode eq "systemd") {
# 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 (
@@ -30,10 +34,6 @@ if ($product) {
}
&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