summaryrefslogtreecommitdiffstats
path: root/g13/call-syshelp.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2024-01-09 19:52:04 +0100
committerWerner Koch <wk@gnupg.org>2024-01-09 19:52:04 +0100
commit6233a17ac99deb8d246458380813b621df2609bf (patch)
treea15a5797bf8cb809353e3e1086933563555d9245 /g13/call-syshelp.c
parentgpg: Print a useful error id SKI algo 253 is found. (diff)
downloadgnupg2-6233a17ac99deb8d246458380813b621df2609bf.tar.xz
gnupg2-6233a17ac99deb8d246458380813b621df2609bf.zip
g13: New option --no-mount.
* g13/g13.c (oNoMount): New. (opts): Add --no-mount. (main): Implement this. * g13/g13-common.h (opt): Add field no_mount. * common/status.h (STATUS_PLAINDEV): New. * g13/sh-cmd.c (has_option): Uncomment. (cmd_mount): Add option --no-mount and pass down. * g13/sh-dmcrypt.c (sh_dmcrypt_mount_container): Add arg nomount and emit PLAINDEV status line. (sh_dmcrypt_umount_container): Rund findmnt before umount. -- This option can be used to decrypt a device but not to mount it. For example to run fsck first. A command or option to run fsck before a mount will eventually be added. The use of findmnt is needed so that we can easily remove a device which has not been mounted.
Diffstat (limited to 'g13/call-syshelp.c')
-rw-r--r--g13/call-syshelp.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/g13/call-syshelp.c b/g13/call-syshelp.c
index 54dca04ec..c4bc48172 100644
--- a/g13/call-syshelp.c
+++ b/g13/call-syshelp.c
@@ -433,10 +433,15 @@ static gpg_error_t
mount_status_cb (void *opaque, const char *line)
{
struct mount_parm_s *parm = opaque;
+ const char *s;
- /* Nothing right now. */
(void)parm;
- (void)line;
+
+ if ((s=has_leading_keyword (line, "PLAINDEV")))
+ {
+ if (opt.verbose || opt.no_mount)
+ log_info ("Device: %s\n", s);
+ }
return 0;
}
@@ -497,7 +502,10 @@ call_syshelp_run_mount (ctrl_t ctrl, int conttype, const char *mountpoint,
{
ref_tupledesc (tuples);
parm.keyblob = get_tupledesc_data (tuples, &parm.keybloblen);
- err = assuan_transact (ctx, "MOUNT dm-crypt",
+ err = assuan_transact (ctx,
+ (opt.no_mount
+ ? "MOUNT --no-mount dm-crypt"
+ : "MOUNT dm-crypt"),
NULL, NULL,
mount_inq_cb, &parm,
mount_status_cb, &parm);