summaryrefslogtreecommitdiff
path: root/tar
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-06-23 02:48:38 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-06-23 02:48:38 +0200
commit7e77d17e005ef85142aaec37a730825d27500d15 (patch)
tree4c1c4f776ccec5678253b717a3ff5829f754e481 /tar
parent69529ef26159748011ef27cddc17aa78a2ac8f3e (diff)
Add filesystem defaults option to tar2sqfs
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'tar')
-rw-r--r--tar/tar2sqfs.c18
1 files changed, 16 insertions, 2 deletions
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...] <sqfsfile>\n"
@@ -42,6 +43,15 @@ static const char *usagestr =
" --comp-extra, -X <options> 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 <options> A comma seperated list of default values for\n"
+" implicitly created directories.\n"
+"\n"
+" Possible options:\n"
+" uid=<value> 0 if not set.\n"
+" gid=<value> 0 if not set.\n"
+" mode=<value> 0755 if not set.\n"
+" mtime=<value> 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);