Some post unmerged-usr cleanups (#38696)

I noticed in our NixOS packaging that we were working around the fact
that core/swap.c looks for swapon and swapoff in /sbin

Lets make it configurable just like all the other util-linux binaries
through meson and make it default to /usr/sbin/{swapon,swapoff}

This way mounts work on a systemd without the /sbin -> /usr/sbin
compatibility symlink. (And as a side-effect has NixOS be able to have
it in /nix/store too like the other util-linux tools).

Given that `unmerged-usr` support was dropped in 255 I think this is a
safe change?
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2025-09-17 14:22:05 +02:00
committed by GitHub
8 changed files with 13 additions and 7 deletions
+2 -2
View File
@@ -781,7 +781,7 @@ static void swap_enter_activating(Swap *s) {
}
}
r = exec_command_set(s->control_command, "/sbin/swapon", "--fixpgsz", NULL);
r = exec_command_set(s->control_command, SWAPON, "--fixpgsz", NULL);
if (r < 0) {
log_unit_warning_errno(UNIT(s), r, "Failed to initialize swapon command line: %m");
goto fail;
@@ -826,7 +826,7 @@ static void swap_enter_deactivating(Swap *s) {
s->control_command = s->exec_command + SWAP_EXEC_DEACTIVATE;
r = exec_command_set(s->control_command,
"/sbin/swapoff",
SWAPOFF,
s->what,
NULL);
if (r < 0) {