为什么要做这个呢,由于BootCamp仅仅有在默认的Mac上才会有生成USB安装盘的选项。这个脚本就是为了确保用户使用它在不论什么一个Mac机器上都能够生成Windows的USB安装盘。当然了,假设你的Mac机器不支持使用USB启动,那么也是枉然。
这个脚本应该支持10.7.x到10.9.x的Boot Camp. 10.10DP2应该也能够。
Boot Camp.app应该在它默认的文件夹中。也就是/Applicaitons/Utilities/里面。
拷贝到一个文本文件,变更属性为能够执行,然后sudo执行之。
#!/bin/bash sudo killall "Boot Camp Assistant" BCA="/Applications/Utilities/Boot Camp Assistant.app/Contents/" ROMver=$(system_profiler | grep "Boot ROM Version:" | awk '{print $4}') Model=$(system_profiler | grep "Model Identifier:" | awk '{print $3}') ROMpar=$(echo $ROMver | awk -F. '{print $1}') if [ ! -e "$BCA/Contents/Info_backup.plist"]; then sudo cp "$BCA/Info.plist" "$BCA/Info_backup.plist" fi sudo /usr/libexec/PlistBuddy -c "add :DARequiredROMVersions:0 string '$ROMver'" "$BCA/Info.plist" sudo /usr/libexec/PlistBuddy -c "print USBBootSupportedModels" "$BCA/Info.plist" if [ $? != 0]; then # OS X 10.8.x & up to 10.9 sudo /usr/libexec/PlistBuddy -c "add :PreUSBBootSupportedModels:0 string '$Model'" "$BCA/Info.plist" sudo /usr/libexec/PlistBuddy -c "copy PreUSBBootSupportedModels USBBootSupportedModels" "$BCA/Info.plist" sudo codesign -fs - /Applications/Utilities/Boot Camp Assistant.app else # Lion OS X 10.7.x sudo /usr/libexec/PlistBuddy -c "add :USBBootSupportedModels:0 string '$ROMpar'" "$BCA/Info.plist" fi
恢复原样非常easy:
#!/bin/bash if [ -e "$BCA/Contents/Info_backup.plist" ]; then sudo cp "$BCA/Info_backup.plist" "$BCA/Info.plist" fi