2

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> 
Brian Knoblauch
  • 20,639
  • 15
  • 57
  • 92
  • For the note: http://stackoverflow.com/questions/7412783/izpack-creates-an-uninstaller-that-doesnt-work-in-windows-programs-and-feature – Anya Shenanigans Jul 02 '14 at 15:12

1 Answers1

2

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.

sunbabaphu
  • 1,473
  • 1
  • 10
  • 15
  • No luck on the privileged installer setting it to an exact version and trying on matching OS. Escalates fine on install, but fails to on uninstall. The info I used to generate my install.xml is at: http://izpack.org/documentation/installation-files.html "Built-in Conditions" there lists izpack.windowsinstall as a legitimate condition code too. No uninstaller line at all in my file, so it should default to "no", which allows escalation. Have not tried the registry stuff yet, but looks promising! – Brian Knoblauch Jul 02 '14 at 18:00
  • My IzPack installation doesn't seem to have COIOSHelper.dll (or x64) to enable the registry editing. I've been googling around, but I can't seem to find those, so I can't get the registry stuff working either. :-( – Brian Knoblauch Jul 02 '14 at 18:21
  • 1
    here: http://svn.codehaus.org/izpack-svn/izpack-src/trunk/src/native/COIOSHelper/src/lib/ i would still suggest using izpack.windowsinstall.XYZ – sunbabaphu Jul 02 '14 at 19:26
  • 1
    although not great timing for this suggestion, but refer this- http://izpack.org/documentation/advanced-features.html#automatic-privileges-elevation-on-windows .. i've read about cases where people use launch4j to package the `uninstaller.jar` in a `*_setup.exe` file specifically for this privilege issue – sunbabaphu Jul 02 '14 at 19:48
  • Our old installer we had the .exe launch method (and unfortunately the XML files all vanished from our server so long ago that they're no longer on any existing backups, hence why I'm having to build all new again). I'm trying to avoid that .exe launcher in this case though, since it means I have to build distinct launchers for Windows vs. the other platforms instead of just using a single .jar. – Brian Knoblauch Jul 02 '14 at 19:50
  • Ah ha. There seems to be some syntax changes between the versions I've found on the web and what I've got... Install to registry works perfect now. Uninstaller (via control panel) works fine to remove all app files even though it doesn't if you run the uninstaller manually. That's fine, I just won't install an icon for the uninstaller in the start menu. Oddly, the uninstaller doesn't remove the entry from the control panel though. – Brian Knoblauch Jul 02 '14 at 20:05
  • did you include `RegistryUninstallerListener` ? – sunbabaphu Jul 02 '14 at 20:06
  • 1
    "" from above. Is that correct syntax? – Brian Knoblauch Jul 02 '14 at 20:23
  • do the entries get removed from the **Registry** – sunbabaphu Jul 02 '14 at 21:01
  • Well, it might just be a problem with my Windows 7 test box. The registry does NOT get updated on uninstall there. However, it works perfectly in my Vista and 8.1 test boxes. I'll reformat the 7 test box and try again. :-) – Brian Knoblauch Jul 03 '14 at 20:15
  • 1
    fortunately/unfortunately IzPack involves a lot of hit-n-trial. i'd suggest you compare your files/code with izpack's own installer `izpack-x.x.x.jar` to proceed. – sunbabaphu Jul 03 '14 at 20:57