Skip to content

Commit c9b7964

Browse files
committed
Sync contrib service with static systemd args
And add comments in both places so we remember to keep them in sync. Signed-off-by: Colin Walters <[email protected]>
1 parent 9c56839 commit c9b7964

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

Diff for: contrib/packaging/bootloader-update.service

+4
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ Documentation=https://github.com/coreos/bootupd
66
Type=oneshot
77
ExecStart=/usr/bin/bootupctl update
88
RemainAfterExit=yes
9+
# Keep this stuff in sync with SYSTEMD_ARGS_BOOTUPD in general
10+
PrivateNetwork=yes
11+
ProtectHome=yes
12+
KillMode=mixed
913
MountFlags=slave
1014

1115
[Install]

Diff for: src/cli/bootupctl.rs

+10-8
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,17 @@ use log::LevelFilter;
66
use std::os::unix::process::CommandExt;
77
use std::process::{Command, Stdio};
88

9-
static SYSTEMD_ARGS_BOOTUPD: &[&str] = &[
10-
"--unit",
11-
"bootupd",
12-
"--property",
9+
static SYSTEMD_ARGS_BOOTUPD: &[&str] = &["--unit", "bootupd", "--pipe"];
10+
11+
/// Keep these properties (isolation/runtime state) in sync with
12+
/// the systemd units in contrib/packaging/*.service
13+
static SYSTEMD_PROPERTIES: &[&str] = &[
1314
"PrivateNetwork=yes",
14-
"--property",
1515
"ProtectHome=yes",
1616
// While only our main process during update catches SIGTERM, we don't
1717
// want systemd to send it to other processes.
18-
"--property",
1918
"KillMode=mixed",
20-
"--property",
2119
"MountFlags=slave",
22-
"--pipe",
2320
];
2421

2522
/// `bootupctl` sub-commands.
@@ -171,6 +168,11 @@ fn ensure_running_in_systemd() -> Result<()> {
171168
.wait()?;
172169
let r = Command::new("systemd-run")
173170
.args(SYSTEMD_ARGS_BOOTUPD)
171+
.args(
172+
SYSTEMD_PROPERTIES
173+
.into_iter()
174+
.flat_map(|&v| ["--property", v]),
175+
)
174176
.args(std::env::args())
175177
.exec();
176178
// If we got here, it's always an error

0 commit comments

Comments
 (0)