Use process groups with tokio (also crate bump) (#63)
* Use process groups with tokio (also flake/crate bump) * Use pgid0 * Maybe this checkout has a non-broken curl on mac * Don't update flake at all
This commit is contained in:
parent
38ac180052
commit
ad44b85c97
|
@ -1,2 +1,2 @@
|
||||||
[build]
|
[build]
|
||||||
rustflags=["--cfg", "tracing_unstable"]
|
rustflags=["--cfg", "tracing_unstable", "--cfg", "tokio_unstable"]
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,2 +1,3 @@
|
||||||
/target
|
/target
|
||||||
.ci-store
|
.ci-store
|
||||||
|
.direnv
|
68
Cargo.lock
generated
68
Cargo.lock
generated
|
@ -241,9 +241,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bytes"
|
name = "bytes"
|
||||||
version = "1.2.1"
|
version = "1.3.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ec8a7b6a70fde80372154c65702f00a0f56f3e1c36abbc6c440484be248856db"
|
checksum = "dfb24e866b15a1af2a1b663f10c6b6b8f397a84aadb828f12e5b289ec23a3a3c"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cache-padded"
|
name = "cache-padded"
|
||||||
|
@ -253,9 +253,9 @@ checksum = "c1db59621ec70f09c5e9b597b220c7a2b43611f4710dc03ceb8748637775692c"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cc"
|
name = "cc"
|
||||||
version = "1.0.76"
|
version = "1.0.77"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "76a284da2e6fe2092f2353e51713435363112dfd60030e22add80be333fb928f"
|
checksum = "e9f73505338f7d905b19d18738976aae232eb46b8efc15554ffc56deb5d9ebe4"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cfg-if"
|
name = "cfg-if"
|
||||||
|
@ -376,9 +376,9 @@ checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "crossbeam-utils"
|
name = "crossbeam-utils"
|
||||||
version = "0.8.12"
|
version = "0.8.14"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "edbafec5fa1f196ca66527c1b12c2ec4745ca14b50f1ad8f9f6f720b55d11fac"
|
checksum = "4fb766fa798726286dbbb842f174001dab8abc7b627a1dd86e0b7222a95d929f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
]
|
]
|
||||||
|
@ -421,9 +421,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cxx"
|
name = "cxx"
|
||||||
version = "1.0.81"
|
version = "1.0.82"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "97abf9f0eca9e52b7f81b945524e76710e6cb2366aead23b7d4fbf72e281f888"
|
checksum = "d4a41a86530d0fe7f5d9ea779916b7cadd2d4f9add748b99c2c029cbbdfaf453"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cc",
|
"cc",
|
||||||
"cxxbridge-flags",
|
"cxxbridge-flags",
|
||||||
|
@ -433,9 +433,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cxx-build"
|
name = "cxx-build"
|
||||||
version = "1.0.81"
|
version = "1.0.82"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7cc32cc5fea1d894b77d269ddb9f192110069a8a9c1f1d441195fba90553dea3"
|
checksum = "06416d667ff3e3ad2df1cd8cd8afae5da26cf9cec4d0825040f88b5ca659a2f0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cc",
|
"cc",
|
||||||
"codespan-reporting",
|
"codespan-reporting",
|
||||||
|
@ -448,15 +448,15 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cxxbridge-flags"
|
name = "cxxbridge-flags"
|
||||||
version = "1.0.81"
|
version = "1.0.82"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8ca220e4794c934dc6b1207c3b42856ad4c302f2df1712e9f8d2eec5afaacf1f"
|
checksum = "820a9a2af1669deeef27cb271f476ffd196a2c4b6731336011e0ba63e2c7cf71"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cxxbridge-macro"
|
name = "cxxbridge-macro"
|
||||||
version = "1.0.81"
|
version = "1.0.82"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b846f081361125bfc8dc9d3940c84e1fd83ba54bbca7b17cd29483c828be0704"
|
checksum = "a08a6e2fcc370a089ad3b4aaf54db3b1b4cee38ddabce5896b33eb693275f470"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
|
@ -762,7 +762,7 @@ version = "0.3.15"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5f9f29bc9dda355256b2916cf526ab02ce0aeaaaf2bad60d65ef3f12f11dd0f4"
|
checksum = "5f9f29bc9dda355256b2916cf526ab02ce0aeaaaf2bad60d65ef3f12f11dd0f4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytes 1.2.1",
|
"bytes 1.3.0",
|
||||||
"fnv",
|
"fnv",
|
||||||
"futures-core",
|
"futures-core",
|
||||||
"futures-sink",
|
"futures-sink",
|
||||||
|
@ -782,7 +782,7 @@ dependencies = [
|
||||||
"async-tar",
|
"async-tar",
|
||||||
"async-trait",
|
"async-trait",
|
||||||
"atty",
|
"atty",
|
||||||
"bytes 1.2.1",
|
"bytes 1.3.0",
|
||||||
"clap",
|
"clap",
|
||||||
"color-eyre",
|
"color-eyre",
|
||||||
"crossterm",
|
"crossterm",
|
||||||
|
@ -851,7 +851,7 @@ version = "0.2.8"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "75f43d41e26995c17e71ee126451dd3941010b0514a81a9d11f3b341debc2399"
|
checksum = "75f43d41e26995c17e71ee126451dd3941010b0514a81a9d11f3b341debc2399"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytes 1.2.1",
|
"bytes 1.3.0",
|
||||||
"fnv",
|
"fnv",
|
||||||
"itoa",
|
"itoa",
|
||||||
]
|
]
|
||||||
|
@ -862,7 +862,7 @@ version = "0.4.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1"
|
checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytes 1.2.1",
|
"bytes 1.3.0",
|
||||||
"http",
|
"http",
|
||||||
"pin-project-lite",
|
"pin-project-lite",
|
||||||
]
|
]
|
||||||
|
@ -885,7 +885,7 @@ version = "0.14.23"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "034711faac9d2166cb1baf1a2fb0b60b1f277f8492fd72176c17f3515e1abd3c"
|
checksum = "034711faac9d2166cb1baf1a2fb0b60b1f277f8492fd72176c17f3515e1abd3c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytes 1.2.1",
|
"bytes 1.3.0",
|
||||||
"futures-channel",
|
"futures-channel",
|
||||||
"futures-core",
|
"futures-core",
|
||||||
"futures-util",
|
"futures-util",
|
||||||
|
@ -964,9 +964,9 @@ checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "indexmap"
|
name = "indexmap"
|
||||||
version = "1.9.1"
|
version = "1.9.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e"
|
checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"autocfg",
|
"autocfg",
|
||||||
"hashbrown",
|
"hashbrown",
|
||||||
|
@ -1208,9 +1208,9 @@ checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "os_str_bytes"
|
name = "os_str_bytes"
|
||||||
version = "6.4.0"
|
version = "6.4.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7b5bf27447411e9ee3ff51186bf7a08e16c341efdde93f4d823e8844429bed7e"
|
checksum = "9b7820b9daea5457c9f21c69448905d723fbd21136ccf521748f23fd49e723ee"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "overload"
|
name = "overload"
|
||||||
|
@ -1515,7 +1515,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "68cc60575865c7831548863cc02356512e3f1dc2f3f82cb837d7fc4cc8f3c97c"
|
checksum = "68cc60575865c7831548863cc02356512e3f1dc2f3f82cb837d7fc4cc8f3c97c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64",
|
"base64",
|
||||||
"bytes 1.2.1",
|
"bytes 1.3.0",
|
||||||
"encoding_rs",
|
"encoding_rs",
|
||||||
"futures-core",
|
"futures-core",
|
||||||
"futures-util",
|
"futures-util",
|
||||||
|
@ -1655,9 +1655,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_json"
|
name = "serde_json"
|
||||||
version = "1.0.87"
|
version = "1.0.89"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6ce777b7b150d76b9cf60d28b55f5847135a003f7d7350c6be7a773508ce7d45"
|
checksum = "020ff22c755c2ed3f8cf162dbb41a7268d934702f3ed3631656ea597e08fc3db"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"itoa",
|
"itoa",
|
||||||
"ryu",
|
"ryu",
|
||||||
|
@ -1678,9 +1678,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_with"
|
name = "serde_with"
|
||||||
version = "2.0.1"
|
version = "2.1.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "368f2d60d049ea019a84dcd6687b0d1e0030fe663ae105039bdf967ed5e6a9a7"
|
checksum = "25bf4a5a814902cd1014dbccfa4d4560fb8432c779471e96e035602519f82eef"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64",
|
"base64",
|
||||||
"chrono",
|
"chrono",
|
||||||
|
@ -1694,9 +1694,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_with_macros"
|
name = "serde_with_macros"
|
||||||
version = "2.0.1"
|
version = "2.1.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1ccadfacf6cf10faad22bbadf55986bdd0856edfb5d9210aa1dcf1f516e84e93"
|
checksum = "e3452b4c0f6c1e357f73fdb87cd1efabaa12acf328c7a528e252893baeb3f4aa"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"darling",
|
"darling",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
|
@ -1931,12 +1931,12 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tokio"
|
name = "tokio"
|
||||||
version = "1.21.2"
|
version = "1.22.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a9e03c497dc955702ba729190dc4aac6f2a0ce97f913e5b1b5912fc5039d9099"
|
checksum = "d76ce4a75fb488c605c54bf610f221cea8b0dafb53333c1a67e8ee199dcd2ae3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"autocfg",
|
"autocfg",
|
||||||
"bytes 1.2.1",
|
"bytes 1.3.0",
|
||||||
"libc",
|
"libc",
|
||||||
"memchr",
|
"memchr",
|
||||||
"mio",
|
"mio",
|
||||||
|
@ -1989,7 +1989,7 @@ version = "0.7.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0bb2e075f03b3d66d8d8785356224ba688d2906a371015e225beeb65ca92c740"
|
checksum = "0bb2e075f03b3d66d8d8785356224ba688d2906a371015e225beeb65ca92c740"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytes 1.2.1",
|
"bytes 1.3.0",
|
||||||
"futures-core",
|
"futures-core",
|
||||||
"futures-sink",
|
"futures-sink",
|
||||||
"pin-project-lite",
|
"pin-project-lite",
|
||||||
|
|
|
@ -22,7 +22,7 @@ crossterm = { version = "0.25.0", features = ["event-stream"] }
|
||||||
eyre = "0.6.8"
|
eyre = "0.6.8"
|
||||||
futures = "0.3.24"
|
futures = "0.3.24"
|
||||||
glob = "0.3.0"
|
glob = "0.3.0"
|
||||||
nix = { version = "0.25.0", features = ["user", "fs", "process"], default-features = false }
|
nix = { version = "0.25.0", features = ["user", "fs", "process", "term"], default-features = false }
|
||||||
owo-colors = { version = "3.5.0", features = [ "supports-colors" ] }
|
owo-colors = { version = "3.5.0", features = [ "supports-colors" ] }
|
||||||
reqwest = { version = "0.11.11", default-features = false, features = ["rustls-tls", "stream"] }
|
reqwest = { version = "0.11.11", default-features = false, features = ["rustls-tls", "stream"] }
|
||||||
serde = { version = "1.0.144", features = ["derive"] }
|
serde = { version = "1.0.144", features = ["derive"] }
|
||||||
|
@ -32,7 +32,7 @@ tar = "0.4.38"
|
||||||
target-lexicon = "0.12.4"
|
target-lexicon = "0.12.4"
|
||||||
tempdir = { version = "0.3.7"}
|
tempdir = { version = "0.3.7"}
|
||||||
thiserror = "1.0.33"
|
thiserror = "1.0.33"
|
||||||
tokio = { version = "1.21.0", features = ["time", "io-std", "process", "fs", "signal", "tracing", "rt-multi-thread", "macros", "io-util", "parking_lot"] }
|
tokio = { version = "1.21.0", features = ["time", "io-std", "process", "fs", "signal", "tracing", "rt-multi-thread", "macros", "io-util", "parking_lot" ] }
|
||||||
tokio-util = { version = "0.7", features = ["io"] }
|
tokio-util = { version = "0.7", features = ["io"] }
|
||||||
tracing = { version = "0.1.36", features = [ "valuable" ] }
|
tracing = { version = "0.1.36", features = [ "valuable" ] }
|
||||||
tracing-error = "0.2.0"
|
tracing-error = "0.2.0"
|
||||||
|
|
|
@ -128,7 +128,7 @@
|
||||||
]);
|
]);
|
||||||
|
|
||||||
doCheck = true;
|
doCheck = true;
|
||||||
RUSTFLAGS = "--cfg tracing_unstable";
|
RUSTFLAGS = "--cfg tracing_unstable --cfg tokio_unstable";
|
||||||
|
|
||||||
override = { preBuild ? "", ... }: {
|
override = { preBuild ? "", ... }: {
|
||||||
preBuild = preBuild + ''
|
preBuild = preBuild + ''
|
||||||
|
|
|
@ -65,12 +65,7 @@ impl Action for ConfigureNixDaemonService {
|
||||||
|
|
||||||
#[tracing::instrument(skip_all)]
|
#[tracing::instrument(skip_all)]
|
||||||
async fn execute(&mut self) -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
|
async fn execute(&mut self) -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
|
||||||
let Self { action_state } = self;
|
let Self { action_state: _ } = self;
|
||||||
if *action_state == ActionState::Completed {
|
|
||||||
tracing::trace!("Already completed: Configuring nix daemon service");
|
|
||||||
return Ok(());
|
|
||||||
}
|
|
||||||
tracing::debug!("Configuring nix daemon service");
|
|
||||||
|
|
||||||
match OperatingSystem::host() {
|
match OperatingSystem::host() {
|
||||||
OperatingSystem::MacOSX {
|
OperatingSystem::MacOSX {
|
||||||
|
@ -93,6 +88,7 @@ impl Action for ConfigureNixDaemonService {
|
||||||
|
|
||||||
execute_command(
|
execute_command(
|
||||||
Command::new("launchctl")
|
Command::new("launchctl")
|
||||||
|
.process_group(0)
|
||||||
.arg("load")
|
.arg("load")
|
||||||
.arg(DARWIN_NIX_DAEMON_DEST)
|
.arg(DARWIN_NIX_DAEMON_DEST)
|
||||||
.stdin(std::process::Stdio::null()),
|
.stdin(std::process::Stdio::null()),
|
||||||
|
@ -115,6 +111,7 @@ impl Action for ConfigureNixDaemonService {
|
||||||
|
|
||||||
execute_command(
|
execute_command(
|
||||||
Command::new("systemd-tmpfiles")
|
Command::new("systemd-tmpfiles")
|
||||||
|
.process_group(0)
|
||||||
.arg("--create")
|
.arg("--create")
|
||||||
.arg("--prefix=/nix/var/nix")
|
.arg("--prefix=/nix/var/nix")
|
||||||
.stdin(std::process::Stdio::null()),
|
.stdin(std::process::Stdio::null()),
|
||||||
|
@ -124,6 +121,7 @@ impl Action for ConfigureNixDaemonService {
|
||||||
|
|
||||||
execute_command(
|
execute_command(
|
||||||
Command::new("systemctl")
|
Command::new("systemctl")
|
||||||
|
.process_group(0)
|
||||||
.arg("link")
|
.arg("link")
|
||||||
.arg(SERVICE_SRC)
|
.arg(SERVICE_SRC)
|
||||||
.stdin(std::process::Stdio::null()),
|
.stdin(std::process::Stdio::null()),
|
||||||
|
@ -133,6 +131,7 @@ impl Action for ConfigureNixDaemonService {
|
||||||
|
|
||||||
execute_command(
|
execute_command(
|
||||||
Command::new("systemctl")
|
Command::new("systemctl")
|
||||||
|
.process_group(0)
|
||||||
.arg("link")
|
.arg("link")
|
||||||
.arg(SOCKET_SRC)
|
.arg(SOCKET_SRC)
|
||||||
.stdin(std::process::Stdio::null()),
|
.stdin(std::process::Stdio::null()),
|
||||||
|
@ -142,6 +141,7 @@ impl Action for ConfigureNixDaemonService {
|
||||||
|
|
||||||
execute_command(
|
execute_command(
|
||||||
Command::new("systemctl")
|
Command::new("systemctl")
|
||||||
|
.process_group(0)
|
||||||
.arg("daemon-reload")
|
.arg("daemon-reload")
|
||||||
.stdin(std::process::Stdio::null()),
|
.stdin(std::process::Stdio::null()),
|
||||||
)
|
)
|
||||||
|
@ -150,6 +150,7 @@ impl Action for ConfigureNixDaemonService {
|
||||||
|
|
||||||
execute_command(
|
execute_command(
|
||||||
Command::new("systemctl")
|
Command::new("systemctl")
|
||||||
|
.process_group(0)
|
||||||
.arg("enable")
|
.arg("enable")
|
||||||
.arg("--now")
|
.arg("--now")
|
||||||
.arg("nix-daemon.socket")
|
.arg("nix-daemon.socket")
|
||||||
|
@ -160,8 +161,6 @@ impl Action for ConfigureNixDaemonService {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
tracing::trace!("Configured nix daemon service");
|
|
||||||
*action_state = ActionState::Completed;
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -188,6 +187,7 @@ impl Action for ConfigureNixDaemonService {
|
||||||
| OperatingSystem::Darwin => {
|
| OperatingSystem::Darwin => {
|
||||||
execute_command(
|
execute_command(
|
||||||
Command::new("launchctl")
|
Command::new("launchctl")
|
||||||
|
.process_group(0)
|
||||||
.arg("unload")
|
.arg("unload")
|
||||||
.arg(DARWIN_NIX_DAEMON_DEST),
|
.arg(DARWIN_NIX_DAEMON_DEST),
|
||||||
)
|
)
|
||||||
|
@ -205,6 +205,7 @@ impl Action for ConfigureNixDaemonService {
|
||||||
if socket_is_active {
|
if socket_is_active {
|
||||||
execute_command(
|
execute_command(
|
||||||
Command::new("systemctl")
|
Command::new("systemctl")
|
||||||
|
.process_group(0)
|
||||||
.args(["stop", "nix-daemon.socket"])
|
.args(["stop", "nix-daemon.socket"])
|
||||||
.stdin(std::process::Stdio::null()),
|
.stdin(std::process::Stdio::null()),
|
||||||
)
|
)
|
||||||
|
@ -215,6 +216,7 @@ impl Action for ConfigureNixDaemonService {
|
||||||
if socket_is_enabled {
|
if socket_is_enabled {
|
||||||
execute_command(
|
execute_command(
|
||||||
Command::new("systemctl")
|
Command::new("systemctl")
|
||||||
|
.process_group(0)
|
||||||
.args(["disable", "nix-daemon.socket"])
|
.args(["disable", "nix-daemon.socket"])
|
||||||
.stdin(std::process::Stdio::null()),
|
.stdin(std::process::Stdio::null()),
|
||||||
)
|
)
|
||||||
|
@ -225,6 +227,7 @@ impl Action for ConfigureNixDaemonService {
|
||||||
if service_is_active {
|
if service_is_active {
|
||||||
execute_command(
|
execute_command(
|
||||||
Command::new("systemctl")
|
Command::new("systemctl")
|
||||||
|
.process_group(0)
|
||||||
.args(["stop", "nix-daemon.service"])
|
.args(["stop", "nix-daemon.service"])
|
||||||
.stdin(std::process::Stdio::null()),
|
.stdin(std::process::Stdio::null()),
|
||||||
)
|
)
|
||||||
|
@ -235,6 +238,7 @@ impl Action for ConfigureNixDaemonService {
|
||||||
if service_is_enabled {
|
if service_is_enabled {
|
||||||
execute_command(
|
execute_command(
|
||||||
Command::new("systemctl")
|
Command::new("systemctl")
|
||||||
|
.process_group(0)
|
||||||
.args(["disable", "nix-daemon.service"])
|
.args(["disable", "nix-daemon.service"])
|
||||||
.stdin(std::process::Stdio::null()),
|
.stdin(std::process::Stdio::null()),
|
||||||
)
|
)
|
||||||
|
@ -244,6 +248,7 @@ impl Action for ConfigureNixDaemonService {
|
||||||
|
|
||||||
execute_command(
|
execute_command(
|
||||||
Command::new("systemd-tmpfiles")
|
Command::new("systemd-tmpfiles")
|
||||||
|
.process_group(0)
|
||||||
.arg("--remove")
|
.arg("--remove")
|
||||||
.arg("--prefix=/nix/var/nix")
|
.arg("--prefix=/nix/var/nix")
|
||||||
.stdin(std::process::Stdio::null()),
|
.stdin(std::process::Stdio::null()),
|
||||||
|
@ -258,6 +263,7 @@ impl Action for ConfigureNixDaemonService {
|
||||||
|
|
||||||
execute_command(
|
execute_command(
|
||||||
Command::new("systemctl")
|
Command::new("systemctl")
|
||||||
|
.process_group(0)
|
||||||
.arg("daemon-reload")
|
.arg("daemon-reload")
|
||||||
.stdin(std::process::Stdio::null()),
|
.stdin(std::process::Stdio::null()),
|
||||||
)
|
)
|
||||||
|
|
|
@ -53,13 +53,8 @@ impl Action for CreateGroup {
|
||||||
let Self {
|
let Self {
|
||||||
name,
|
name,
|
||||||
gid,
|
gid,
|
||||||
action_state,
|
action_state: _,
|
||||||
} = self;
|
} = self;
|
||||||
if *action_state == ActionState::Completed {
|
|
||||||
tracing::trace!("Already completed: Creating group");
|
|
||||||
return Ok(());
|
|
||||||
}
|
|
||||||
tracing::debug!("Creating group");
|
|
||||||
|
|
||||||
use target_lexicon::OperatingSystem;
|
use target_lexicon::OperatingSystem;
|
||||||
match target_lexicon::OperatingSystem::host() {
|
match target_lexicon::OperatingSystem::host() {
|
||||||
|
@ -70,6 +65,7 @@ impl Action for CreateGroup {
|
||||||
}
|
}
|
||||||
| OperatingSystem::Darwin => {
|
| OperatingSystem::Darwin => {
|
||||||
if Command::new("/usr/bin/dscl")
|
if Command::new("/usr/bin/dscl")
|
||||||
|
.process_group(0)
|
||||||
.args([".", "-read", &format!("/Groups/{name}")])
|
.args([".", "-read", &format!("/Groups/{name}")])
|
||||||
.stdin(std::process::Stdio::null())
|
.stdin(std::process::Stdio::null())
|
||||||
.stdout(std::process::Stdio::null())
|
.stdout(std::process::Stdio::null())
|
||||||
|
@ -81,6 +77,7 @@ impl Action for CreateGroup {
|
||||||
} else {
|
} else {
|
||||||
execute_command(
|
execute_command(
|
||||||
Command::new("/usr/sbin/dseditgroup")
|
Command::new("/usr/sbin/dseditgroup")
|
||||||
|
.process_group(0)
|
||||||
.args([
|
.args([
|
||||||
"-o",
|
"-o",
|
||||||
"create",
|
"create",
|
||||||
|
@ -99,6 +96,7 @@ impl Action for CreateGroup {
|
||||||
_ => {
|
_ => {
|
||||||
execute_command(
|
execute_command(
|
||||||
Command::new("groupadd")
|
Command::new("groupadd")
|
||||||
|
.process_group(0)
|
||||||
.args(["-g", &gid.to_string(), "--system", &name])
|
.args(["-g", &gid.to_string(), "--system", &name])
|
||||||
.stdin(std::process::Stdio::null()),
|
.stdin(std::process::Stdio::null()),
|
||||||
)
|
)
|
||||||
|
@ -107,8 +105,6 @@ impl Action for CreateGroup {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
tracing::trace!("Created group");
|
|
||||||
*action_state = ActionState::Completed;
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -159,6 +155,7 @@ impl Action for CreateGroup {
|
||||||
_ => {
|
_ => {
|
||||||
execute_command(
|
execute_command(
|
||||||
Command::new("groupdel")
|
Command::new("groupdel")
|
||||||
|
.process_group(0)
|
||||||
.arg(&name)
|
.arg(&name)
|
||||||
.stdin(std::process::Stdio::null()),
|
.stdin(std::process::Stdio::null()),
|
||||||
)
|
)
|
||||||
|
|
|
@ -74,6 +74,7 @@ impl Action for CreateUser {
|
||||||
// Right now, our test machines do not have a secure token and cannot delete users.
|
// Right now, our test machines do not have a secure token and cannot delete users.
|
||||||
|
|
||||||
if Command::new("/usr/bin/dscl")
|
if Command::new("/usr/bin/dscl")
|
||||||
|
.process_group(0)
|
||||||
.args([".", "-read", &format!("/Users/{name}")])
|
.args([".", "-read", &format!("/Users/{name}")])
|
||||||
.stdin(std::process::Stdio::null())
|
.stdin(std::process::Stdio::null())
|
||||||
.stdout(std::process::Stdio::null())
|
.stdout(std::process::Stdio::null())
|
||||||
|
@ -85,6 +86,7 @@ impl Action for CreateUser {
|
||||||
} else {
|
} else {
|
||||||
execute_command(
|
execute_command(
|
||||||
Command::new("/usr/bin/dscl")
|
Command::new("/usr/bin/dscl")
|
||||||
|
.process_group(0)
|
||||||
.args([".", "-create", &format!("/Users/{name}")])
|
.args([".", "-create", &format!("/Users/{name}")])
|
||||||
.stdin(std::process::Stdio::null()),
|
.stdin(std::process::Stdio::null()),
|
||||||
)
|
)
|
||||||
|
@ -92,6 +94,7 @@ impl Action for CreateUser {
|
||||||
.map_err(|e| CreateUserError::Command(e).boxed())?;
|
.map_err(|e| CreateUserError::Command(e).boxed())?;
|
||||||
execute_command(
|
execute_command(
|
||||||
Command::new("/usr/bin/dscl")
|
Command::new("/usr/bin/dscl")
|
||||||
|
.process_group(0)
|
||||||
.args([
|
.args([
|
||||||
".",
|
".",
|
||||||
"-create",
|
"-create",
|
||||||
|
@ -105,6 +108,7 @@ impl Action for CreateUser {
|
||||||
.map_err(|e| CreateUserError::Command(e).boxed())?;
|
.map_err(|e| CreateUserError::Command(e).boxed())?;
|
||||||
execute_command(
|
execute_command(
|
||||||
Command::new("/usr/bin/dscl")
|
Command::new("/usr/bin/dscl")
|
||||||
|
.process_group(0)
|
||||||
.args([
|
.args([
|
||||||
".",
|
".",
|
||||||
"-create",
|
"-create",
|
||||||
|
@ -118,6 +122,7 @@ impl Action for CreateUser {
|
||||||
.map_err(|e| CreateUserError::Command(e).boxed())?;
|
.map_err(|e| CreateUserError::Command(e).boxed())?;
|
||||||
execute_command(
|
execute_command(
|
||||||
Command::new("/usr/bin/dscl")
|
Command::new("/usr/bin/dscl")
|
||||||
|
.process_group(0)
|
||||||
.args([
|
.args([
|
||||||
".",
|
".",
|
||||||
"-create",
|
"-create",
|
||||||
|
@ -131,6 +136,7 @@ impl Action for CreateUser {
|
||||||
.map_err(|e| CreateUserError::Command(e).boxed())?;
|
.map_err(|e| CreateUserError::Command(e).boxed())?;
|
||||||
execute_command(
|
execute_command(
|
||||||
Command::new("/usr/bin/dscl")
|
Command::new("/usr/bin/dscl")
|
||||||
|
.process_group(0)
|
||||||
.args([
|
.args([
|
||||||
".",
|
".",
|
||||||
"-create",
|
"-create",
|
||||||
|
@ -144,6 +150,7 @@ impl Action for CreateUser {
|
||||||
.map_err(|e| CreateUserError::Command(e).boxed())?;
|
.map_err(|e| CreateUserError::Command(e).boxed())?;
|
||||||
execute_command(
|
execute_command(
|
||||||
Command::new("/usr/bin/dscl")
|
Command::new("/usr/bin/dscl")
|
||||||
|
.process_group(0)
|
||||||
.args([
|
.args([
|
||||||
".",
|
".",
|
||||||
"-append",
|
"-append",
|
||||||
|
@ -157,6 +164,7 @@ impl Action for CreateUser {
|
||||||
.map_err(|e| CreateUserError::Command(e).boxed())?;
|
.map_err(|e| CreateUserError::Command(e).boxed())?;
|
||||||
execute_command(
|
execute_command(
|
||||||
Command::new("/usr/bin/dscl")
|
Command::new("/usr/bin/dscl")
|
||||||
|
.process_group(0)
|
||||||
.args([".", "-create", &format!("/Users/{name}"), "IsHidden", "1"])
|
.args([".", "-create", &format!("/Users/{name}"), "IsHidden", "1"])
|
||||||
.stdin(std::process::Stdio::null()),
|
.stdin(std::process::Stdio::null()),
|
||||||
)
|
)
|
||||||
|
@ -164,6 +172,7 @@ impl Action for CreateUser {
|
||||||
.map_err(|e| CreateUserError::Command(e).boxed())?;
|
.map_err(|e| CreateUserError::Command(e).boxed())?;
|
||||||
execute_command(
|
execute_command(
|
||||||
Command::new("/usr/sbin/dseditgroup")
|
Command::new("/usr/sbin/dseditgroup")
|
||||||
|
.process_group(0)
|
||||||
.args(["-o", "edit"])
|
.args(["-o", "edit"])
|
||||||
.arg("-a")
|
.arg("-a")
|
||||||
.arg(&name)
|
.arg(&name)
|
||||||
|
@ -179,6 +188,7 @@ impl Action for CreateUser {
|
||||||
_ => {
|
_ => {
|
||||||
execute_command(
|
execute_command(
|
||||||
Command::new("useradd")
|
Command::new("useradd")
|
||||||
|
.process_group(0)
|
||||||
.args([
|
.args([
|
||||||
"--home-dir",
|
"--home-dir",
|
||||||
"/var/empty",
|
"/var/empty",
|
||||||
|
@ -261,6 +271,7 @@ impl Action for CreateUser {
|
||||||
_ => {
|
_ => {
|
||||||
execute_command(
|
execute_command(
|
||||||
Command::new("userdel")
|
Command::new("userdel")
|
||||||
|
.process_group(0)
|
||||||
.args([&name.to_string()])
|
.args([&name.to_string()])
|
||||||
.stdin(std::process::Stdio::null()),
|
.stdin(std::process::Stdio::null()),
|
||||||
)
|
)
|
||||||
|
|
|
@ -87,6 +87,7 @@ impl Action for SetupDefaultProfile {
|
||||||
// Install `nix` itself into the store
|
// Install `nix` itself into the store
|
||||||
execute_command(
|
execute_command(
|
||||||
Command::new(nix_pkg.join("bin/nix-env"))
|
Command::new(nix_pkg.join("bin/nix-env"))
|
||||||
|
.process_group(0)
|
||||||
.arg("-i")
|
.arg("-i")
|
||||||
.arg(&nix_pkg)
|
.arg(&nix_pkg)
|
||||||
.arg("-i")
|
.arg("-i")
|
||||||
|
@ -124,6 +125,7 @@ impl Action for SetupDefaultProfile {
|
||||||
|
|
||||||
if !channels.is_empty() {
|
if !channels.is_empty() {
|
||||||
let mut command = Command::new(nix_pkg.join("bin/nix-channel"));
|
let mut command = Command::new(nix_pkg.join("bin/nix-channel"));
|
||||||
|
command.process_group(0);
|
||||||
command.arg("--update");
|
command.arg("--update");
|
||||||
for channel in channels {
|
for channel in channels {
|
||||||
command.arg(channel);
|
command.arg(channel);
|
||||||
|
|
|
@ -49,6 +49,7 @@ impl Action for BootstrapVolume {
|
||||||
|
|
||||||
execute_command(
|
execute_command(
|
||||||
Command::new("launchctl")
|
Command::new("launchctl")
|
||||||
|
.process_group(0)
|
||||||
.args(["bootstrap", "system"])
|
.args(["bootstrap", "system"])
|
||||||
.arg(path)
|
.arg(path)
|
||||||
.stdin(std::process::Stdio::null()),
|
.stdin(std::process::Stdio::null()),
|
||||||
|
@ -57,6 +58,7 @@ impl Action for BootstrapVolume {
|
||||||
.map_err(|e| BootstrapVolumeError::Command(e).boxed())?;
|
.map_err(|e| BootstrapVolumeError::Command(e).boxed())?;
|
||||||
execute_command(
|
execute_command(
|
||||||
Command::new("launchctl")
|
Command::new("launchctl")
|
||||||
|
.process_group(0)
|
||||||
.args(["kickstart", "-k", "system/org.nixos.darwin-store"])
|
.args(["kickstart", "-k", "system/org.nixos.darwin-store"])
|
||||||
.stdin(std::process::Stdio::null()),
|
.stdin(std::process::Stdio::null()),
|
||||||
)
|
)
|
||||||
|
@ -84,6 +86,7 @@ impl Action for BootstrapVolume {
|
||||||
|
|
||||||
execute_command(
|
execute_command(
|
||||||
Command::new("launchctl")
|
Command::new("launchctl")
|
||||||
|
.process_group(0)
|
||||||
.args(["bootout", "system"])
|
.args(["bootout", "system"])
|
||||||
.arg(path)
|
.arg(path)
|
||||||
.stdin(std::process::Stdio::null()),
|
.stdin(std::process::Stdio::null()),
|
||||||
|
|
|
@ -37,6 +37,7 @@ impl Action for CreateSyntheticObjects {
|
||||||
// Yup we literally call both and ignore the error! Reasoning: https://github.com/NixOS/nix/blob/95331cb9c99151cbd790ceb6ddaf49fc1c0da4b3/scripts/create-darwin-volume.sh#L261
|
// Yup we literally call both and ignore the error! Reasoning: https://github.com/NixOS/nix/blob/95331cb9c99151cbd790ceb6ddaf49fc1c0da4b3/scripts/create-darwin-volume.sh#L261
|
||||||
execute_command(
|
execute_command(
|
||||||
Command::new("/System/Library/Filesystems/apfs.fs/Contents/Resources/apfs.util")
|
Command::new("/System/Library/Filesystems/apfs.fs/Contents/Resources/apfs.util")
|
||||||
|
.process_group(0)
|
||||||
.arg("-t")
|
.arg("-t")
|
||||||
.stdin(std::process::Stdio::null()),
|
.stdin(std::process::Stdio::null()),
|
||||||
)
|
)
|
||||||
|
@ -44,6 +45,7 @@ impl Action for CreateSyntheticObjects {
|
||||||
.ok(); // Deliberate
|
.ok(); // Deliberate
|
||||||
execute_command(
|
execute_command(
|
||||||
Command::new("/System/Library/Filesystems/apfs.fs/Contents/Resources/apfs.util")
|
Command::new("/System/Library/Filesystems/apfs.fs/Contents/Resources/apfs.util")
|
||||||
|
.process_group(0)
|
||||||
.arg("-B")
|
.arg("-B")
|
||||||
.stdin(std::process::Stdio::null()),
|
.stdin(std::process::Stdio::null()),
|
||||||
)
|
)
|
||||||
|
@ -65,6 +67,7 @@ impl Action for CreateSyntheticObjects {
|
||||||
// Yup we literally call both and ignore the error! Reasoning: https://github.com/NixOS/nix/blob/95331cb9c99151cbd790ceb6ddaf49fc1c0da4b3/scripts/create-darwin-volume.sh#L261
|
// Yup we literally call both and ignore the error! Reasoning: https://github.com/NixOS/nix/blob/95331cb9c99151cbd790ceb6ddaf49fc1c0da4b3/scripts/create-darwin-volume.sh#L261
|
||||||
execute_command(
|
execute_command(
|
||||||
Command::new("/System/Library/Filesystems/apfs.fs/Contents/Resources/apfs.util")
|
Command::new("/System/Library/Filesystems/apfs.fs/Contents/Resources/apfs.util")
|
||||||
|
.process_group(0)
|
||||||
.arg("-t")
|
.arg("-t")
|
||||||
.stdin(std::process::Stdio::null()),
|
.stdin(std::process::Stdio::null()),
|
||||||
)
|
)
|
||||||
|
@ -72,6 +75,7 @@ impl Action for CreateSyntheticObjects {
|
||||||
.ok(); // Deliberate
|
.ok(); // Deliberate
|
||||||
execute_command(
|
execute_command(
|
||||||
Command::new("/System/Library/Filesystems/apfs.fs/Contents/Resources/apfs.util")
|
Command::new("/System/Library/Filesystems/apfs.fs/Contents/Resources/apfs.util")
|
||||||
|
.process_group(0)
|
||||||
.arg("-B")
|
.arg("-B")
|
||||||
.stdin(std::process::Stdio::null()),
|
.stdin(std::process::Stdio::null()),
|
||||||
)
|
)
|
||||||
|
|
|
@ -63,6 +63,7 @@ impl Action for CreateVolume {
|
||||||
|
|
||||||
execute_command(
|
execute_command(
|
||||||
Command::new("/usr/sbin/diskutil")
|
Command::new("/usr/sbin/diskutil")
|
||||||
|
.process_group(0)
|
||||||
.args([
|
.args([
|
||||||
"apfs",
|
"apfs",
|
||||||
"addVolume",
|
"addVolume",
|
||||||
|
@ -109,6 +110,7 @@ impl Action for CreateVolume {
|
||||||
|
|
||||||
execute_command(
|
execute_command(
|
||||||
Command::new("/usr/sbin/diskutil")
|
Command::new("/usr/sbin/diskutil")
|
||||||
|
.process_group(0)
|
||||||
.args(["apfs", "deleteVolume", name])
|
.args(["apfs", "deleteVolume", name])
|
||||||
.stdin(std::process::Stdio::null()),
|
.stdin(std::process::Stdio::null()),
|
||||||
)
|
)
|
||||||
|
|
|
@ -52,6 +52,7 @@ impl Action for EnableOwnership {
|
||||||
let should_enable_ownership = {
|
let should_enable_ownership = {
|
||||||
let buf = execute_command(
|
let buf = execute_command(
|
||||||
Command::new("/usr/sbin/diskutil")
|
Command::new("/usr/sbin/diskutil")
|
||||||
|
.process_group(0)
|
||||||
.args(["info", "-plist"])
|
.args(["info", "-plist"])
|
||||||
.arg(&path)
|
.arg(&path)
|
||||||
.stdin(std::process::Stdio::null()),
|
.stdin(std::process::Stdio::null()),
|
||||||
|
@ -66,6 +67,7 @@ impl Action for EnableOwnership {
|
||||||
if should_enable_ownership {
|
if should_enable_ownership {
|
||||||
execute_command(
|
execute_command(
|
||||||
Command::new("/usr/sbin/diskutil")
|
Command::new("/usr/sbin/diskutil")
|
||||||
|
.process_group(0)
|
||||||
.arg("enableOwnership")
|
.arg("enableOwnership")
|
||||||
.arg(path)
|
.arg(path)
|
||||||
.stdin(std::process::Stdio::null()),
|
.stdin(std::process::Stdio::null()),
|
||||||
|
|
|
@ -75,7 +75,7 @@ impl Action for EncryptVolume {
|
||||||
|
|
||||||
// Add the password to the user keychain so they can unlock it later.
|
// Add the password to the user keychain so they can unlock it later.
|
||||||
execute_command(
|
execute_command(
|
||||||
Command::new("/usr/bin/security").args([
|
Command::new("/usr/bin/security").process_group(0).args([
|
||||||
"add-generic-password",
|
"add-generic-password",
|
||||||
"-a",
|
"-a",
|
||||||
name.as_str(),
|
name.as_str(),
|
||||||
|
@ -104,7 +104,7 @@ impl Action for EncryptVolume {
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
// Encrypt the mounted volume
|
// Encrypt the mounted volume
|
||||||
execute_command(Command::new("/usr/sbin/diskutil").args([
|
execute_command(Command::new("/usr/sbin/diskutil").process_group(0).args([
|
||||||
"apfs",
|
"apfs",
|
||||||
"encryptVolume",
|
"encryptVolume",
|
||||||
name.as_str(),
|
name.as_str(),
|
||||||
|
@ -117,6 +117,7 @@ impl Action for EncryptVolume {
|
||||||
|
|
||||||
execute_command(
|
execute_command(
|
||||||
Command::new("/usr/sbin/diskutil")
|
Command::new("/usr/sbin/diskutil")
|
||||||
|
.process_group(0)
|
||||||
.arg("unmount")
|
.arg("unmount")
|
||||||
.arg("force")
|
.arg("force")
|
||||||
.arg(&name),
|
.arg(&name),
|
||||||
|
@ -150,7 +151,7 @@ impl Action for EncryptVolume {
|
||||||
|
|
||||||
// TODO: This seems very rough and unsafe
|
// TODO: This seems very rough and unsafe
|
||||||
execute_command(
|
execute_command(
|
||||||
Command::new("/usr/bin/security").args([
|
Command::new("/usr/bin/security").process_group(0).args([
|
||||||
"delete-generic-password",
|
"delete-generic-password",
|
||||||
"-a",
|
"-a",
|
||||||
name.as_str(),
|
name.as_str(),
|
||||||
|
|
|
@ -46,6 +46,7 @@ impl Action for KickstartLaunchctlService {
|
||||||
|
|
||||||
execute_command(
|
execute_command(
|
||||||
Command::new("launchctl")
|
Command::new("launchctl")
|
||||||
|
.process_group(0)
|
||||||
.arg("kickstart")
|
.arg("kickstart")
|
||||||
.arg("-k")
|
.arg("-k")
|
||||||
.arg(unit)
|
.arg(unit)
|
||||||
|
|
|
@ -55,6 +55,7 @@ impl Action for UnmountVolume {
|
||||||
|
|
||||||
execute_command(
|
execute_command(
|
||||||
Command::new("/usr/sbin/diskutil")
|
Command::new("/usr/sbin/diskutil")
|
||||||
|
.process_group(0)
|
||||||
.args(["unmount", "force"])
|
.args(["unmount", "force"])
|
||||||
.arg(name)
|
.arg(name)
|
||||||
.stdin(std::process::Stdio::null()),
|
.stdin(std::process::Stdio::null()),
|
||||||
|
@ -82,6 +83,7 @@ impl Action for UnmountVolume {
|
||||||
|
|
||||||
execute_command(
|
execute_command(
|
||||||
Command::new("/usr/sbin/diskutil")
|
Command::new("/usr/sbin/diskutil")
|
||||||
|
.process_group(0)
|
||||||
.args(["unmount", "force"])
|
.args(["unmount", "force"])
|
||||||
.arg(name)
|
.arg(name)
|
||||||
.stdin(std::process::Stdio::null()),
|
.stdin(std::process::Stdio::null()),
|
||||||
|
|
|
@ -43,6 +43,7 @@ impl Action for StartSystemdUnit {
|
||||||
// TODO(@Hoverbear): Handle proxy vars
|
// TODO(@Hoverbear): Handle proxy vars
|
||||||
execute_command(
|
execute_command(
|
||||||
Command::new("systemctl")
|
Command::new("systemctl")
|
||||||
|
.process_group(0)
|
||||||
.arg("enable")
|
.arg("enable")
|
||||||
.arg("--now")
|
.arg("--now")
|
||||||
.arg(format!("{unit}"))
|
.arg(format!("{unit}"))
|
||||||
|
@ -67,9 +68,9 @@ impl Action for StartSystemdUnit {
|
||||||
async fn revert(&mut self) -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
|
async fn revert(&mut self) -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
|
||||||
let Self { unit, .. } = self;
|
let Self { unit, .. } = self;
|
||||||
|
|
||||||
// TODO(@Hoverbear): Handle proxy vars
|
|
||||||
execute_command(
|
execute_command(
|
||||||
Command::new("systemctl")
|
Command::new("systemctl")
|
||||||
|
.process_group(0)
|
||||||
.arg("disable")
|
.arg("disable")
|
||||||
.arg(format!("{unit}"))
|
.arg(format!("{unit}"))
|
||||||
.stdin(std::process::Stdio::null()),
|
.stdin(std::process::Stdio::null()),
|
||||||
|
@ -80,6 +81,7 @@ impl Action for StartSystemdUnit {
|
||||||
// We do both to avoid an error doing `disable --now` if the user did stop it already somehow.
|
// We do both to avoid an error doing `disable --now` if the user did stop it already somehow.
|
||||||
execute_command(
|
execute_command(
|
||||||
Command::new("systemctl")
|
Command::new("systemctl")
|
||||||
|
.process_group(0)
|
||||||
.arg("stop")
|
.arg("stop")
|
||||||
.arg(format!("{unit}"))
|
.arg(format!("{unit}"))
|
||||||
.stdin(std::process::Stdio::null()),
|
.stdin(std::process::Stdio::null()),
|
||||||
|
|
|
@ -44,6 +44,7 @@ impl Action for SystemdSysextMerge {
|
||||||
|
|
||||||
execute_command(
|
execute_command(
|
||||||
Command::new("systemd-sysext")
|
Command::new("systemd-sysext")
|
||||||
|
.process_group(0)
|
||||||
.arg("merge")
|
.arg("merge")
|
||||||
.arg(device)
|
.arg(device)
|
||||||
.stdin(std::process::Stdio::null()),
|
.stdin(std::process::Stdio::null()),
|
||||||
|
@ -75,6 +76,7 @@ impl Action for SystemdSysextMerge {
|
||||||
// TODO(@Hoverbear): Handle proxy vars
|
// TODO(@Hoverbear): Handle proxy vars
|
||||||
execute_command(
|
execute_command(
|
||||||
Command::new("systemd-sysext")
|
Command::new("systemd-sysext")
|
||||||
|
.process_group(0)
|
||||||
.arg("unmerge")
|
.arg("unmerge")
|
||||||
.arg(device)
|
.arg(device)
|
||||||
.stdin(std::process::Stdio::null()),
|
.stdin(std::process::Stdio::null()),
|
||||||
|
|
|
@ -23,8 +23,6 @@ use tokio::process::Command;
|
||||||
|
|
||||||
#[tracing::instrument(skip_all, fields(command = %format!("{:?}", command.as_std())))]
|
#[tracing::instrument(skip_all, fields(command = %format!("{:?}", command.as_std())))]
|
||||||
async fn execute_command(command: &mut Command) -> Result<Output, std::io::Error> {
|
async fn execute_command(command: &mut Command) -> Result<Output, std::io::Error> {
|
||||||
// TODO(@hoverbear): When tokio releases past 1.21.2, add a process group https://github.com/DeterminateSystems/harmonic/issues/41#issuecomment-1309513073
|
|
||||||
|
|
||||||
let command_str = format!("{:?}", command.as_std());
|
let command_str = format!("{:?}", command.as_std());
|
||||||
tracing::trace!("Executing `{command_str}`");
|
tracing::trace!("Executing `{command_str}`");
|
||||||
let output = command.output().await?;
|
let output = command.output().await?;
|
||||||
|
|
Loading…
Reference in a new issue