Brian Knoblauch
Brian Knoblauch

Reputation: 21369

How do I get IzPack installed applications to uninstall on Windows?

My IzPack installation configuration is working well on Linux. Installation and uninstall both work as expected.

Installation also works fine on Windows, but uninstall doesn't work. The uninstaller that IzPack places on the system goes through the motions of working, but doesn't actually remove any files. I presume it's due to UAC blocking it, since if I open an administrator CLI and do a "java -jar uninstaller.jar" it works. Is there a configuration option to tell it to require privilege escalation on uninstall? I have <run-privileged condition="izpack.windowsinstall"/> in my install.xml already (it's required for installation to succeed, and the windows limitation is required for Linux installs to behave properly).

I also note that it doesn't show up in the "add/remove programs" section of Windows. Is there an easy configuration change to set that up (it's not worth it if it's a ton of custom code, but I'd like to support it if it's not too big a hassle)?

install.xml:

<?xml version="1.0" encoding="iso-8859-1" standalone="yes" ?>
<installation version="1.0">
    <info>
        <appname>Program</appname>
        <appversion>5.0</appversion>  
        <appsubpath>The Corporation</appsubpath>      
        <javaversion>1.7</javaversion>        
        <uninstaller name="uninstaller.jar" path="${INSTALL_PATH}/uninstaller" write="yes"/>
        <url>http://www.example.com</url>
        <run-privileged condition="izpack.windowsinstall"/>
        <pack200/>
    </info>
    <guiprefs width="640" height="480" resizable="no"/>
    <locale>
        <langpack iso3="eng"/>
    </locale>
    <resources>
        <res id="LicencePanel.licence" src="License.txt"/>
        <res id="InfoPanel.info" src="Readme.txt"/>
        <res src="shortcutSpec.xml" id="shortcutSpec.xml"/>
        <res src="unix_shortcutSpec.xml" id="unix_shortcutSpec.xml"/>
    </resources>    
    <native type="izpack" name="ShellLink.dll"/>
    <native type="izpack" name="ShellLink_x64.dll"/>
    <native type="3rdparty" name="COIOSHelper.dll" stage="both">
        <os family="windows"/>
    </native>
    <native type="3rdparty" name="COIOSHelper_x64.dll" stage="both">
        <os family="windows"/>
    </native>    
    <listeners>
        <listener installer="RegistryInstallerListener" uninstaller="RegistryUninstallerListener" >
            <os family="windows"/>
        </listener>
    </listeners>
    <panels>
        <panel classname="HelloPanel"/>
        <panel classname="InfoPanel"/>
        <panel classname="LicencePanel"/>
        <panel classname="TargetPanel"/>
        <panel classname="ShortcutPanel"/>
        <panel classname="PacksPanel"/>
        <panel classname="InstallPanel"/>
        <panel classname="FinishPanel"/>
    </panels>
    <packs>
        <pack name="Base" required="yes">
            <description>The base files</description>
            <file src="Readme.txt" targetdir="$INSTALL_PATH"/>
            <file src="License.txt" targetdir="$INSTALL_PATH"/>
            <file src="Program.jar" targetdir="$INSTALL_PATH"/>
            <file src="lib" targetdir="$INSTALL_PATH"/>
        </pack>
        <pack name="Manual" preselected="yes" required="no">
            <description>The documentation</description>
            <file src="Manual.pdf" targetdir="$INSTALL_PATH"/>
        </pack>         
    </packs>             
</installation> 

Upvotes: 2

Views: 4502

Answers (1)

sunbabaphu
sunbabaphu

Reputation: 1493

for listing in add/remove programs section, in windows, u'll need a RegistryInstaller/UninstallerListener which takes care of adding/removing registry entries as well as the add/remove-softwares section. See HERE

for uninstall-time privilege there's a resolved bug HERE with the following resolution: Fixed: the uninstaller is told to make an elevation only if the installer did a successful one. therefore, the uninstaller should escalate automatically (if the Installer did).
i have doubts about the condition izpack.windowsinstall actually working correctly.
HERE-in-the-doc it states that the Valid operating system names are izpack.windowsinstall.7, izpack.windowsinstall.vista, izpack.macinstall .. and i know that for XP NOT using <run-privileged/> works right. so do check this condition attribute. maybe you need to change that to actually provide admin permissions to the installer and therefore, automatically to the Uninstaller.

as for Is there a configuration option to tell it to require privilege escalation on uninstall?: well, there is an attribute (ironically, uninstaller="yes") that you can specify like this <run-privileged uninstaller="yes" condition.../>.
here uninstaller="yes" actually disables the privilege escalation for the Uninstaller, as per the documentation. so NOT using this attribute is what is required for the uninstaller to receive privilege escalation.

Upvotes: 2

Related Questions