summaryrefslogtreecommitdiff
path: root/unpack/rdsquashfs.c
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-07-23 16:46:42 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-07-25 22:10:24 +0200
commit2fcf04928a0eaf7332503753a4866a0f2031a50e (patch)
treefb7c5ae31faa21850ec283bd14d91818ceeb21a0 /unpack/rdsquashfs.c
parent22fba34bcd0f2944def234fa684d1c9cc4d65310 (diff)
rdsquashfs: seperate creating of the hierarchy, unpacking and chmod/chown
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'unpack/rdsquashfs.c')
-rw-r--r--unpack/rdsquashfs.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/unpack/rdsquashfs.c b/unpack/rdsquashfs.c
index 4a0f12b..a3618e3 100644
--- a/unpack/rdsquashfs.c
+++ b/unpack/rdsquashfs.c
@@ -42,6 +42,8 @@ int main(int argc, char **argv)
if (deserialize_fstree(&fs, &super, cmp, sqfsfd, opt.rdtree_flags))
goto out_cmp;
+ fstree_gen_file_list(&fs);
+
if (opt.cmdpath != NULL) {
n = fstree_node_from_path(&fs, opt.cmdpath);
if (n == NULL) {
@@ -72,11 +74,28 @@ int main(int argc, char **argv)
goto out_fs;
break;
case OP_UNPACK:
+ if (opt.unpack_root != NULL) {
+ if (mkdir_p(opt.unpack_root))
+ return -1;
+
+ if (pushd(opt.unpack_root))
+ return -1;
+ }
+
+ if (restore_fstree(n, opt.flags))
+ goto out_fs;
+
data = data_reader_create(sqfsfd, &super, cmp);
if (data == NULL)
goto out_fs;
- if (restore_fstree(opt.unpack_root, n, data, opt.flags))
+ if (fill_unpacked_files(&fs, data, opt.flags))
+ goto out_fs;
+
+ if (update_tree_attribs(n, opt.flags))
+ goto out_fs;
+
+ if (opt.unpack_root != NULL && popd() != 0)
goto out_fs;
break;
case OP_DESCRIBE: