< prev index next >
src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxRpmBundler.java
Print this page
@@ -47,21 +47,17 @@
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();
@@ -80,12 +76,10 @@
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;
@@ -108,22 +102,18 @@
}
);
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;
@@ -314,11 +304,11 @@
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 (!StandardBundlerParam.isRuntimeInstaller(params)) {
if (icon == null || !icon.exists()) {
fetchResource(iconTarget.getName(),
I18N.getString("resource.menu-icon"),
DEFAULT_ICON,
iconTarget,
@@ -334,34 +324,34 @@
}
}
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",
+ 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"));
- secondaryLauncherData.put("DESKTOP_MIMES", "");
+ addLauncherData.put("DESKTOP_MIMES", "");
// prepare desktop shortcut
Writer w = new BufferedWriter(new FileWriter(
- getConfig_DesktopShortcutFile(rootDir, secondaryLauncher)));
+ getConfig_DesktopShortcutFile(rootDir, addLauncher)));
String content = preprocessTextResource(
getConfig_DesktopShortcutFile(rootDir,
- secondaryLauncher).getName(),
+ addLauncher).getName(),
I18N.getString("resource.menu-shortcut-descriptor"),
- DEFAULT_DESKTOP_FILE_TEMPLATE, secondaryLauncherData,
+ DEFAULT_DESKTOP_FILE_TEMPLATE, addLauncherData,
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);
+ 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,27 +370,27 @@
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(
+ 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(secondaryLauncherData.get(
+ removeScripts.append(addLauncherData.get(
"APPLICATION_LAUNCHER_FILENAME"));
removeScripts.append(".desktop\n");
}
- data.put("SECONDARY_LAUNCHERS_INSTALL", installScripts.toString());
- data.put("SECONDARY_LAUNCHERS_REMOVE", removeScripts.toString());
+ 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,11 +532,11 @@
data.put("FILE_ASSOCIATION_REMOVE", deregistrations.toString());
data.put("DESKTOP_MIMES", desktopMimes.toString());
}
}
- if (!RUNTIME_INSTALLER.fetchFrom(params)) {
+ 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,11 +583,11 @@
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());
+ StandardBundlerParam.isRuntimeInstaller(params).toString());
return data;
}
private File getConfig_DesktopShortcutFile(File rootDir,
Map<String, ? super Object> params) {
@@ -618,11 +608,11 @@
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");
+ File broot = new File(TEMP_ROOT.fetchFrom(params), "rmpbuildroot");
outdir.mkdirs();
//run rpmbuild
ProcessBuilder pb = new ProcessBuilder(
< prev index next >