创建 .DMG
我想为我的 Mac 项目创建 dmg 文件。 有人可以告诉我该怎么做吗? 这是我的第一个 Mac 项目,我不知道如何继续。 我还想为用户提供在启动时运行应用程序的选项。 我该怎么做呢?
谢谢。
PS 我还想添加自定义许可协议。
I want to create a dmg file for my Mac project. Can someone please tell me how to do this? This being my first Mac project, I do not have any idea how to proceed. I also want to give the user an option of running the app on start-up. How do I do this?
Thanks.
P.S. I also want to add a custom license agreement.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
要手动执行此操作:
方法 1:
/Applications/Utilities/
中)Cmd + Shift + N
)< a href="https://i.sstatic.net/cgTGZ.png" rel="noreferrer">
方法 2:
执行诸如设置背景图像之类的操作可能有点复杂(您基本上是添加背景图像到 DMG,设置 Windows 属性以使用该图像,使用命令行将背景图像从
background.png
移动到.background.png
以使其隐藏)我会推荐 iDMG,它让事情变得不那么乏味。
您还可以使用命令
hdiutil
编写 DMG 创建脚本。 类似于至于自定义许可协议,您应该查看开发人员工具“PackageMaker”中包含的工具 - 它非常不言自明。 它位于
/Developers/Application/Utilities/
To do this manually:
Method 1:
/Applications/Utilities/
)Cmd + Shift + N
)Method 2:
To do things like setting a background image can be a bit convoluted (You basically add the background image to the DMG, set the windows properties to use that image, using the command line you move the background image from
background.png
to.background.png
to make it hidden)I would recommend iDMG, which makes things a bit less tedious.
You can also script the creation of DMGs using the command
hdiutil
. Something along the lines ofAs for the custom license agreement, you should look into the tool included with the Developer Tools "PackageMaker" - it's pretty self-explanatory. It's in
/Developers/Application/Utilities/
如果您需要将自定义 EULA 添加到磁盘映像,本页介绍了如何使用命令行工具执行此操作。 其要点是使用 Apple 的 slas_for_udifs_1.0.dmg 中提供的模板软件许可协议资源,使用您的 EULA 文本修改该资源,并将该资源注入回您的磁盘映像文件中。 (我在下面提供了简要说明,以防上述链接不可用,并更新步骤 1 中提供的搜索词。)
在终端中:
<块引用>
<前><代码>cd /Volumes/SLAs_for_UDIFs_1.0
DeRez SLA 资源 > /tmp/sla.r
在文本编辑器中编辑 /tmp/sla.r,更新
数据“TEXT”(5000,“英语 SLA”)
资源的内容以包含新的许可证文本。展开包含安装程序的磁盘映像文件:
<块引用>
hdiutil 展开 installer_image.dmg
将编辑好的许可证资源添加到镜像中:
<块引用>
Rez -a /tmp/sla.r -o installer_image.dmg
If you need to add a custom EULA to your disk image, this page describes how to do so using command-line tools. The gist of it is to use the template software licensing agreement resource provided in Apple's slas_for_udifs_1.0.dmg, modify the resource with your EULA text and inject the resource back into your disk image file. (I include brief instructions below in case the above link becomes unavailable, and to update the search term it provides in step 1.)
In Terminal:
Edit /tmp/sla.r in a text editor, updating the content of the
data 'TEXT' (5000, "English SLA")
resource to contain your new license text.Unflatten the disk image file that contains your installer:
Add the edited license resources to the image:
你为什么不直接从你的 xcode 项目运行一个脚本呢? 尝试这样的操作:
然后将脚本保存为“makeDMG.sh”之类的文件,并在目标中
选择添加->新构建阶段->运行脚本构建阶段
并将您的脚本拖入此构建阶段。
一旦你完成了所有这些,那么当你构建你的项目时,脚本将创建磁盘映像并将你的发布版本复制到其中...
当然,你应该为你的脚本添加香料...这三行只是原始的肉
ps:您的自定义 EULA 应该内置到您的 packagemaker 项目中(您也可以很好地编写脚本)
why don't you just run a script from your xcode project. try something like this:
then save your script as something like 'makeDMG.sh' and in your target,
select add->new build phase->run script build phase
and drag your script into this build phase.
once you've done all that, then when you build your project the script will create the disk image and copy your release build into it...
of course you should spice your script to flavor... these three lines are just the raw meat
ps: your custom EULA should get built into your packagemaker project (which you can also script very nicely)
我制作了一个小 bash 脚本来自动创建光盘映像。
它创建一个临时目录来存储所有需要的文件,然后将其导出到新的 DMG 文件中。 然后临时目录被删除。
您可以在构建过程结束时自动启动此脚本。
I made a little bash script to automate a disc image creation.
It creates a temporary directory to store all needed files then export it in a new DMG file. Temporary directory is then deleted.
You can automatically launch this script at the end of your build process.