< prev index next >

src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxRpmBundler.java

Print this page

        

*** 47,67 **** private static final ResourceBundle I18N = ResourceBundle.getBundle( "jdk.jpackage.internal.resources.LinuxResources"); public static final BundlerParamInfo<LinuxAppBundler> APP_BUNDLER = new StandardBundlerParam<>( - I18N.getString("param.rpm-app-bundler.name"), - I18N.getString("param.rpm-app-bundler.description"), "linux.app.bundler", LinuxAppBundler.class, params -> new LinuxAppBundler(), null); public static final BundlerParamInfo<File> RPM_IMAGE_DIR = new StandardBundlerParam<>( - I18N.getString("param.image-dir.name"), - I18N.getString("param.image-dir.description"), "linux.rpm.imageDir", File.class, params -> { File imagesRoot = IMAGES_ROOT.fetchFrom(params); if (!imagesRoot.exists()) imagesRoot.mkdirs(); --- 47,63 ----
*** 80,91 **** private static final Pattern RPM_BUNDLE_NAME_PATTERN = Pattern.compile("[a-z\\d\\+\\-\\.\\_]+", Pattern.CASE_INSENSITIVE); public static final BundlerParamInfo<String> BUNDLE_NAME = new StandardBundlerParam<> ( - I18N.getString("param.bundle-name.name"), - I18N.getString("param.bundle-name.description"), Arguments.CLIOptions.LINUX_BUNDLE_NAME.getId(), String.class, params -> { String nm = APP_NAME.fetchFrom(params); if (nm == null) return null; --- 76,85 ----
*** 108,129 **** } ); public static final BundlerParamInfo<String> LICENSE_TYPE = new StandardBundlerParam<>( - I18N.getString("param.license-type.name"), - I18N.getString("param.license-type.description"), Arguments.CLIOptions.LINUX_RPM_LICENSE_TYPE.getId(), String.class, params -> I18N.getString("param.license-type.default"), (s, p) -> s ); public static final BundlerParamInfo<String> XDG_FILE_PREFIX = new StandardBundlerParam<> ( - I18N.getString("param.xdg-prefix.name"), - I18N.getString("param.xdg-prefix.description"), "linux.xdg-prefix", String.class, params -> { try { String vendor; --- 102,119 ----
*** 314,324 **** LinuxAppBundler.getRootDir(RPM_IMAGE_DIR.fetchFrom(params), params); // prepare installer icon File iconTarget = getConfig_IconFile(rootDir, params); File icon = LinuxAppBundler.ICON_PNG.fetchFrom(params); ! if (!RUNTIME_INSTALLER.fetchFrom(params)) { if (icon == null || !icon.exists()) { fetchResource(iconTarget.getName(), I18N.getString("resource.menu-icon"), DEFAULT_ICON, iconTarget, --- 304,314 ---- LinuxAppBundler.getRootDir(RPM_IMAGE_DIR.fetchFrom(params), params); // prepare installer icon File iconTarget = getConfig_IconFile(rootDir, params); File icon = LinuxAppBundler.ICON_PNG.fetchFrom(params); ! if (!StandardBundlerParam.isRuntimeInstaller(params)) { if (icon == null || !icon.exists()) { fetchResource(iconTarget.getName(), I18N.getString("resource.menu-icon"), DEFAULT_ICON, iconTarget,
*** 334,367 **** } } StringBuilder installScripts = new StringBuilder(); StringBuilder removeScripts = new StringBuilder(); ! for (Map<String, ? super Object> secondaryLauncher : ! SECONDARY_LAUNCHERS.fetchFrom(params)) { ! Map<String, String> secondaryLauncherData = ! createReplacementData(secondaryLauncher); ! secondaryLauncherData.put("APPLICATION_FS_NAME", data.get("APPLICATION_FS_NAME")); ! secondaryLauncherData.put("DESKTOP_MIMES", ""); // prepare desktop shortcut Writer w = new BufferedWriter(new FileWriter( ! getConfig_DesktopShortcutFile(rootDir, secondaryLauncher))); String content = preprocessTextResource( getConfig_DesktopShortcutFile(rootDir, ! secondaryLauncher).getName(), I18N.getString("resource.menu-shortcut-descriptor"), ! DEFAULT_DESKTOP_FILE_TEMPLATE, secondaryLauncherData, VERBOSE.fetchFrom(params), RESOURCE_DIR.fetchFrom(params)); w.write(content); w.close(); // prepare installer icon ! iconTarget = getConfig_IconFile(rootDir, secondaryLauncher); ! icon = LinuxAppBundler.ICON_PNG.fetchFrom(secondaryLauncher); if (icon == null || !icon.exists()) { fetchResource(iconTarget.getName(), I18N.getString("resource.menu-icon"), DEFAULT_ICON, iconTarget, --- 324,357 ---- } } StringBuilder installScripts = new StringBuilder(); StringBuilder removeScripts = new StringBuilder(); ! for (Map<String, ? super Object> addLauncher : ! ADD_LAUNCHERS.fetchFrom(params)) { ! Map<String, String> addLauncherData = ! createReplacementData(addLauncher); ! addLauncherData.put("APPLICATION_FS_NAME", data.get("APPLICATION_FS_NAME")); ! addLauncherData.put("DESKTOP_MIMES", ""); // prepare desktop shortcut Writer w = new BufferedWriter(new FileWriter( ! getConfig_DesktopShortcutFile(rootDir, addLauncher))); String content = preprocessTextResource( getConfig_DesktopShortcutFile(rootDir, ! addLauncher).getName(), I18N.getString("resource.menu-shortcut-descriptor"), ! DEFAULT_DESKTOP_FILE_TEMPLATE, addLauncherData, VERBOSE.fetchFrom(params), RESOURCE_DIR.fetchFrom(params)); w.write(content); w.close(); // prepare installer icon ! iconTarget = getConfig_IconFile(rootDir, addLauncher); ! icon = LinuxAppBundler.ICON_PNG.fetchFrom(addLauncher); if (icon == null || !icon.exists()) { fetchResource(iconTarget.getName(), I18N.getString("resource.menu-icon"), DEFAULT_ICON, iconTarget,
*** 380,406 **** installScripts.append("xdg-desktop-menu install --novendor "); installScripts.append(LINUX_INSTALL_DIR.fetchFrom(params)); installScripts.append("/"); installScripts.append(data.get("APPLICATION_FS_NAME")); installScripts.append("/"); ! installScripts.append(secondaryLauncherData.get( "APPLICATION_LAUNCHER_FILENAME")); installScripts.append(".desktop\n"); // preun cleanup of desktop icon removeScripts.append("xdg-desktop-menu uninstall --novendor "); removeScripts.append(LINUX_INSTALL_DIR.fetchFrom(params)); removeScripts.append("/"); removeScripts.append(data.get("APPLICATION_FS_NAME")); removeScripts.append("/"); ! removeScripts.append(secondaryLauncherData.get( "APPLICATION_LAUNCHER_FILENAME")); removeScripts.append(".desktop\n"); } ! data.put("SECONDARY_LAUNCHERS_INSTALL", installScripts.toString()); ! data.put("SECONDARY_LAUNCHERS_REMOVE", removeScripts.toString()); StringBuilder cdsScript = new StringBuilder(); data.put("APP_CDS_CACHE", cdsScript.toString()); --- 370,396 ---- installScripts.append("xdg-desktop-menu install --novendor "); installScripts.append(LINUX_INSTALL_DIR.fetchFrom(params)); installScripts.append("/"); installScripts.append(data.get("APPLICATION_FS_NAME")); installScripts.append("/"); ! installScripts.append(addLauncherData.get( "APPLICATION_LAUNCHER_FILENAME")); installScripts.append(".desktop\n"); // preun cleanup of desktop icon removeScripts.append("xdg-desktop-menu uninstall --novendor "); removeScripts.append(LINUX_INSTALL_DIR.fetchFrom(params)); removeScripts.append("/"); removeScripts.append(data.get("APPLICATION_FS_NAME")); removeScripts.append("/"); ! removeScripts.append(addLauncherData.get( "APPLICATION_LAUNCHER_FILENAME")); removeScripts.append(".desktop\n"); } ! data.put("ADD_LAUNCHERS_INSTALL", installScripts.toString()); ! data.put("ADD_LAUNCHERS_REMOVE", removeScripts.toString()); StringBuilder cdsScript = new StringBuilder(); data.put("APP_CDS_CACHE", cdsScript.toString());
*** 542,552 **** data.put("FILE_ASSOCIATION_REMOVE", deregistrations.toString()); data.put("DESKTOP_MIMES", desktopMimes.toString()); } } ! if (!RUNTIME_INSTALLER.fetchFrom(params)) { //prepare desktop shortcut Writer w = new BufferedWriter(new FileWriter( getConfig_DesktopShortcutFile(rootDir, params))); String content = preprocessTextResource( getConfig_DesktopShortcutFile(rootDir, params).getName(), --- 532,542 ---- data.put("FILE_ASSOCIATION_REMOVE", deregistrations.toString()); data.put("DESKTOP_MIMES", desktopMimes.toString()); } } ! if (!StandardBundlerParam.isRuntimeInstaller(params)) { //prepare desktop shortcut Writer w = new BufferedWriter(new FileWriter( getConfig_DesktopShortcutFile(rootDir, params))); String content = preprocessTextResource( getConfig_DesktopShortcutFile(rootDir, params).getName(),
*** 593,603 **** data.put("APPLICATION_LICENSE_FILE", getLicenseFileString(params)); String deps = LINUX_PACKAGE_DEPENDENCIES.fetchFrom(params); data.put("PACKAGE_DEPENDENCIES", deps.isEmpty() ? "" : "Requires: " + deps); data.put("RUNTIME_INSTALLER", ! RUNTIME_INSTALLER.fetchFrom(params).toString()); return data; } private File getConfig_DesktopShortcutFile(File rootDir, Map<String, ? super Object> params) { --- 583,593 ---- data.put("APPLICATION_LICENSE_FILE", getLicenseFileString(params)); String deps = LINUX_PACKAGE_DEPENDENCIES.fetchFrom(params); data.put("PACKAGE_DEPENDENCIES", deps.isEmpty() ? "" : "Requires: " + deps); data.put("RUNTIME_INSTALLER", ! StandardBundlerParam.isRuntimeInstaller(params).toString()); return data; } private File getConfig_DesktopShortcutFile(File rootDir, Map<String, ? super Object> params) {
*** 618,628 **** File outdir) throws IOException { Log.verbose(MessageFormat.format(I18N.getString( "message.outputting-bundle-location"), outdir.getAbsolutePath())); ! File broot = new File(BUILD_ROOT.fetchFrom(params), "rmpbuildroot"); outdir.mkdirs(); //run rpmbuild ProcessBuilder pb = new ProcessBuilder( --- 608,618 ---- File outdir) throws IOException { Log.verbose(MessageFormat.format(I18N.getString( "message.outputting-bundle-location"), outdir.getAbsolutePath())); ! File broot = new File(TEMP_ROOT.fetchFrom(params), "rmpbuildroot"); outdir.mkdirs(); //run rpmbuild ProcessBuilder pb = new ProcessBuilder(
< prev index next >