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;
|
package org.mycompany;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.netbeans.installer.product.Registry;
|
import org.netbeans.installer.product.Registry;
|
||||||
|
import org.netbeans.installer.product.components.Product;
|
||||||
import org.netbeans.installer.product.components.ProductConfigurationLogic;
|
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.helper.RemovalMode;
|
||||||
import org.netbeans.installer.utils.exceptions.InitializationException;
|
import org.netbeans.installer.utils.exceptions.InitializationException;
|
||||||
import org.netbeans.installer.utils.exceptions.InstallationException;
|
import org.netbeans.installer.utils.exceptions.InstallationException;
|
||||||
@ -35,6 +38,20 @@ public class ConfigurationLogic extends ProductConfigurationLogic {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void install(Progress progress) throws InstallationException {
|
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
|
@Override
|
||||||
|
@ -198,16 +198,37 @@ public class ConfigurationLogic extends ProductConfigurationLogic {
|
|||||||
throw new InstallationException("Cannot copy JDK",e);
|
throw new InstallationException("Cannot copy JDK",e);
|
||||||
}
|
}
|
||||||
// set permissions:
|
// set permissions:
|
||||||
File binDir = new File(target, "bin");
|
// ADDED BY KIRILL: force correct permissions for JDK files
|
||||||
for (File file : binDir.listFiles()) {
|
LogManager.log("Setting JDK files as executable");
|
||||||
try {
|
setExecutableContents(target, "bin");
|
||||||
file.setExecutable(true);
|
setExecutableContents(target, "db/bin");
|
||||||
} catch (Exception ex) { ex.printStackTrace(); }
|
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:
|
// to add uninstaller logic:
|
||||||
SystemUtils.getNativeUtils().addUninstallerJVM(new LauncherResource(false, target));
|
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
|
@Override
|
||||||
public void uninstall(Progress progress) throws UninstallationException {
|
public void uninstall(Progress progress) throws UninstallationException {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user