XiZi's Blog
修改Mac安装盘,直接运行OSInstall.mpkg安装系统,到第二分区。
1、主要修改OSInstall.mpkg和BaseSystemResources.pkg两个文件(位于目录:System/Installation/Packages下面)。
2、修改OSInstall.mpkg,主要取消一些安装包没有但是在Distribution文件里面默认配置了,所以安装的时候提示出错。步骤如下
# 1. 创建OSInstall文件夹,并解压mpkg文件. 在这之前可能需要sudo获取root权限。 mkdir OSInstall cd OSInstall xar -x -f ../OSInstall.mpkg # 2. 用你喜欢的文本编辑器编辑Distribution文件,主要修改4个地方 ####(1)删除 eraseOptionAvailable="true" 是目标可以安装在MBR分区 @@ -1,6 +1,6 @@ <?xml version="1.0" standalone="yes"?> <installer-gui-script minSpecVersion="1"> - <options eraseOptionAvailable="true" hostArchitectures="i386" allow-external-scripts="yes"/> + <options hostArchitectures="i386" allow-external-scripts="yes"/> <title>MacOSX_Title</title> <license file="License.rtf"/> <conclusion file="Conclusion.rtfd"/> #### (2) 修改isSupportedPlatform函数直接返回true @@ -41,23 +41,7 @@ function isSupportedPlatform(){ - if( isVirtualMachine() ){ - return true; - } - - var platformSupportValues=["Mac-F2268DC8","Mac-F22C86C8","Mac-F22587C8","Mac-F2218FA9","Mac-F2218EA9","Mac-F42D86A9","Mac-F22C8AC8","Mac-F22586C8","Mac-942B59F58194171B","Mac-F226BEC8","Mac-F4218FC8","Mac-942459F5819B171B","Mac-7BA5B2794B2CDB12","Mac-F4218EC8","Mac-F2208EC8","Mac-F22C89C8","Mac-F22587A1","Mac-F221DCC8","Mac-F42388C8","Mac-F223BEC8","Mac-F4238CC8","Mac-F222BEC8","Mac-F227BEC8","Mac-F4208AC8","Mac-F22788A9","Mac-F4238BC8","Mac-F221BEC8","Mac-C08A6BB70A942AC2","Mac-8ED6AF5B48C039E1","Mac-F2238AC8","Mac-F4208EAA","Mac-F22788C8","Mac-F2268EC8","Mac-F2218EC8","Mac-F22589C8","Mac-F4228EC8","Mac-F22788AA","Mac-F42C86C8","Mac-F4208CA9","Mac-942C5DF58193131B","Mac-F2238BAE","Mac-F42289C8","Mac-F2268CC8","Mac-F4208DC8","Mac-F2218FC8","Mac-742912EFDBEE19B3","Mac-F4208DA9","Mac-F42D89C8","Mac-F4208CAA","Mac-F42D89A9","Mac-F2268AC8","Mac-F42C89C8","Mac-942452F5819B1C1B","Mac-F42786A9","Mac-F42D88C8","Mac-F42187C8","Mac-94245B3640C91C81","Mac-F42D86C8","Mac-4BC72D62AD45599E","Mac-F2268DAE","Mac-F42C8CC8","Mac-F42C88C8","Mac-94245A3940C91C80","Mac-F42386C8","Mac-942B5BF58194151B","Mac-F42189C8"]; - var boardID = system.ioregistry.fromPath('IOService:/')['board-id']; - - if( !boardID || platformSupportValues.length ==0 ) { - return false - } - for( var i = 0; i < platformSupportValues.length; i++ ){ - if( boardID == platformSupportValues[i] ){ - return true; - } - } - - return false; + return true; } ####(3)检查是否为Server版本系统 @@ -170,19 +154,9 @@ return false; } - // Media Snag Boot - } else if (system.env.__OSINSTALL_ENVIRONMENT == '1' && system.files.fileExistsAtPath("/System/Installation/Packages/OSInstall.mpkg")) { - - // Only allow install on server volumes if Server.app is installed - if (! system.files.bundleAtPath(my.target.mountpoint + "/Applications/Server.app")) { - - my.result.message = system.localizedString('VC_NeedServerApp_message'); - my.result.type = 'Fatal'; - return false; - } // Recovery HD - } else if (system.env.__OSINSTALL_ENVIRONMENT == '1' && ! system.files.fileExistsAtPath("/System/Installation/Packages/OSInstall.mpkg")) { + } else if (! system.files.fileExistsAtPath("/System/Installation/Packages/OSInstall.mpkg")) { // Block Server volumes my.result.message = system.localizedString('VC_CannotUpgradeServerRecovery_message'); ####(4)去掉没有的语言包制定 @@ -596,16 +543,6 @@ <pkg-ref id="com.apple.MacOSX.lang.tr" auth="root">Turkish.pkg</pkg-ref> <pkg-ref id="com.apple.MacOSX.lang.cs" auth="root">Czech.pkg</pkg-ref> <pkg-ref id="com.apple.pkg.ServerEssentials" auth="root">ServerEssentials.pkg</pkg-ref> - <pkg-ref id="com.apple.MacOSX.lang.th" auth="root">Thai.pkg</pkg-ref> - <pkg-ref id="com.apple.MacOSX.lang.ca" auth="root">Catalan.pkg</pkg-ref> - <pkg-ref id="com.apple.MacOSX.lang.hr" auth="root">Croatian.pkg</pkg-ref> - <pkg-ref id="com.apple.MacOSX.lang.el" auth="root">Greek.pkg</pkg-ref> - <pkg-ref id="com.apple.MacOSX.lang.he" auth="root">Hebrew.pkg</pkg-ref> - <pkg-ref id="com.apple.MacOSX.lang.ro" auth="root">Romanian.pkg</pkg-ref> - <pkg-ref id="com.apple.MacOSX.lang.sk" auth="root">Slovak.pkg</pkg-ref> - <pkg-ref id="com.apple.MacOSX.lang.uk" auth="root">Ukrainian.pkg</pkg-ref> - <pkg-ref id="com.apple.mpkg.OSInstall" auth="root" version="10.7.0">OSInstall.mpkg</pkg-ref> - <system-image id="com.apple.dmg.MacOSX">BaseSystem.dmg</system-image> <pkg-ref id="com.apple.MacOSX.lang.ar" installKBytes="50124" version="10.7.0.1.1.1306847324"/> <pkg-ref id="com.apple.MacOSX.lang.ca" installKBytes="75279" version="10.7.0.1.1.1306847324"/> <pkg-ref id="com.apple.MacOSX.lang.cs" installKBytes="42768" version="10.7.0.1.1.1306847324"/> #3. 重新打包OSInstall.mpkg xar -c -f ../OSInstall.mpkg *
3. 修改BaseSystemResources.pkg
# 1. 创建BaseSystemResources文件夹,并解压mpkg文件. 在这之前可能需要sudo获取root权限。 mkdir BaseSystemResources cd BaseSystemResources xar -x -f ../BaseSystemResources.pkg # 2. 创建Payload文件 touch Payload # 3. 重新打包 xar -c -f ../BaseSystemResources.pkg *