Skip to content

Commit aa0b7dc

Browse files
b-antwanb-antwan
andauthored
Add cli option to specify AppImage url for zsync generation (#111)
Co-authored-by: b-antwan <[email protected]>
1 parent 7cfafc4 commit aa0b7dc

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/appimagetool.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ gchar *exclude_file = NULL;
8383
gchar *runtime_file = NULL;
8484
gchar *sign_key = NULL;
8585
gchar *pathToMksquashfs = NULL;
86+
gchar *file_url;
8687

8788
// #####################################################################
8889

@@ -521,6 +522,7 @@ static GOptionEntry entries[] =
521522
{ "exclude-file", 0, 0, G_OPTION_ARG_STRING, &exclude_file, _exclude_file_desc, NULL },
522523
{ "runtime-file", 0, 0, G_OPTION_ARG_STRING, &runtime_file, "Runtime file to use", NULL },
523524
{ "sign-key", 0, 0, G_OPTION_ARG_STRING, &sign_key, "Key ID to use for gpg[2] signatures", NULL},
525+
{ "file-url", 0, 0, G_OPTION_ARG_STRING, &file_url, "URL of the AppImage file, can be relative to zsync, or absolute/full", NULL },
524526
{ G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &remaining_args, NULL, NULL },
525527
{ 0,0,0,0,0,0,0 }
526528
};
@@ -610,6 +612,9 @@ main (int argc, char *argv[])
610612
exit(1);
611613
}
612614

615+
if (file_url && strlen(file_url) == 0)
616+
die("--file-url argument is empty");
617+
613618
fprintf(
614619
showVersionOnly ? stdout : stderr,
615620
"appimagetool, %s (git version %s), build %s built on %s\n",
@@ -1130,7 +1135,8 @@ main (int argc, char *argv[])
11301135
"hence generating zsync file\n");
11311136

11321137
// notice for Alpine builds: Alpine's getopt does not parse flags passed after the first parameter, order matters here
1133-
const gchar* const zsyncmake_command[] = {zsyncmake_path, "-u", basename(destination), destination, NULL};
1138+
const gchar* zsync_url_arg = file_url ? file_url : basename(destination);
1139+
const gchar* const zsyncmake_command[] = {zsyncmake_path, "-u", zsync_url_arg, destination, NULL};
11341140

11351141
if (verbose) {
11361142
fprintf(stderr, "Running zsyncmake process: ");

0 commit comments

Comments
 (0)