summaryrefslogtreecommitdiff
path: root/bin/gensquashfs/mkfs.c
diff options
context:
space:
mode:
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;
}