sdk installer: fix permissions issues on JRE and Blender executables
This commit is contained in:
parent
22540c9812
commit
3cf85668d1
@ -1,8 +1,11 @@
|
||||
package org.mycompany;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
import org.netbeans.installer.product.Registry;
|
||||
import org.netbeans.installer.product.components.Product;
|
||||
import org.netbeans.installer.product.components.ProductConfigurationLogic;
|
||||
import org.netbeans.installer.utils.LogManager;
|
||||
import org.netbeans.installer.utils.helper.RemovalMode;
|
||||
import org.netbeans.installer.utils.exceptions.InitializationException;
|
||||
import org.netbeans.installer.utils.exceptions.InstallationException;
|
||||
@ -35,6 +38,20 @@ public class ConfigurationLogic extends ProductConfigurationLogic {
|
||||
|
||||
@Override
|
||||
public void install(Progress progress) throws InstallationException {
|
||||
final Product product = getProduct();
|
||||
final File installLocation = product.getInstallationLocation();
|
||||
LogManager.log("Setting Blender files as executable");
|
||||
setExecutableFile(installLocation, "blender");
|
||||
setExecutableFile(installLocation, "blenderplayer");
|
||||
setExecutableFile(installLocation, "blender-softwaregl");
|
||||
}
|
||||
private static void setExecutableFile(File parent, String path) {
|
||||
File binFile = new File(parent, path);
|
||||
try {
|
||||
binFile.setExecutable(true, false);
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -198,16 +198,37 @@ public class ConfigurationLogic extends ProductConfigurationLogic {
|
||||
throw new InstallationException("Cannot copy JDK",e);
|
||||
}
|
||||
// set permissions:
|
||||
File binDir = new File(target, "bin");
|
||||
for (File file : binDir.listFiles()) {
|
||||
try {
|
||||
file.setExecutable(true);
|
||||
} catch (Exception ex) { ex.printStackTrace(); }
|
||||
}
|
||||
// ADDED BY KIRILL: force correct permissions for JDK files
|
||||
LogManager.log("Setting JDK files as executable");
|
||||
setExecutableContents(target, "bin");
|
||||
setExecutableContents(target, "db/bin");
|
||||
setExecutableContents(target, "jre/bin");
|
||||
setExecutableFile(target, "lib/jexec");
|
||||
setExecutableFile(target, "lib/amd64/libjawt.so");
|
||||
setExecutableFile(target, "lib/amd64/jli/libjli.so");
|
||||
setExecutableFile(target, "lib/visualvm/platform/lib/nbexec");
|
||||
// to add uninstaller logic:
|
||||
SystemUtils.getNativeUtils().addUninstallerJVM(new LauncherResource(false, target));
|
||||
}
|
||||
}
|
||||
private static void setExecutableContents(File parent, String path) {
|
||||
File binDir = new File(parent, path);
|
||||
for (File file : binDir.listFiles()) {
|
||||
try {
|
||||
file.setExecutable(true, false);
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
private static void setExecutableFile(File parent, String path) {
|
||||
File binFile = new File(parent, path);
|
||||
try {
|
||||
binFile.setExecutable(true, false);
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uninstall(Progress progress) throws UninstallationException {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user