Onboard: auto-enable systemd lingering on Linux

This commit is contained in:
Tobias Bischoff
2026-01-05 20:33:34 +01:00
committed by Peter Steinberger
parent 949ea38ef5
commit de153a40d0
4 changed files with 42 additions and 12 deletions

View File

@@ -42,8 +42,8 @@ export async function ensureSystemdUserLingerInteractive(params: {
params.reason ??
"Systemd user services stop when you log out or go idle, which kills the Gateway.";
const actionNote = params.requireConfirm
? "We can enable lingering now (needs sudo; writes /var/lib/systemd/linger)."
: "Enabling lingering now (needs sudo; writes /var/lib/systemd/linger).";
? "We can enable lingering now (may require sudo; writes /var/lib/systemd/linger)."
: "Enabling lingering now (may require sudo; writes /var/lib/systemd/linger).";
await prompter.note(`${reason}\n${actionNote}`, title);
if (params.requireConfirm && prompter.confirm) {
@@ -60,6 +60,15 @@ export async function ensureSystemdUserLingerInteractive(params: {
}
}
const resultNoSudo = await enableSystemdUserLinger({
env,
user: status.user,
});
if (resultNoSudo.ok) {
await prompter.note(`Enabled systemd lingering for ${status.user}.`, title);
return;
}
const result = await enableSystemdUserLinger({
env,
user: status.user,