btrfs: Implement extraargs

Signed-off-by: Fiona Klute (WIWA) <fiona.klute@gmx.de>
This commit is contained in:
Fiona Klute (WIWA) 2024-08-07 21:10:56 +02:00 committed by Fiona Klute
parent c9c015894e
commit b4b597f3f8
3 changed files with 7 additions and 1 deletions

View File

@ -28,13 +28,14 @@ static int btrfs_generate(struct image *image)
int ret;
const char *label = cfg_getstr(image->imagesec, "label");
const char *extraargs = cfg_getstr(image->imagesec, "extraargs");
ret = prepare_image(image, image->size);
if(ret)
return ret;
ret = systemp(image, "%s %s %s %s %s%s%s '%s'",
ret = systemp(image, "%s %s %s %s %s%s%s %s '%s'",
get_opt("mkfsbtrfs"),
label ? "-L" : "",
label ? label : "",
@ -43,6 +44,7 @@ static int btrfs_generate(struct image *image)
image->empty ? "" : "'",
image->empty ? "" : mountpath(image),
image->empty ? "" : "'",
extraargs,
imageoutfile(image)); /* destination file */
if(ret || image->empty)
@ -54,6 +56,7 @@ static int btrfs_generate(struct image *image)
static cfg_opt_t btrfs_opts[] = {
CFG_STR("label", NULL, CFGF_NONE),
CFG_STR("extraargs", "", CFGF_NONE),
CFG_END()
};

View File

@ -1,6 +1,8 @@
image test.btrfs {
btrfs {
label = "btrfstest"
# set UUID to test if extraargs works
extraargs = "--uuid 47e790af-a2e1-42ff-92c7-83f45f7b2228"
}
size = 64M
}

View File

@ -41,6 +41,7 @@ test_expect_success mkfs_btrfs,btrfs "btrfs" "
run_genimage_root btrfs.config test.btrfs
btrfs check images/test.btrfs
test \"\$(btrfs filesystem label images/test.btrfs)\" = btrfstest
btrfs filesystem show images/test.btrfs | grep \"uuid: 47e790af-a2e1-42ff-92c7-83f45f7b2228\"
"
exec_test_set_prereq mksquashfs