aboutsummaryrefslogtreecommitdiff
path: root/hbak/src
diff options
context:
space:
mode:
authorHimbeerserverDE <himbeerserverde@gmail.com>2024-02-14 18:53:13 +0100
committerHimbeerserverDE <himbeerserverde@gmail.com>2024-02-14 18:53:13 +0100
commit0b18043bfa3845c6d647e85a6fedf336725e6b85 (patch)
tree4cba28f90d5a0717db62f83c88350cf16398d3ae /hbak/src
parentbe3e8bc51930913732a5b9c7e514635eb2a75745 (diff)
add automatic fstab handling
Diffstat (limited to 'hbak/src')
-rw-r--r--hbak/src/main.rs15
1 files changed, 12 insertions, 3 deletions
diff --git a/hbak/src/main.rs b/hbak/src/main.rs
index 7224ac5..9aa96f7 100644
--- a/hbak/src/main.rs
+++ b/hbak/src/main.rs
@@ -125,6 +125,9 @@ enum Commands {
/// Do not restore the latest snapshots to the subvolumes.
#[arg(short = 'r', long)]
no_restore: bool,
+ /// Do not keep the fstab file from an existing subvolume.
+ #[arg(short = 'f', long)]
+ ignore_fstab: bool,
/// The device file the local btrfs file system is located at.
device: String,
/// The name this node was previously known under.
@@ -292,6 +295,7 @@ fn logic() -> Result<()> {
}
Commands::Restore {
no_restore,
+ ignore_fstab,
device,
node_name,
address,
@@ -313,7 +317,7 @@ fn logic() -> Result<()> {
)?;
println!("Restoring from {}...", address);
- restore(&local_node, &address, no_restore)?;
+ restore(&local_node, &address, no_restore, ignore_fstab)?;
}
}
@@ -431,7 +435,12 @@ fn sync(
Ok(())
}
-fn restore(local_node: &LocalNode, address: &str, no_restore: bool) -> Result<()> {
+fn restore(
+ local_node: &LocalNode,
+ address: &str,
+ no_restore: bool,
+ ignore_fstab: bool,
+) -> Result<()> {
let address = match address.parse() {
Ok(address) => address,
Err(_) => SocketAddr::new(address.parse()?, DEFAULT_PORT),
@@ -515,7 +524,7 @@ fn restore(local_node: &LocalNode, address: &str, no_restore: bool) -> Result<()
if !no_restore {
for subvol in &local_node.config().subvols {
println!("Restoring subvolume {}", subvol);
- local_node.restore(subvol.clone())?;
+ local_node.restore(subvol.clone(), ignore_fstab)?;
}
}