I have my product installer working nicely using pkgbuild and productbuild. However, now I am trying to figure out how to make my installer also function as an uninstaller. I am able to display an uninstall choice for the user by modifying my distribution.xml file, like this:
<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 pick uninstall, I need my postinstall script to somehow know which choice they picked. I don't see any way for the postinstall script to know this - there's nothing in the environment variables to indicate this, nor is it contained in the parameters that are passed to my script.
It occurred to me that I could write a separate uninstall package, with its own separate postinstall script, and then include that as a component with my overall product, but that just seems like a lot of extra setup work.
What if there were minor behavior differences based on the install choices that a user makes? Do I need to make a separate package component for each choice?
Is there a good solution for this that doesn't require an extra component package, or should I just make separate component packages for install / uninstall?
productbuild
to create my installer, and I'd like to add uninstaller as well. – Cacilie