1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-03 22:56:33 +02:00

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.
This commit is contained in:
Werner Koch 2024-01-09 19:52:04 +01:00
parent 4ca017e43b
commit 6233a17ac9
No known key found for this signature in database
GPG key ID: E3FDFF218E45B72B
8 changed files with 76 additions and 43 deletions

View file

@ -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);