I have my product installer working perfectly with pkgbuild and productbuild. However, now I am trying to figure out how to make my installer also a delete function. I can show the selection to delete for the user by changing my distribution.xml file, for example:
<choices-outline> <line choice="install"/> <line choice="uninstall"/> </choices-outline> <choice id="install" visible="true" title="Install" description="Installation description goes here"> <pkg-ref id="com.prosc.RemoteExecution.install.pkg">#installer.pkg</pkg-ref> </choice> <choice id="uninstall" visible="true" title="Uninstall" description="Uninstaller description goes here" start_selected="false"> <pkg-ref id="com.prosc.RemoteExecution.uninstall.pkg">#installer.pkg</pkg-ref> </choice>
But when they choose the removal, I need my postinstall script to somehow find out which choice they chose. I see no way for a postinstall script to know this - there is nothing in the environment variables to indicate this and is not contained in the parameters that are passed to my script.
It occurred to me that I could write a separate uninstall package with my own separate postinstall script, and then include this as a component with my common product, but that just looks like a lot of extra tweaks.
What if there were slight differences in behavior based on the installation options that the user makes? Do I need to make a separate package component for each choice?
Is there a good solution for this that does not require an additional component package, or should I just make separate component packages for installation / removal?
source share