grub-fstest luks support

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2011-04-22 19:44:41 +02:00
parent 24089d19e2
commit 4169260830
2 changed files with 39 additions and 4 deletions

View file

@ -275,6 +275,7 @@ static char **images = NULL;
static int cmd = 0;
static char *debug_str = NULL;
static char **args = NULL;
static int mount_crypt = 0;
static void
fstest (int n, char **args)
@ -304,6 +305,13 @@ fstest (int n, char **args)
grub_free (host_file);
}
{
char *argv[2] = { "-a", NULL};
if (mount_crypt)
if (execute_command ("luksmount", 1, argv))
grub_util_error (_("luksmount command fails: %s"), grub_errmsg);
}
grub_lvm_fini ();
grub_mdraid09_fini ();
grub_mdraid1x_fini ();
@ -366,6 +374,7 @@ static struct argp_option options[] = {
{"length", 'n', "N", 0, N_("Handle N bytes in output file."), 2},
{"diskcount", 'c', "N", 0, N_("N input files."), 2},
{"debug", 'd', "S", 0, N_("Set debug environment variable."), 2},
{"crypto", 'C', NULL, OPTION_ARG_OPTIONAL, N_("Mount crypto devices."), 2},
{"verbose", 'v', NULL, OPTION_ARG_OPTIONAL, N_("Print verbose messages."), 2},
{0, 0, 0, 0, 0, 0}
};
@ -389,6 +398,10 @@ argp_parser (int key, char *arg, struct argp_state *state)
root = arg;
return 0;
case 'C':
mount_crypt = 1;
return 0;
case 's':
skip = grub_strtoul (arg, &p, 0);
if (*p == 's')
@ -523,6 +536,7 @@ main (int argc, char *argv[])
/* Initialize all modules. */
grub_init_all ();
grub_gcry_init_all ();
if (debug_str)
grub_env_set ("debug", debug_str);
@ -551,6 +565,7 @@ main (int argc, char *argv[])
fstest (args_count - 1 - num_disks, args);
/* Free resources. */
grub_gcry_fini_all ();
grub_fini_all ();
return 0;