Mac OS X - Modify an Installation with Scripts(1)

来源:互联网 发布:淘宝详情页的无线链接 编辑:程序博客网 时间:2024/05/16 12:55
While processing, the Installer.app will look for some name-predefined executables to process customized operation. Theoretically, users can use these executables to do everything they want. However, according to Apples's official documentation, there are two kind of actions discouraged to do:
1. fix issues such as incorrect file permissions
2. call any applications with UI
After some test, I found these two recommendations can be ignored until Tiger(10.4). It seems that the Apple takes it for furture compatibility.

You can refer "Software Distribution Legacy Guide" for details to utilize the scripts in installation. Here I want to note something not mentioned in the documentation or different with it.
1. $1($PACKAGE_PATH) should be the package file absolute path. however, if there is space among the path  string, Installer will take the last piece as the path. For example: Installer will cut "/Users/Admin/Projects/My Tools.mpkg" to "Tools.mpkg"

2. Relevant to the first one. If you want to specify a path containing space, you should use slash "/" to catenate     two pieces. For example: you should use "/Applications/My/ Tools.app/" instead of "/Applications/My Tools.app/"

3. The names of the predefined executables is case sensitive.
        VolumeCheck, InstallaionCheck
        preinstall, preupgrade, postinstall, postupgrade