问题描述
我已经使用以下命令进行dmg文件附加和detech
I have used the following command for dmg file attach and detech
hdiutil attach installer.dmg
hdiutil detach installer.dmg
在dmg文件中,它包含test.appGUI模式安装,我可以将test.app拖动到应用程序位置
in the dmg file it contains test.app GUI mode installation, i can drag the test.app to application location
我需要的是当我双击脚本时,包含该应用程序的dmg应该自动安装到
What i need is when i double-click the script, dmg containing the app should install automatically to
该终端窗口之后在Mac OS X中的应用程序位置应自动关闭
application location in mac os x after that terminal window should automatically closed
预先感谢您的回答
推荐答案
好吧,如下所示的shell脚本就可以完成这项工作:
well, a shell script like the following should do the job:
#/bin/sh
VOLUME=`hdiutil attach $1 | grep Volumes | awk '{print $3}'`
cp -rf $VOLUME/*.app /Applications
hdiutil detach $VOLUME
您可以通过以下方式运行它:
and you can run it that way:
% install_app.sh ~/Downloads/MyApp.dmg
请注意,我没有在该小脚本中检查任何参数,并且任何同名现有应用都将被覆盖.
be aware that I'm doing no argument checking in that little script, and that any existing app with the same name will get overwritten.
HTH
这篇关于如何在Mac OS X系统中静默安装dmg文件(使用Shell脚本)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!