Skip to content

Commit

Permalink
Make appimagetool use zstd
Browse files Browse the repository at this point in the history
  • Loading branch information
probonopd authored Jun 25, 2023
1 parent 701b711 commit db696de
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/appimagetool.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ gchar *updateinformation = NULL;
static gboolean guess_update_information = FALSE;
gchar *bintray_user = NULL;
gchar *bintray_repo = NULL;
gchar *sqfs_comp = "gzip";
gchar *sqfs_comp = "zstd";
gchar **sqfs_opts = NULL;
gchar *exclude_file = NULL;
gchar *runtime_file = NULL;
Expand Down Expand Up @@ -163,6 +163,7 @@ int sfs_mksquashfs(char *source, char *destination, int offset) {

int max_num_args = sqfs_opts_len + 22;
char* args[max_num_args];
bool use_zstd = strcmp(sqfs_comp, "zstd") >= 0;
bool use_xz = strcmp(sqfs_comp, "xz") >= 0;

int i = 0;
Expand All @@ -177,6 +178,7 @@ int sfs_mksquashfs(char *source, char *destination, int offset) {
args[i++] = offset_string;

args[i++] = "-comp";

if (use_xz)
args[i++] = "xz";
else
Expand All @@ -185,6 +187,12 @@ int sfs_mksquashfs(char *source, char *destination, int offset) {
args[i++] = "-root-owned";
args[i++] = "-noappend";

if (use_zstd) {
// https://github.com/probonopd/go-appimage/blob/785b52511085b37e09e967c0bc2ebd7f9401e6b9/src/appimagetool/appimagetool.go#L440
args[i++] = "-b";
args[i++] = "1M";
}

if (use_xz) {
// https://jonathancarter.org/2015/04/06/squashfs-performance-testing/ says:
// improved performance by using a 16384 block size with a sacrifice of around 3% more squashfs image space
Expand Down

0 comments on commit db696de

Please sign in to comment.