diff options
-rw-r--r-- | hbak/src/main.rs | 6 | ||||
-rw-r--r-- | hbak_common/src/system.rs | 7 |
2 files changed, 11 insertions, 2 deletions
diff --git a/hbak/src/main.rs b/hbak/src/main.rs index 1516426..aab2a1f 100644 --- a/hbak/src/main.rs +++ b/hbak/src/main.rs @@ -20,6 +20,9 @@ struct Cli { enum Commands { /// Perform basic initialization of the local node. Init { + /// Initialize the configuration file but not the btrfs subvolumes. + #[arg(short = 'c', long = "config-only")] + config_only: bool, /// The device file the local btrfs file system is located at. device: String, /// The name to use for this node. @@ -106,12 +109,13 @@ fn logic() -> Result<()> { match cli.command { Commands::Init { + config_only, device, node_name, bind_addr, } => { let passphrase = rpassword::prompt_password("Enter new encryption passphrase: ")?; - system::init(device, bind_addr, node_name, passphrase)?; + system::init(config_only, device, bind_addr, node_name, passphrase)?; } Commands::Clean { backups } => { system::deinit(backups)?; diff --git a/hbak_common/src/system.rs b/hbak_common/src/system.rs index 3fd48c8..e914824 100644 --- a/hbak_common/src/system.rs +++ b/hbak_common/src/system.rs @@ -17,6 +17,7 @@ pub const MOUNTPOINT: &str = "/mnt/hbak"; /// Initializes the configuration file and local btrfs subvolumes. pub fn init( + config_only: bool, device: String, bind_addr: Option<SocketAddr>, node_name: String, @@ -39,7 +40,11 @@ pub fn init( node_config.save()?; - init_btrfs(&node_config.device) + if !config_only { + init_btrfs(&node_config.device)?; + } + + Ok(()) } fn init_btrfs(device: &str) -> Result<(), LocalNodeError> { |