Using OS X product build for uninstaller
Asked Answered
W

0

6

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?

Wares answered 15/3, 2013 at 11:56 Comment(9)
Now I'm discovering that I can't change the conclusion message conditionally based on a user choice, which means I probably need an entirely different double-clickable uninstaller, which a conclusion message saying "The software was successfully uninstalled." It seems pretty lame that I can't customize the conclusion message on the fly.Wares
Has anyone figured out how to make uninstaller?Augustine
We created a separate uninstaller package, and that is working. I never did figure out how to combine install and uninstall functionality in the same package using the Apple installer.Wares
You used productbuild tool? Do you execute a shell script in uninstaller?Augustine
It's been a while, but yes, I think so.Wares
Hi, I know it's been a long while, but did you find any suitable solution to your problem to combine both apps in on a single package ? I'm using productbuild to create my installer, and I'd like to add uninstaller as well.Cacilie
No, I didn't. We ship a separate uninstaller bundle.Wares
@JesseBarnum The problem with a seperate uninstaller is the title bar and the button is "Install" instead of "Uninstall". Is it possible to change that? #49643909Libeler
@Libeler No I have not solved that problemWares

© 2022 - 2024 — McMap. All rights reserved.