如何从命令行构建 Safari 扩展包?
而不是去 Extension Builder >构建包...,我想从 MyExtension.safariextension
文件夹构建一个 .safariextz
包。
我知道我可以使用 xar -xf 解压扩展。我怀疑返回的方式涉及使用 xar
打包它,但随后我需要进行代码签名,这可能涉及也可能不涉及 codesign(1)。
Instead of going to Extension Builder > Build Package…, I'd like to built a .safariextz
package from the MyExtension.safariextension
folder.
I know I can unpack an extension with xar -xf
. I suspect the way back involves packing it with xar
, but then I'll need to do the code signing thing, which may or may not involve codesign(1).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
以下是 Omar Ismail 的说明,省略了单独的 shell 脚本的需要。这一切都将发生在目录
safari/
中,我们将在其中对目录safari/appname.safariextension/
进行签名,使其成为扩展safari/appname.safariextz< /代码>。第一件事是使用扩展构建器的
构建包
以官方方式对扩展进行签名。设置 Xar:
1.下载并解压/untar
https://github.com/downloads/mackyle/xar/xar-1.6.1。 .tar.gz
到任何你想要可执行文件 xar-1.6.1 的地方(xar 1.6dev 不支持我们需要的选项)
2.在xar-1.6.1/中
设置你的证书:
1. 在 safari/
2. 打开“钥匙串访问”并将您的 Safari 开发者证书导出到 safari/certs/certs.p12(对 certs.p12 使用空白密码,然后使用 Mac 的密码导出证书)
3. 在 safari/certs/ 中,
您可以从
certs/cert.p12
获取证书,而不需要--extract-certs
步骤(因此不需要需要以官方方式构建扩展),但我对 openssl 不太了解,而且这只是为了您需要该步骤的设置。一切设置完毕后,签署扩展程序:
在 safari 中/
这一切都是在 2006 Snow Leopard MacBook 上进行的,因此在更新的计算机上情况可能会有所不同。
Here are Omar Ismail's instructions, omitting the need for separate shell scripts. This will all occur in a directory
safari/
, where we will be signing the directorysafari/appname.safariextension/
to become the extensionsafari/appname.safariextz
. The first thing is to sign the extension the official way, with Extension Builder'sBuild Package
.Set up Xar:
1. Download and unzip/untar
https://github.com/downloads/mackyle/xar/xar-1.6.1.tar.gz
to wherever you want the executable xar-1.6.1 (xar 1.6dev doesn't support the options we need)
2. in xar-1.6.1/
Set up your certificates:
1. in safari/
2. open Keychain Access and export your Safari Developer certificate to safari/certs/certs.p12 (use a blank password for certs.p12, and then use your Mac's password to export the cert)
3. in safari/certs/
It's possible that you can get the certificates from
certs/cert.p12
, and not need the--extract-certs
step (and hence not need the extension built the official way), but I don't know openssl well enough, and it's only for the set up that you need that step anyway.Once everything is set up, to sign the extension:
In safari/
This was all on a 2006 Snow Leopard MacBook, so it's possible things may be different on a machine that's more up to date.
看起来有一种方法可以使用签名选项来修补 XAR。 http://code.google.com/p/xar/问题/详细信息?id=76#c0
Looks like there is a way to patch XAR with a signature option. http://code.google.com/p/xar/issues/detail?id=76#c0