如何在 Mac OS X 上的 install4j 安装程序末尾 运行 shell 脚本
How to run a shell script at the end of an install4j installer on Mac OS X
我正在尝试使用 install4j 为我的 jar 创建一个安装程序,我能够为 windows 安装程序启动一个批处理文件并在安装结束时启动它,但我无法mac os 这样做。我什至尝试过自定义脚本,但我仍然无法实现。
这里是自定义代码
Process proc=null;
if(Util.isMacOS())
{
String certificatePath = context.getInstallationDirectory()+"/certificates/DCU.cer";
String commandToRun = "sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain "+certificatePath;
proc= Runtime.getRuntime().exec(commandToRun);
}
if(proc!=null)
{
return true;
}
else
{
return false;
}
我如何让它工作,或者有任何其他方法可以使用 install4j?
您应该使用 "Run executable or batch file" 操作来调用另一个可执行文件。然后你也可以重定向 stderr 并查看命令打印错误。
我正在尝试使用 install4j 为我的 jar 创建一个安装程序,我能够为 windows 安装程序启动一个批处理文件并在安装结束时启动它,但我无法mac os 这样做。我什至尝试过自定义脚本,但我仍然无法实现。
这里是自定义代码
Process proc=null;
if(Util.isMacOS())
{
String certificatePath = context.getInstallationDirectory()+"/certificates/DCU.cer";
String commandToRun = "sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain "+certificatePath;
proc= Runtime.getRuntime().exec(commandToRun);
}
if(proc!=null)
{
return true;
}
else
{
return false;
}
我如何让它工作,或者有任何其他方法可以使用 install4j?
您应该使用 "Run executable or batch file" 操作来调用另一个可执行文件。然后你也可以重定向 stderr 并查看命令打印错误。