Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1e648800ad | ||
|
|
8a2cabdba9 |
Generated
+1
-1
@@ -80,7 +80,7 @@ checksum = "a23eb6b1614318a8071c9b2521f36b424b2c83db5eb3a0fead4a6c0809af6e61"
|
||||
|
||||
[[package]]
|
||||
name = "archipelago"
|
||||
version = "1.7.6-alpha"
|
||||
version = "1.7.8-alpha"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"archipelago-container",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "archipelago"
|
||||
version = "1.7.6-alpha"
|
||||
version = "1.7.8-alpha"
|
||||
edition = "2021"
|
||||
description = "Archipelago Bitcoin Node OS - Native backend"
|
||||
authors = ["Archipelago Team"]
|
||||
|
||||
@@ -277,27 +277,31 @@ pub async fn apply_update(data_dir: &Path) -> Result<()> {
|
||||
|
||||
match name.as_str() {
|
||||
"archipelago" => {
|
||||
// /usr/local/bin is root-owned; archipelago user can't
|
||||
// fs::copy into it directly. Use sudo install which handles
|
||||
// the copy, mode, and ownership atomically.
|
||||
// We're running FROM /usr/local/bin/archipelago right now,
|
||||
// so we can't rewrite it in place — `install` / `cp` would
|
||||
// hit ETXTBSY on the busy executable. Use `mv` instead:
|
||||
// rename() is atomic and doesn't modify the existing file,
|
||||
// it just re-points the path at a new inode. The currently
|
||||
// running process keeps executing off the old inode; new
|
||||
// invocations (i.e. after the post-apply systemctl
|
||||
// restart) pick up the new binary.
|
||||
let staged = src.to_string_lossy().to_string();
|
||||
let _ = tokio::process::Command::new("sudo")
|
||||
.args(["chmod", "0755", &staged])
|
||||
.status()
|
||||
.await;
|
||||
let _ = tokio::process::Command::new("sudo")
|
||||
.args(["chown", "root:root", &staged])
|
||||
.status()
|
||||
.await;
|
||||
let status = tokio::process::Command::new("sudo")
|
||||
.args([
|
||||
"install",
|
||||
"-m",
|
||||
"0755",
|
||||
"-o",
|
||||
"root",
|
||||
"-g",
|
||||
"root",
|
||||
&src.to_string_lossy(),
|
||||
"/usr/local/bin/archipelago",
|
||||
])
|
||||
.args(["mv", &staged, "/usr/local/bin/archipelago"])
|
||||
.status()
|
||||
.await
|
||||
.with_context(|| format!("Failed to spawn install for {}", name))?;
|
||||
.with_context(|| format!("Failed to spawn mv for {}", name))?;
|
||||
if !status.success() {
|
||||
anyhow::bail!(
|
||||
"sudo install failed for {} (exit {:?})",
|
||||
"sudo mv failed for {} (exit {:?})",
|
||||
name,
|
||||
status.code()
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user