On Sep 18, 2007, at 3:01 AM, Yun Zhi Lin wrote:
Hi all
Currently I have one distribution package and I do installation check in distribution script.
The structure of my install disk image is like:
<root of disk>
dist.mpkg
install.configuration
During installation, I need to read the install.configuration file and do some configuration jobs based on the content of this file. If the file is missing, I would like to stop the installation and give users some information about the error.
I try to check the existence of install.configuration in installation check. But unfortunately,I could not get the path to install package from distribution script.I search developer.apple.com but could not find answer. Does anyone know how to do this? Is there any other possible ways to solve my problem?
Your install.configuration file may be found based on the path to your executing InstallationCheck script. If it's in bash, for example, your installation.configuration file is in
"${0% /*}/../../../installation.configuration"
where
- ${0} is the full path to your script
- ${0%/*} means "everything in $0 but the last / and anything that comes after that", which is to say the directory where your script lives, which of course is .../dist.mpkg/Contents/Resources/.
- ../../../ gets you to the directory that contains dist.mpkg
I may not have that exactly right -- I checked on a simple pkg, not an mpkg -- but you can explore the layout of your mpkg and fix up the ../../ part appropriately.
To figure this out, I added this line to my own InstallationCheck script:
echo > /tmp/InstallationCheck.log PWD="$PWD" 0="$0" PKG="$PKG" DEST="$DEST" MOUNT="$MOUNT" ROOT="$ROOT"