As I had to finally find out, the postflight script is also executed before receipts are received. So my solution to this problem is now the following:
I add postinstall scripts to my packages that read the DSTROOT environment variable set by the Mac OS installer and write them to a file in the temp shared folder:
echo "${DSTROOT}" > "${SHARED_INSTALLER_TEMP}/my_install_location"
, , postinstall script ( , , "", ), .
, , , . , , xcconfig (, , ):
pkgutil --pkg-info-plist my.package.bundle > "${SHARED_INSTALLER_TEMP}/tmp.plist"
if [ -e "${SHARED_INSTALLER_TEMP}/tmp.plist" ];
then
MY_PACKAGE_VOL=`/usr/libexec/PlistBuddy -c "Print :volume" "${SHARED_INSTALLER_TEMP}/tmp.plist"`
MY_PACKAGE_DIR=`/usr/libexec/PlistBuddy -c "Print :install-location" "${SHARED_INSTALLER_TEMP}/tmp.plist"`
MY_PACKAGE_DIR="${MY_PACKAGE_VOL}${MY_PACKAGE_DIR}"
fi
"" , , , temp :
if [ -e "${SHARED_INSTALLER_TEMP}/my_install_location" ];
then
MY_PACKAGE_DIR=`cat "${SHARED_INSTALLER_TEMP}/my_install_location"`
fi
...
Write the xcconfig file...
...
- , .