I am trying to build a mac package installer from a script and I want to run postinstall and postflight scripts. My script for building the package looks like this:
pkgbuild --root MyRoot/MyApp.app --identifier com.myapp.MyApp --scripts Scripts --install-location /Applications/MyApp.app MyApp.pkg
productbuild --synthesize --package MyApp.pkg Distribution.xml
productbuild --distribution Distribution.xml --resources Resources --package-path . CompleteInstaller.pkg
I've placed the postinstall script in Scripts and it is being executed successfully. I have a problem with running the postflight script though. It is placed in the Resources directory and doesn't get executed. Is this not enough to specify the path to it? I couldn't find an answer to this question, I'm sorry if I've missed it.
PS: My postflight script does nothing special - for now it tries to create a file in the home directory:
#!/bin/sh
touch ~/file
exit 0