File tree Expand file tree Collapse file tree 1 file changed +20
-4
lines changed
src/main/java/io/github/fvarrui/javapackager/packagers Expand file tree Collapse file tree 1 file changed +20
-4
lines changed Original file line number Diff line number Diff line change 1313public class GenerateAppImage extends ArtifactGenerator <LinuxPackager > {
1414
1515 private static final int IMAGETOOL_VERSION = 13 ;
16- private static final String IMAGETOOL_URL = "https://github.com/AppImage/AppImageKit/releases/download/" + IMAGETOOL_VERSION + "/appimagetool-" + SystemUtils . OS_ARCH + " .AppImage" ;
16+ private static final String IMAGETOOL_URL = "https://github.com/AppImage/AppImageKit/releases/download/" + IMAGETOOL_VERSION + "/appimagetool-%s .AppImage" ;
1717
1818 public GenerateAppImage () {
1919 super ("AppImage" );
@@ -72,14 +72,30 @@ protected File doApply(LinuxPackager packager) throws Exception {
7272 return appImage ;
7373 }
7474
75- private File getAppImageTool (LinuxPackager packager ) throws IOException {
75+ private File getAppImageTool (LinuxPackager packager ) throws Exception {
7676 File assetsFolder = packager .getAssetsFolder ();
7777 File appImageTool = new File (assetsFolder , "appimagetool" );
7878 if (!appImageTool .exists ()) {
79- FileUtils .downloadFromUrl (IMAGETOOL_URL , appImageTool );
79+ String imageToolUrl = IMAGETOOL_URL .formatted (getOSArch ());
80+ try {
81+ FileUtils .downloadFromUrl (imageToolUrl , appImageTool );
82+ } catch (IOException e ) {
83+ throw new Exception (imageToolUrl + "not found! ... Unsupported OS architecture " + getOSArch () + "?" );
84+ }
8085 appImageTool .setExecutable (true );
8186 }
8287 return appImageTool ;
8388 }
84-
89+
90+ private String getOSArch () {
91+ switch (SystemUtils .OS_ARCH ) {
92+ case "amd64" :
93+ return "x86_64" ;
94+ case "x86" :
95+ case "i386" :
96+ return "i686" ;
97+ }
98+ return SystemUtils .OS_ARCH ;
99+ }
100+
85101}
You can’t perform that action at this time.
0 commit comments