请选择 进入手机版 | 继续访问电脑版

苹果发烧友论坛

 找回密码
 注册
查看: 3855|回复: 5

[OSX 系统] 10.6 automator创建光盘镜像

[复制链接]
发表于 2010-8-5 16:54:11 | 显示全部楼层 |阅读模式
本帖最后由 aj001 于 2010-8-5 17:11 编辑

作者:不详      翻译:AJ001



我喜欢Disk Utility,然而他不直接支持创建ISO 9660 光盘镜像。他可以创建CDR 或者CD/DVD镜像。他们可以重命名.ISO文件并且被大多数软件所支持。但是至少不是很方便。

一些搜索告诉我们可以通过 hdiut终端创建ISO镜像。

终端命令如下:
hdiutil makehybrid -o ~/Desktop/Diskimage.iso ${diskName} -iso -joliet


然而这使事情变得很复杂。所以我通过添加 'Run Shellscript' 命令来实现自动化。
  1. echo -n `date "+%Y-%m-%d - %H:%M:%S ->"` >> ~/iso.log
  2. echo "Starting ISO creation" >> ~/iso.log

  3. diskName=$(drutil status | grep "Name:" | awk '{print $4}')

  4. echo -n `date "+%Y-%m-%d - %H:%M:%S ->"` >> ~/iso.log
  5. echo "Device: ${diskName}" >> ~/iso.log

  6. echo -n `date "+%Y-%m-%d - %H:%M:%S ->"` >> ~/iso.log
  7. echo `diskutil umountDisk ${diskName}` >> ~/iso.log

  8. echo -n `date "+%Y-%m-%d - %H:%M:%S ->"` >> ~/iso.log
  9. echo "Starting copy action."

  10. echo `hdiutil makehybrid -o ~/Desktop/Diskimage.iso ${diskName} -iso -joliet` >> ~/iso.log

  11. echo -n `date "+%Y-%m-%d - %H:%M:%S ->"` >> ~/iso.log
  12. echo "Done" >> ~/iso.log
复制代码
这些脚本通过 drutil,发现光驱,然后通过diskutil卸载磁盘,然后通过hdiutil以及在使用者地址栏中的日志文件登陆进程来创建真正的光盘镜像


我在Application菜单中创建了一个Service (仅雪豹)。现在运行Service ,然后光盘镜像出现在我的电脑上,然后推出CD/DVD ,完成。





补充一句:原始的hdiutil命令在以前隐约提到过。使用Automato创建Service是对他一个简单的补充。



原文名字:10.6: Automate the creation of ISO images
原文作者:不详
原文链接:http://www.macosxhints.com/article.php?story=20100527035147137
  原文如下:
10.6: Automate the creation of ISO images
Jul 29, '10 07:45:00AM • Contributed by: ChrisAMS
I love Disk Utility, however, it does not directly support the creation of ISO 9660 images. It can create CDR images or CD/DVD master images. Those can be renamed to .iso files and are supported by most software. But that's inconvenient to say the least.

Some searching revealed that you can create ISO images using the Terminal through hdiutil.

The Terminal command is:
hdiutil makehybrid -o ~/Desktop/Diskimage.iso ${diskName} -iso -joliet

However that still leaves things complicated. So I put this in Automator by adding the 'Run Shellscript' action. echo -n `date "+%Y-%m-%d - %H:%M:%S ->"` >> ~/iso.logecho "Starting ISO creation" >> ~/iso.logdiskName=$(drutil status | grep "Name:" | awk '{print $4}')echo -n `date "+%Y-%m-%d - %H:%M:%S ->"` >> ~/iso.logecho "Device: ${diskName}" >> ~/iso.logecho -n `date "+%Y-%m-%d - %H:%M:%S ->"` >> ~/iso.logecho `diskutil umountDisk ${diskName}` >> ~/iso.logecho -n `date "+%Y-%m-%d - %H:%M:%S ->"` >> ~/iso.logecho "Starting copy action."echo `hdiutil makehybrid -o ~/Desktop/Diskimage.iso ${diskName} -iso -joliet` >> ~/iso.logecho -n `date "+%Y-%m-%d - %H:%M:%S ->"` >> ~/iso.logecho "Done" >> ~/iso.log
This script finds the superdrive by drutil, then unmounts the disk by diskutil, then makes the actual iso image by hdiutil and logs the process in a log file in the user directory.

I made this a Service in the Application menu (Snow Leopard only). Now I run the Service and the disk image appears on my desktop, when the CD/DVD ejects, it's done.

[crarko adds: The original command with hdiutil was mentioned previously in this hint. The use of Automator to create a Service is a handy addition to that.]
发表于 2010-8-8 17:16:55 | 显示全部楼层
好像把后缀改一下就行的吧!
回复 支持 反对

使用道具 举报

QQ|小黑屋|手机版|Archiver|苹果发烧友论坛 ( 京ICP备16012027号-3 )

GMT+8, 2017-10-23 02:55 , Processed in 0.010626 second(s), 7 queries , Xcache On.

Powered by Discuz! X3.3 Licensed

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表