From 2fcf04928a0eaf7332503753a4866a0f2031a50e Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Tue, 23 Jul 2019 16:46:42 +0200 Subject: rdsquashfs: seperate creating of the hierarchy, unpacking and chmod/chown Signed-off-by: David Oberhollenzer --- unpack/rdsquashfs.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'unpack/rdsquashfs.c') 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: -- cgit v1.2.3