aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Väth <martin@mvath.de>2016-01-13 09:28:26 +0100
committerPhillip Lougher <phillip@squashfs.org.uk>2017-07-31 19:20:11 +0100
commit713fb3c3305cb5e7ac5f743adc48e0319c4ad383 (patch)
treea522a9c6ce5e05a25686c1080894c23e8a9374b5
parent8a627c2206f6caa094fc200b77dc2c32b5542955 (diff)
downloadsquashfs-tools-713fb3c3305cb5e7ac5f743adc48e0319c4ad383.tar.gz
mksquashfs: enable -quiet option
It is nice if the user interface of wrapper scripts can display a progress bar to the user without having to display the detailed information about the generated file. This can be achieved easily by the new -quiet option. This is optionally already used by e.g. https://github.com/vaeth/squashmount/
-rw-r--r--squashfs-tools/mksquashfs.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/squashfs-tools/mksquashfs.c b/squashfs-tools/mksquashfs.c
index b7643c4..1ccbb28 100644
--- a/squashfs-tools/mksquashfs.c
+++ b/squashfs-tools/mksquashfs.c
@@ -78,6 +78,7 @@
#include "fnmatch_compat.h"
int delete = FALSE;
+int quiet = FALSE;
int fd;
struct squashfs_super_block sBlk;
@@ -4277,7 +4278,7 @@ void initialise_threads(int readq, int fragq, int bwriteq, int fwriteq,
main_thread = pthread_self();
- printf("Parallel mksquashfs: Using %d processor%s\n", processors,
+ quiet || printf("Parallel mksquashfs: Using %d processor%s\n", processors,
processors == 1 ? "" : "s");
/* Restore the signal mask for the main thread */
@@ -4804,6 +4805,9 @@ void write_filesystem_tables(struct squashfs_super_block *sBlk, int nopad)
total_bytes += total_inode_bytes + total_directory_bytes +
sizeof(struct squashfs_super_block) + total_xattr_bytes;
+ if(quiet)
+ return;
+
printf("\n%sSquashfs %d.%d filesystem, %s compressed, data block size"
" %d\n", exportable ? "Exportable " : "", SQUASHFS_MAJOR,
SQUASHFS_MINOR, comp->name, block_size);
@@ -5540,6 +5544,9 @@ print_compressor_options:
else if(strcmp(argv[i], "-noappend") == 0)
delete = TRUE;
+ else if(strcmp(argv[i], "-quiet") == 0)
+ quiet = TRUE;
+
else if(strcmp(argv[i], "-keep-as-directory") == 0)
keep_as_directory = TRUE;
@@ -5632,6 +5639,7 @@ printOptions:
"using recovery file <name>\n");
ERROR("-no-recovery\t\tdon't generate a recovery "
"file\n");
+ ERROR("-quiet\t\t\tno verbose output\n");
ERROR("-info\t\t\tprint files written to filesystem\n");
ERROR("-no-progress\t\tdon't display the progress "
"bar\n");
@@ -5824,7 +5832,7 @@ printOptions:
void *comp_data = compressor_dump_options(comp, block_size,
&size);
- printf("Creating %d.%d filesystem on %s, block size %d.\n",
+ quiet || printf("Creating %d.%d filesystem on %s, block size %d.\n",
SQUASHFS_MAJOR, SQUASHFS_MINOR, argv[source + 1], block_size);
/*