Skip to content

Commit 88853e9

Browse files
committed
Generate zsync file after signing it
1 parent 5483cea commit 88853e9

File tree

1 file changed

+20
-16
lines changed

1 file changed

+20
-16
lines changed

appimagetool.c

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -529,22 +529,8 @@ main (int argc, char *argv[])
529529
if(verbose)
530530
printf("updateinformation type: %s\n", ui_type[0]);
531531
/* TODO: Further checking of the updateinformation */
532-
533-
/* As a courtesy, we also generate the zsync file */
534-
gchar *zsyncmake_path = g_find_program_in_path ("zsyncmake");
535-
if(!zsyncmake_path){
536-
fprintf (stderr, "zsyncmake is not installed, skipping\n");
537-
} else {
538-
fprintf (stderr, "zsyncmake is installed and updateinformation is provided, "
539-
"hence generating zsync file\n");
540-
sprintf (command, "%s %s -u %s", zsyncmake_path, destination, basename(destination));
541-
if(verbose)
542-
fprintf (stderr, "%s\n", command);
543-
fp = popen(command, "r");
544-
if (fp == NULL)
545-
die("Failed to run zsyncmake command");
546-
}
547532

533+
548534
unsigned long ui_offset = 0;
549535
unsigned long ui_length = 0;
550536
get_elf_section_offset_and_lenghth(destination, ".upd_info", &ui_offset, &ui_length);
@@ -649,7 +635,25 @@ main (int argc, char *argv[])
649635
unlink(digestfile);
650636
}
651637
}
652-
}
638+
}
639+
640+
/* If updateinformation was provided, then we also generate the zsync file (after having signed the AppImage) */
641+
if(updateinformation != NULL){
642+
gchar *zsyncmake_path = g_find_program_in_path ("zsyncmake");
643+
if(!zsyncmake_path){
644+
fprintf (stderr, "zsyncmake is not installed, skipping\n");
645+
} else {
646+
fprintf (stderr, "zsyncmake is installed and updateinformation is provided, "
647+
"hence generating zsync file\n");
648+
sprintf (command, "%s %s -u %s", zsyncmake_path, destination, basename(destination));
649+
if(verbose)
650+
fprintf (stderr, "%s\n", command);
651+
fp = popen(command, "r");
652+
if (fp == NULL)
653+
die("Failed to run zsyncmake command");
654+
}
655+
}
656+
653657
fprintf (stderr, "Success\n");
654658
}
655659

0 commit comments

Comments
 (0)