139 } |
139 } |
140 return "Unknown"; |
140 return "Unknown"; |
141 }, |
141 }, |
142 (s, p) -> s); |
142 (s, p) -> s); |
143 |
143 |
144 private static final BundlerParamInfo<String> COPYRIGHT_FILE = |
|
145 new StandardBundlerParam<>( |
|
146 Arguments.CLIOptions.LINUX_DEB_COPYRIGHT_FILE.getId(), |
|
147 String.class, |
|
148 params -> null, |
|
149 (s, p) -> s); |
|
150 |
|
151 private final static String TOOL_DPKG_DEB = "dpkg-deb"; |
144 private final static String TOOL_DPKG_DEB = "dpkg-deb"; |
152 private final static String TOOL_DPKG = "dpkg"; |
145 private final static String TOOL_DPKG = "dpkg"; |
153 |
146 |
154 public static boolean testTool(String toolName, String minVersion) { |
147 public static boolean testTool(String toolName, String minVersion) { |
155 try { |
148 try { |
327 configDir.resolve("postinst"), |
320 configDir.resolve("postinst"), |
328 "resource.deb-postinstall-script").setExecutable()); |
321 "resource.deb-postinstall-script").setExecutable()); |
329 debianFiles.add(new DebianFile( |
322 debianFiles.add(new DebianFile( |
330 configDir.resolve("postrm"), |
323 configDir.resolve("postrm"), |
331 "resource.deb-postrm-script").setExecutable()); |
324 "resource.deb-postrm-script").setExecutable()); |
332 |
325 debianFiles.add(new DebianFile( |
333 getConfig_CopyrightFile(params).getParentFile().mkdirs(); |
326 getConfig_CopyrightFile(params).toPath(), |
334 String customCopyrightFile = COPYRIGHT_FILE.fetchFrom(params); |
327 "resource.copyright-file")); |
335 if (customCopyrightFile != null) { |
|
336 IOUtils.copyFile(new File(customCopyrightFile), |
|
337 getConfig_CopyrightFile(params)); |
|
338 } else { |
|
339 debianFiles.add(new DebianFile( |
|
340 getConfig_CopyrightFile(params).toPath(), |
|
341 "resource.copyright-file")); |
|
342 } |
|
343 |
328 |
344 for (DebianFile debianFile : debianFiles) { |
329 for (DebianFile debianFile : debianFiles) { |
345 debianFile.create(data, params); |
330 debianFile.create(data, params); |
346 } |
331 } |
347 } |
332 } |