adds recovery (#731)

* should work

* works for real

* fix build
This commit is contained in:
Aiden McClelland
2021-10-27 15:50:53 -06:00
parent d0e8211b24
commit 1e7492e915
27 changed files with 694 additions and 598 deletions

View File

@@ -887,7 +887,6 @@ dependencies = [
"rpc-toolkit",
"rust-argon2",
"scopeguard",
"sequence_trie",
"serde",
"serde_json",
"serde_with",
@@ -2814,12 +2813,6 @@ dependencies = [
"pest",
]
[[package]]
name = "sequence_trie"
version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1ee22067b7ccd072eeb64454b9c6e1b33b61cd0d49e895fd48676a184580e0c3"
[[package]]
name = "serde"
version = "1.0.130"

View File

@@ -1,5 +1,7 @@
use std::{path::Path, process::Stdio};
use embassy::disk::main::DEFAULT_PASSWORD;
pub fn create_backup(
mountpoint: impl AsRef<Path>,
data_path: impl AsRef<Path>,
@@ -30,11 +32,18 @@ pub fn create_backup(
));
}
}
let data_res = data_cmd
let data_output = data_cmd
.env("PASSPHRASE", DEFAULT_PASSWORD)
.arg(data_path)
.arg(format!("file://{}", mountpoint.display().to_string()))
.output();
data_res?;
.stderr(Stdio::piped())
.output()?;
if !data_output.status.success() {
return Err(anyhow::anyhow!(
"duplicity error: {}",
String::from_utf8(data_output.stderr).unwrap()
));
}
Ok(())
}
@@ -47,6 +56,7 @@ pub fn restore_backup(
let data_path = std::fs::canonicalize(data_path)?;
let data_output = std::process::Command::new("duplicity")
.env("PASSPHRASE", DEFAULT_PASSWORD)
.arg("--force")
.arg(format!("file://{}", mountpoint.display().to_string()))
.arg(&data_path)