in src/main/java/org/apache/netbeans/nbpackage/appimage/AppImageTask.java [75:99]
protected Path buildPackage(Path image) throws Exception {
Path tool = context().getValue(AppImagePackager.APPIMAGE_TOOL)
.orElseThrow(() -> new IllegalStateException(
AppImagePackager.MESSAGES.getString("message.noappimagetool")))
.toAbsolutePath();
String arch = context().getValue(AppImagePackager.APPIMAGE_ARCH)
.orElse(archFromAppImageTool(tool));
String targetName = image.getFileName().toString();
if (targetName.endsWith(".AppDir")) {
targetName = targetName.substring(0, targetName.length() - 7);
}
targetName = targetName + "-" + arch + ".AppImage";
Path target = context().destination().resolve(targetName);
List<String> cmd = List.of(tool.toString(),
image.toAbsolutePath().toString(),
target.toString());
ProcessBuilder pb = new ProcessBuilder(cmd);
pb.environment().put("ARCH", arch);
int result = context().exec(pb);
if (result != 0) {
throw new Exception();
} else {
return target;
}
}