< prev index next >
src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxDebBundler.java
Print this page
*** 47,58 ****
private static final ResourceBundle I18N = ResourceBundle.getBundle(
"jdk.jpackage.internal.resources.LinuxResources");
public static final BundlerParamInfo<LinuxAppBundler> APP_BUNDLER =
new StandardBundlerParam<>(
- I18N.getString("param.deb-app-bundler.name"),
- I18N.getString("param.deb-app-bundler.description"),
"linux.app.bundler",
LinuxAppBundler.class,
params -> new LinuxAppBundler(),
(s, p) -> null);
--- 47,56 ----
*** 67,78 ****
private static final Pattern DEB_BUNDLE_NAME_PATTERN =
Pattern.compile("^[a-z][a-z\\d\\+\\-\\.]+");
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);
--- 65,74 ----
*** 94,115 ****
return s;
});
public static final BundlerParamInfo<String> FULL_PACKAGE_NAME =
new StandardBundlerParam<> (
- I18N.getString("param.full-package-name.name"),
- I18N.getString("param.full-package-name.description"),
"linux.deb.fullPackageName",
String.class,
params -> BUNDLE_NAME.fetchFrom(params) + "-"
+ VERSION.fetchFrom(params),
(s, p) -> s);
public static final BundlerParamInfo<File> DEB_IMAGE_DIR =
new StandardBundlerParam<>(
- I18N.getString("param.image-dir.name"),
- I18N.getString("param.image-dir.description"),
"linux.deb.imageDir",
File.class,
params -> {
File imagesRoot = IMAGES_ROOT.fetchFrom(params);
if (!imagesRoot.exists()) imagesRoot.mkdirs();
--- 90,107 ----
*** 118,169 ****
},
(s, p) -> new File(s));
public static final BundlerParamInfo<File> APP_IMAGE_ROOT =
new StandardBundlerParam<>(
- I18N.getString("param.app-image-root.name"),
- I18N.getString("param.app-image-root.description"),
"linux.deb.imageRoot",
File.class,
params -> {
File imageDir = DEB_IMAGE_DIR.fetchFrom(params);
return new File(imageDir, LINUX_INSTALL_DIR.fetchFrom(params));
},
(s, p) -> new File(s));
public static final BundlerParamInfo<File> CONFIG_DIR =
new StandardBundlerParam<>(
- I18N.getString("param.config-dir.name"),
- I18N.getString("param.config-dir.description"),
"linux.deb.configDir",
File.class,
params -> new File(DEB_IMAGE_DIR.fetchFrom(params), "DEBIAN"),
(s, p) -> new File(s));
public static final BundlerParamInfo<String> EMAIL =
new StandardBundlerParam<> (
- I18N.getString("param.maintainer-email.name"),
- I18N.getString("param.maintainer-email.description"),
BundleParams.PARAM_EMAIL,
String.class,
params -> "Unknown",
(s, p) -> s);
public static final BundlerParamInfo<String> MAINTAINER =
new StandardBundlerParam<> (
- I18N.getString("param.maintainer-name.name"),
- I18N.getString("param.maintainer-name.description"),
Arguments.CLIOptions.LINUX_DEB_MAINTAINER.getId(),
String.class,
params -> VENDOR.fetchFrom(params) + " <"
+ EMAIL.fetchFrom(params) + ">",
(s, p) -> s);
public static final BundlerParamInfo<String> LICENSE_TEXT =
new StandardBundlerParam<> (
- I18N.getString("param.license-text.name"),
- I18N.getString("param.license-text.description"),
"linux.deb.licenseText",
String.class,
params -> {
try {
String licenseFile = LICENSE_FILE.fetchFrom(params);
--- 110,151 ----
*** 177,188 ****
},
(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;
--- 159,168 ----
*** 408,418 ****
File rootDir = LinuxAppBundler.getRootDir(APP_IMAGE_ROOT.fetchFrom(
params), params);
File iconTarget = getConfig_IconFile(rootDir, params);
File icon = ICON_PNG.fetchFrom(params);
! if (!RUNTIME_INSTALLER.fetchFrom(params)) {
// prepare installer icon
if (icon == null || !icon.exists()) {
fetchResource(iconTarget.getName(),
I18N.getString("resource.menu-icon"),
DEFAULT_ICON,
--- 388,398 ----
File rootDir = LinuxAppBundler.getRootDir(APP_IMAGE_ROOT.fetchFrom(
params), params);
File iconTarget = getConfig_IconFile(rootDir, params);
File icon = ICON_PNG.fetchFrom(params);
! if (!StandardBundlerParam.isRuntimeInstaller(params)) {
// prepare installer icon
if (icon == null || !icon.exists()) {
fetchResource(iconTarget.getName(),
I18N.getString("resource.menu-icon"),
DEFAULT_ICON,
*** 429,466 ****
}
}
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", "");
! if (!RUNTIME_INSTALLER.fetchFrom(params)) {
// 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 = ICON_PNG.fetchFrom(secondaryLauncher);
if (icon == null || !icon.exists()) {
fetchResource(iconTarget.getName(),
I18N.getString("resource.menu-icon"),
DEFAULT_ICON,
iconTarget,
--- 409,446 ----
}
}
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", "");
! if (!StandardBundlerParam.isRuntimeInstaller(params)) {
// 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 = ICON_PNG.fetchFrom(addLauncher);
if (icon == null || !icon.exists()) {
fetchResource(iconTarget.getName(),
I18N.getString("resource.menu-icon"),
DEFAULT_ICON,
iconTarget,
*** 481,506 ****
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");
// postrm 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());
List<Map<String, ? super Object>> associations =
FILE_ASSOCIATIONS.fetchFrom(params);
data.put("FILE_ASSOCIATION_INSTALL", "");
data.put("FILE_ASSOCIATION_REMOVE", "");
--- 461,486 ----
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");
// postrm 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());
List<Map<String, ? super Object>> associations =
FILE_ASSOCIATIONS.fetchFrom(params);
data.put("FILE_ASSOCIATION_INSTALL", "");
data.put("FILE_ASSOCIATION_REMOVE", "");
*** 638,648 ****
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(
--- 618,628 ----
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(
*** 755,765 ****
Long.toString(getInstalledSizeKB(params)));
String deps = LINUX_PACKAGE_DEPENDENCIES.fetchFrom(params);
data.put("PACKAGE_DEPENDENCIES",
deps.isEmpty() ? "" : "Depends: " + deps);
data.put("RUNTIME_INSTALLER",
! RUNTIME_INSTALLER.fetchFrom(params).toString());
return data;
}
private File getConfig_DesktopShortcutFile(File rootDir,
--- 735,745 ----
Long.toString(getInstalledSizeKB(params)));
String deps = LINUX_PACKAGE_DEPENDENCIES.fetchFrom(params);
data.put("PACKAGE_DEPENDENCIES",
deps.isEmpty() ? "" : "Depends: " + deps);
data.put("RUNTIME_INSTALLER",
! StandardBundlerParam.isRuntimeInstaller(params).toString());
return data;
}
private File getConfig_DesktopShortcutFile(File rootDir,
< prev index next >