From 7e77d17e005ef85142aaec37a730825d27500d15 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Sun, 23 Jun 2019 02:48:38 +0200 Subject: Add filesystem defaults option to tar2sqfs Signed-off-by: David Oberhollenzer --- tar/tar2sqfs.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'tar') diff --git a/tar/tar2sqfs.c b/tar/tar2sqfs.c index 48ca2f1..8592fcb 100644 --- a/tar/tar2sqfs.c +++ b/tar/tar2sqfs.c @@ -21,13 +21,14 @@ static struct option long_opts[] = { { "compressor", required_argument, NULL, 'c' }, { "comp-extra", required_argument, NULL, 'X' }, + { "defaults", required_argument, NULL, 'd' }, { "force", no_argument, NULL, 'f' }, { "quiet", no_argument, NULL, 'q' }, { "help", no_argument, NULL, 'h' }, { "version", no_argument, NULL, 'V' }, }; -static const char *short_opts = "c:X:fqhV"; +static const char *short_opts = "c:X:d:fqhV"; static const char *usagestr = "Usage: tar2sqfs [OPTIONS...] \n" @@ -42,6 +43,15 @@ static const char *usagestr = " --comp-extra, -X A comma seperated list of extra options for\n" " the selected compressor. Specify 'help' to\n" " get a list of available options.\n" +" --defaults, -d A comma seperated list of default values for\n" +" implicitly created directories.\n" +"\n" +" Possible options:\n" +" uid= 0 if not set.\n" +" gid= 0 if not set.\n" +" mode= 0755 if not set.\n" +" mtime= 0 if not set.\n" +"\n" " --force, -f Overwrite the output file if it exists.\n" " --quiet, -q Do not print out progress reports.\n" " --help, -h Print help text and exit.\n" @@ -61,6 +71,7 @@ static bool quiet = false; static int outmode = O_WRONLY | O_CREAT | O_EXCL; static E_SQFS_COMPRESSOR comp_id; static char *comp_extra = NULL; +static char *fs_defaults = NULL; static void process_args(int argc, char **argv) { @@ -93,6 +104,9 @@ static void process_args(int argc, char **argv) case 'X': comp_extra = optarg; break; + case 'd': + fs_defaults = optarg; + break; case 'f': outmode = O_WRONLY | O_CREAT | O_TRUNC; break; @@ -219,7 +233,7 @@ int main(int argc, char **argv) return EXIT_FAILURE; } - if (fstree_init(&fs, block_size, NULL)) + if (fstree_init(&fs, block_size, fs_defaults)) goto out_fd; cmp = compressor_create(comp_id, true, block_size, comp_extra); -- cgit v1.2.3