equal
deleted
inserted
replaced
169 String licenseFile = LICENSE_FILE.fetchFrom(params); |
169 String licenseFile = LICENSE_FILE.fetchFrom(params); |
170 if (licenseFile != null) { |
170 if (licenseFile != null) { |
171 return Files.readString(new File(licenseFile).toPath()); |
171 return Files.readString(new File(licenseFile).toPath()); |
172 } |
172 } |
173 } catch (Exception e) { |
173 } catch (Exception e) { |
174 if (Log.isDebug()) { |
174 Log.verbose(e); |
175 e.printStackTrace(); |
|
176 } |
|
177 } |
175 } |
178 return "Unknown"; |
176 return "Unknown"; |
179 }, |
177 }, |
180 (s, p) -> s); |
178 (s, p) -> s); |
181 |
179 |
195 } |
193 } |
196 String appName = APP_NAME.fetchFrom(params); |
194 String appName = APP_NAME.fetchFrom(params); |
197 |
195 |
198 return (appName + "-" + vendor).replaceAll("\\s", ""); |
196 return (appName + "-" + vendor).replaceAll("\\s", ""); |
199 } catch (Exception e) { |
197 } catch (Exception e) { |
200 if (Log.isDebug()) { |
198 Log.verbose(e); |
201 e.printStackTrace(); |
|
202 } |
|
203 } |
199 } |
204 return "unknown-MimeInfo.xml"; |
200 return "unknown-MimeInfo.xml"; |
205 }, |
201 }, |
206 (s, p) -> s); |
202 (s, p) -> s); |
207 |
203 |
299 } |
295 } |
300 } |
296 } |
301 } |
297 } |
302 |
298 |
303 private boolean prepareProto(Map<String, ? super Object> p) |
299 private boolean prepareProto(Map<String, ? super Object> p) |
304 throws IOException { |
300 throws PackagerException, IOException { |
305 File appImage = StandardBundlerParam.getPredefinedAppImage(p); |
301 File appImage = StandardBundlerParam.getPredefinedAppImage(p); |
306 File appDir = null; |
302 File appDir = null; |
307 |
303 |
308 // we either have an application image or need to build one |
304 // we either have an application image or need to build one |
309 if (appImage != null) { |
305 if (appImage != null) { |
317 } |
313 } |
318 return appDir != null; |
314 return appDir != null; |
319 } |
315 } |
320 |
316 |
321 //@Override |
317 //@Override |
322 public File bundle(Map<String, ? super Object> p, File outdir) { |
318 public File bundle(Map<String, ? super Object> p, |
|
319 File outdir) throws PackagerException { |
323 if (!outdir.isDirectory() && !outdir.mkdirs()) { |
320 if (!outdir.isDirectory() && !outdir.mkdirs()) { |
324 throw new RuntimeException(MessageFormat.format( |
321 throw new PackagerException ("error.cannot-create-output-dir", |
325 I18N.getString("error.cannot-create-output-dir"), |
322 outdir.getAbsolutePath()); |
326 outdir.getAbsolutePath())); |
|
327 } |
323 } |
328 if (!outdir.canWrite()) { |
324 if (!outdir.canWrite()) { |
329 throw new RuntimeException(MessageFormat.format( |
325 throw new PackagerException("error.cannot-write-to-output-dir", |
330 I18N.getString("error.cannot-write-to-output-dir"), |
326 outdir.getAbsolutePath()); |
331 outdir.getAbsolutePath())); |
|
332 } |
327 } |
333 |
328 |
334 // we want to create following structure |
329 // we want to create following structure |
335 // <package-name> |
330 // <package-name> |
336 // DEBIAN |
331 // DEBIAN |
353 if (prepareProto(p) && prepareProjectConfig(p)) { |
348 if (prepareProto(p) && prepareProjectConfig(p)) { |
354 return buildDeb(p, outdir); |
349 return buildDeb(p, outdir); |
355 } |
350 } |
356 return null; |
351 return null; |
357 } catch (IOException ex) { |
352 } catch (IOException ex) { |
358 ex.printStackTrace(); |
353 Log.verbose(ex); |
359 return null; |
354 throw new PackagerException(ex); |
360 } |
355 } |
361 } |
356 } |
362 |
357 |
363 /* |
358 /* |
364 * set permissions with a string like "rwxr-xr-x" |
359 * set permissions with a string like "rwxr-xr-x" |
872 ); |
867 ); |
873 } |
868 } |
874 |
869 |
875 @Override |
870 @Override |
876 public File execute(Map<String, ? super Object> params, |
871 public File execute(Map<String, ? super Object> params, |
877 File outputParentDir) { |
872 File outputParentDir) throws PackagerException { |
878 return bundle(params, outputParentDir); |
873 return bundle(params, outputParentDir); |
879 } |
874 } |
880 |
875 |
881 @Override |
876 @Override |
882 public boolean supported() { |
877 public boolean supported() { |
890 return bi.getWidth(); |
885 return bi.getWidth(); |
891 } else { |
886 } else { |
892 return 0; |
887 return 0; |
893 } |
888 } |
894 } catch (Exception e) { |
889 } catch (Exception e) { |
895 e.printStackTrace(); |
890 Log.verbose(e); |
896 return 0; |
891 return 0; |
897 } |
892 } |
898 } |
893 } |
899 } |
894 } |