aboutsummaryrefslogtreecommitdiff
path: root/bin/gensquashfs/mkfs.c
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2021-11-01 12:02:02 +0100
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2022-03-30 22:31:30 +0200
commit2b84065a0f82e71e3f82fcd3148daa29f35a6597 (patch)
tree24d8108404ed9486766888b02581dfe1cfd04843 /bin/gensquashfs/mkfs.c
parenta41a57834fc70541ada5579e2d74114f7113e9bc (diff)
Add a sort-file option to gensquashfs
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'bin/gensquashfs/mkfs.c')
-rw-r--r--bin/gensquashfs/mkfs.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/bin/gensquashfs/mkfs.c b/bin/gensquashfs/mkfs.c
index 9e8e2d0..cb891f9 100644
--- a/bin/gensquashfs/mkfs.c
+++ b/bin/gensquashfs/mkfs.c
@@ -52,7 +52,7 @@ static int pack_files(sqfs_block_processor_t *data, fstree_t *fs,
return -1;
}
- flags = 0;
+ flags = fi->flags;
filesize = file->get_size(file);
if (opt->no_tail_packing && filesize > opt->cfg.block_size)
@@ -141,6 +141,7 @@ static void override_owner_dfs(const options_t *opt, tree_node_t *n)
int main(int argc, char **argv)
{
int status = EXIT_FAILURE;
+ istream_t *sortfile = NULL;
void *sehnd = NULL;
sqfs_writer_t sqfs;
options_t opt;
@@ -156,6 +157,12 @@ int main(int argc, char **argv)
goto out;
}
+ if (opt.sortfile != NULL) {
+ sortfile = istream_open_file(opt.sortfile);
+ if (sortfile == NULL)
+ goto out;
+ }
+
if (opt.infile == NULL) {
if (fstree_from_dir(&sqfs.fs, sqfs.fs.root, opt.packdir,
NULL, NULL, opt.dirscan_flags)) {
@@ -179,6 +186,11 @@ int main(int argc, char **argv)
}
}
+ if (sortfile != NULL) {
+ if (fstree_sort_files(&sqfs.fs, sortfile))
+ goto out;
+ }
+
if (pack_files(sqfs.data, &sqfs.fs, &opt))
goto out;
@@ -190,6 +202,8 @@ out:
sqfs_writer_cleanup(&sqfs, status);
if (sehnd != NULL)
selinux_close_context_file(sehnd);
+ if (sortfile != NULL)
+ sqfs_destroy(sortfile);
free(opt.packdir);
return status;
}