Browse Source

deb-systemd-*, update-rc.d: Don't hard-code path to systemctl binary

This should simplify an eventual move of systemctl from /bin to
/usr/bin.
tags/devuan/1.60+devuan1
Michael Biebl 10 months ago
parent
commit
bbc1c7c4fa
3 changed files with 7 additions and 7 deletions
  1. +2
    -2
      script/deb-systemd-helper
  2. +4
    -4
      script/deb-systemd-invoke
  3. +1
    -1
      script/update-rc.d

+ 2
- 2
script/deb-systemd-helper View File

@@ -105,7 +105,7 @@ my $masked_state_dir = SYSTEM_INSTANCE_MASKED_STATE_DIR;
# Globals are bad, but in this specific case, it really makes things much
# easier to write and understand.
my $changed_sth;
my $has_systemctl = -x "/bin/systemctl";
my $has_systemctl = -x "/bin/systemctl" || -x "/usr/bin/systemctl";

sub error {
print STDERR "$0: error: @_\n";
@@ -268,7 +268,7 @@ sub enable {
$create_links = 1 unless no_link_installed($scriptname, $service_path);
} else {
debug "Using systemctl preset to enable $scriptname";
system("/bin/systemctl",
system("systemctl",
$instance eq "user" ? "--global" : "--system",
"--preset-mode=enable-only",
"preset", $scriptname) == 0


+ 4
- 4
script/deb-systemd-invoke View File

@@ -86,12 +86,12 @@ if ($action eq "start" || $action eq "restart") {
my @start_units = ();
for my $unit (@units) {
my $unit_installed = 0;
my $enabled_output = `/bin/systemctl is-enabled -- '$unit'`;
my $enabled_output = `systemctl is-enabled -- '$unit'`;
# matching enabled and enabled-runtime as an installed non static unit
if ($enabled_output =~ /enabled/) {
$unit_installed = 1;
}
system('/bin/systemctl', '--quiet', 'is-active', '--', $unit);
system('systemctl', '--quiet', 'is-active', '--', $unit);
my $unit_active = $?>>8 == 0 ? 1 : 0;
if (!$unit_installed && $action eq "start") {
print STDERR "$unit is a disabled or a static unit, not starting it.\n";
@@ -103,9 +103,9 @@ if ($action eq "start" || $action eq "restart") {
}
}
if (@start_units) {
exec('/bin/systemctl', $action, @start_units) or die("Could not execute systemctl: $!");
exec('systemctl', $action, @start_units) or die("Could not execute systemctl: $!");
}
exit(0);
} else {
exec '/bin/systemctl', @ARGV;
exec('systemctl', @ARGV);
}

+ 1
- 1
script/update-rc.d View File

@@ -136,7 +136,7 @@ sub make_systemd_links {
}

# If systemctl is available, let's use that to create the symlinks.
if (-x "/bin/systemctl") {
if (-x "/bin/systemctl" || -x "/usr/bin/systemctl") {
# Set this env var to avoid loop in systemd-sysv-install.
local $ENV{SYSTEMCTL_SKIP_SYSV} = 1;
# Use --quiet to mimic the old update-rc.d behaviour.


Loading…
Cancel
Save