diff options
author | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2019-08-01 21:48:12 +0200 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2019-08-01 21:50:49 +0200 |
commit | eddb62072f4d4d2402d520e5041d9677fa6efdff (patch) | |
tree | bfbde95d8b0e825de8fdd92d597ba226f67813b5 /unpack/options.c | |
parent | 0b79e0cad88fe6494c1d5af9a5e990b491170d11 (diff) |
Add flag to rdsquashfs to optionally set xattrs on unpacked files
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'unpack/options.c')
-rw-r--r-- | unpack/options.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/unpack/options.c b/unpack/options.c index e5e0389..594b610 100644 --- a/unpack/options.c +++ b/unpack/options.c @@ -18,6 +18,9 @@ static struct option long_opts[] = { { "no-slink", no_argument, NULL, 'L' }, { "no-empty-dir", no_argument, NULL, 'E' }, { "no-sparse", no_argument, NULL, 'Z' }, +#ifdef HAVE_SYS_XATTR_H + { "set-xattr", no_argument, NULL, 'X' }, +#endif { "jobs", required_argument, NULL, 'j' }, { "describe", no_argument, NULL, 'd' }, { "chmod", no_argument, NULL, 'C' }, @@ -27,7 +30,12 @@ static struct option long_opts[] = { { "version", no_argument, NULL, 'V' }, }; -static const char *short_opts = "l:c:u:p:x:DSFLCOEZj:dqhV"; +static const char *short_opts = + "l:c:u:p:x:DSFLCOEZj:dqhV" +#ifdef HAVE_SYS_XATTR_H + "X" +#endif + ; static const char *help_string = "Usage: %s [OPTIONS] <squashfs-file>\n" @@ -59,6 +67,10 @@ static const char *help_string = " empty after applying the above rules.\n" " --no-sparse, -Z Do not create sparse files, always write zero\n" " blocks to disk.\n" +#ifdef HAVE_SYS_XATTR_H +" --set-xattr, -X When unpacking files to disk, set the extended\n" +" attributes from the squashfs image.\n" +#endif " --jobs, -j <count> Number of parallel unpacking jobs to start.\n" " --chmod, -C Change permission flags of unpacked files to\n" " those store in the squashfs image.\n" @@ -135,6 +147,12 @@ void process_command_line(options_t *opt, int argc, char **argv) case 'Z': opt->flags |= UNPACK_NO_SPARSE; break; +#ifdef HAVE_SYS_XATTR_H + case 'X': + opt->flags |= UNPACK_SET_XATTR; + opt->rdtree_flags |= RDTREE_READ_XATTR; + break; +#endif case 'j': for (j = 0; optarg[j] != '\0'; ++j) { if (j > 6 || !isdigit(optarg[j])) |