使用 osacompile 制作的代码签名捆绑应用程序 [英] Code sign bundled app made with osacompile

查看:18
本文介绍了使用 osacompile 制作的代码签名捆绑应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图以编程方式在 Mac OS X 上实现这一点:桌面上的一个文件,单击该文件将启动具有特定配置文件的 Firefox.

Programmatically I trying to achieve this on Mac OS X: a file on desktop that when clicked will launch Firefox with a certain profile.

我用 AppleScript 和 bash 来做这件事.

I do this with AppleScript and bash.

  1. 打开脚本编辑器
  2. 编写一些AppleScript(做shell脚本/Applications/Firefox.app/Contents/MacOS/firefox -ProfileManager &>/dev/null &")
  3. 保存您的新 AppleScript > 另存为 > 应用程序包
  4. 设置图标

按照本教程手动操作非常好:Asa Dotzler 博客火狐快捷方式

This works perfectly fine manually it follows this tutorial: Asa Dotzler Blog Firefox Shortcut

但是在编程方面我遇到了一些问题.

However programmatically I'm having some problems.

我成功地制作了文件并使用 /bin/bash/osacompile - 将它放在桌面上.

I successfully make the file and put it on desktop with /bin/bash/osacompile -.

  1. 程序化步骤 1 - 在桌面上使用代码创建 script.txt 文件

  1. Programmatic Step 1 - create a script.txt file with the code on desktop

var path_src = OS.Path.join(
    OS.Constants.Path.desktopDir,
    'script.txt'
);
var path_exe = FileUtils.getFile('XREExeF', []).path;
var write_file = OS.File.writeAtomic(
    path_src,
    'do shell script "' + path_exe + ' -P -no-remote &> /dev/null &"'
);

  • 将 .txt 编译为 .app 并将其放在桌面代码上:

  • Compile the .txt to .app and put it on desktop code:

    var path_compile = OS.Path.join(OS.Constants.Path.desktopDir,'script.app');
    var osacompile = File.initWithPath("/usr/bin/osacompile");
    if (MacVersion <= 10.6) {
        osacompile.arguments = ["-o", path_compile, path_src]
    } else {
        //for >= 10.7
        osacompile.arguments = [
            "-t",
            "osas",
            "-c",
            "ToyS",
            "-o",
            path_compile,
            path_src
        ]
    }
    osacompile.run();
    

  • 但是当用户点击它时,他们得到这个错误:

    But when user clicks it they get this error:

    ""脚本"无法打开,因为它来自身份不明的开发人员."

    ""script" can't be opened because it is from an unidentified developer."

    图片:

    我听说这可能是代码签名的?我如何对其进行代码签名,以便绕过此错误并开始设置图标?

    I heard maybe this can be code signed? How can I code sign it so I can bypass this error and start working on setting icon?

    推荐答案

    一个简单的谷歌搜索applescript code sign"就会出现很多信息.

    A simple google search for "applescript code sign" turns up lots of info.

    另一种选择:如果代码要在您的计算机上运行,​​您只需关闭导致此问题的系统首选项即可.转到安全和隐私-> 常规并选择复选框允许从任何地方下载的应用程序".当然要意识到这将完全按照它所说的去做,所以这可能是一个安全问题.我以这种方式运行我的计算机,但您可能会有不同的感觉.

    Another option: if the code is to run on your computer you can just turn off the system preference that causes this. Go to Security & Privacy->General and choose the checkbox "allow apps downloaded from anywhere". Of course realize that this will do exactly what it says so it's a possible security issue. I run my computer this way but you may feel differently.

    因此,任何一种方法都可以解决您的问题.祝你好运.

    So either method will solve your issue. Good luck.

    这篇关于使用 osacompile 制作的代码签名捆绑应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆