restic

This commit is contained in:
JMARyA 2025-04-25 13:06:16 +02:00
parent 12f101bf46
commit 1d3a1b7a60
Signed by: jmarya
GPG key ID: 901B2ADDF27C2263
6 changed files with 327 additions and 17 deletions

View file

@ -6,10 +6,6 @@ use crate::{
run_command,
};
pub fn init_repo(path: &str) {
run_command(&["borg", "init", "--encryption=repokey-blake2", path], None);
}
pub fn bind_mount(src: &str, dst: &str) {
run_command(&["mount", "--bind", src, dst], None);
}
@ -125,7 +121,12 @@ pub fn create_archive(conf: &BorgConfig) {
cmd.extend(dirs.iter().map(|x| x.0.as_str()));
run_command(&cmd, conf.passphrase.clone());
run_command(
&cmd,
conf.passphrase
.clone()
.map(|pass| vec![("BORG_PASSPHRASE".to_string(), pass)]),
);
for cleanup in &snaps {
cephfs_snap_remove_dir(&cleanup.0);
@ -194,10 +195,22 @@ pub fn prune_archive(conf: &BorgPruneConfig) {
.unwrap_or_default();
cmd.push(&binding);
run_command(&cmd, Some(conf.passphrase.clone()));
run_command(
&cmd,
Some(vec![(
"BORG_PASSPHRASE".to_string(),
conf.passphrase.clone(),
)]),
);
let cmd = vec!["borg", "compact", &conf.repo];
run_command(&cmd, Some(conf.passphrase.clone()));
run_command(
&cmd,
Some(vec![(
"BORG_PASSPHRASE".to_string(),
conf.passphrase.clone(),
)]),
);
}
pub fn check_archive(conf: &BorgCheckConfig) {