8215241: Permissions are not set correctly on sub-folders in /Applications
Reviewed-by: herrick, almatvee
--- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacPkgBundler.java Wed Mar 27 18:08:53 2019 -0400
+++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacPkgBundler.java Thu Mar 28 08:08:07 2019 -0700
@@ -211,9 +211,7 @@
Map<String, String> data = new HashMap<>();
- data.put("DEPLOY_DAEMON_IDENTIFIER", getDaemonIdentifier(params));
- data.put("DEPLOY_LAUNCHD_PLIST_FILE",
- IDENTIFIER.fetchFrom(params).toLowerCase() + ".launchd.plist");
+ data.put("INSTALL_LOCATION", MAC_INSTALL_DIR.fetchFrom(params));
Writer w = new BufferedWriter(
new FileWriter(getScripts_PreinstallFile(params)));
@@ -378,6 +376,8 @@
patchCPLFile(cpl);
+ preparePackageScripts(params);
+
// build application package
pb = new ProcessBuilder("pkgbuild",
"--root",
@@ -386,6 +386,8 @@
MAC_INSTALL_DIR.fetchFrom(params),
"--component-plist",
cpl.getAbsolutePath(),
+ "--scripts",
+ SCRIPTS_DIR.fetchFrom(params).getAbsolutePath(),
appPKG.getAbsolutePath());
IOUtils.exec(pb, false);
--- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/postinstall.template Wed Mar 27 18:08:53 2019 -0400
+++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/postinstall.template Thu Mar 28 08:08:07 2019 -0700
@@ -1,6 +1,6 @@
#!/usr/bin/env sh
-set -e
-launchctl load "/Library/LaunchDaemons/DEPLOY_LAUNCHD_PLIST_FILE"
+chown -R root:wheel "INSTALL_LOCATION"
+chmod -R o+rX "INSTALL_LOCATION"
exit 0
--- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/preinstall.template Wed Mar 27 18:08:53 2019 -0400
+++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/preinstall.template Thu Mar 28 08:08:07 2019 -0700
@@ -1,8 +1,8 @@
#!/usr/bin/env sh
-set -e
-if launchctl list "DEPLOY_DAEMON_IDENTIFIER" &> /dev/null; then
- launchctl unload "/Library/LaunchDaemons/DEPLOY_LAUNCHD_PLIST_FILE"
+if [ ! -d "INSTALL_LOCATION" ]
+then
+ mkdir -p "INSTALL_LOCATION"
fi
exit 0