mirror of
https://github.com/koverstreet/bcachefs-tools.git
synced 2025-02-02 00:00:03 +03:00
cmd_mount: Fix test-only mount path
The comman line help claims that `bcachefs mount <DEV>` without a mount point will do a dry-run mount - all the steps required to mount the fs, but without actually doing the final real mount. Make the code actually do this, rather than complain that you haven't supplied a mountpoint if you don't provide a mountpoint Signed-off-by: Christopher James Halse Rogers <raof@ubuntu.com>
This commit is contained in:
parent
e0e3032926
commit
28e6dea653
@ -145,7 +145,7 @@ struct Cli {
|
|||||||
/// Where the filesystem should be mounted. If not set, then the filesystem
|
/// Where the filesystem should be mounted. If not set, then the filesystem
|
||||||
/// won't actually be mounted. But all steps preceeding mounting the
|
/// won't actually be mounted. But all steps preceeding mounting the
|
||||||
/// filesystem (e.g. asking for passphrase) will still be performed.
|
/// filesystem (e.g. asking for passphrase) will still be performed.
|
||||||
mountpoint: std::path::PathBuf,
|
mountpoint: Option<std::path::PathBuf>,
|
||||||
|
|
||||||
/// Mount options
|
/// Mount options
|
||||||
#[arg(short, default_value = "")]
|
#[arg(short, default_value = "")]
|
||||||
@ -207,14 +207,23 @@ fn cmd_mount_inner(opt: Cli) -> anyhow::Result<()> {
|
|||||||
key::prepare_key(&sbs[0], key)?;
|
key::prepare_key(&sbs[0], key)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
info!(
|
if let Some(mountpoint) = opt.mountpoint {
|
||||||
"mounting with params: device: {}, target: {}, options: {}",
|
info!(
|
||||||
devs,
|
"mounting with params: device: {}, target: {}, options: {}",
|
||||||
&opt.mountpoint.to_string_lossy(),
|
devs,
|
||||||
&opt.options
|
mountpoint.to_string_lossy(),
|
||||||
);
|
&opt.options
|
||||||
|
);
|
||||||
|
|
||||||
|
mount(devs, mountpoint, &opt.options)?;
|
||||||
|
} else {
|
||||||
|
info!(
|
||||||
|
"would mount with params: device: {}, options: {}",
|
||||||
|
devs,
|
||||||
|
&opt.options
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
mount(devs, &opt.mountpoint, &opt.options)?;
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user