[wpkg-users] dia uninstall

Mario Kerecki mario.kerecki at gallusentertainment.com
Thu Mar 17 22:11:17 CET 2011


On Thu, 2011-03-17 at 20:32 +0100, Rainer Meier wrote:
> Hi Mario,
> 
> On 17.03.2011 19:47, Mario Kerecki wrote:
> > I just installed dia according to the quickstart guide, the install went
> > perfectly, but the uninstall failed. 
> > 
> > I believe this is because we have winxp 64 bit and the variable in the
> > remove command does not point to the x86 directory on windows:
> > 
> > <remove cmd='%PROGRAMFILES%\dia\dia-0.97.1-1-uninstall.exe /S' />
> > 
> > I tried changing the line to this:
> > 
> > <remove cmd='C:\Program Files (x86)\dia\dia-0.97.1-uninstall.exe /S' />
> > 
> > but still no joy. This isn't terribly urgent, I just wanted to know how
> > to deal with both 32 bit and 64 bit programs prior to mass deploying
> > WPKG.
> 
> I am used to deploy a simple uninstall script at the application source folder
> which deals with any environment. In case of Dia I am placing the following code
> into "unattended-uninstall.cmd" and place it in my %SOFTWARE%\Dia folder. Feel
> free to use any name or location and then just refer to the script in your
> remove command so WPKG will execute it:
> 
> 
> ## BEGIN SCRIPT ##
> @echo off
> :: This ia a very simple uninstaller script which was written to just run an
> :: existing uninstaller in silent mode.
> 
> set EXIT_CODE=0
> 
> :: This is required to evaluate the target of %ProgramFiles% on 64-bit systems
> :: Please note that this is required only if you uninstall a 32-bit application.
> :: set PROGRAM_FILES=%ProgramFiles%
> :: if not "%ProgramFiles(x86)%" == "" set PROGRAM_FILES=%ProgramFiles(x86)%
> 
> :: Path where the uninstaller is located
> set APP_DIR=Dia
> 
> :: Options to be passed to the uninstaller in order to uninstall silently
> set OPTIONS=/S
> 
> 
> :: ############################################################################
> :: No need to change anything below this line (usually ;-))
> :: ############################################################################
> echo Removing Application
> setlocal enabledelayedexpansion
> 
> if not exist "%ProgramFiles%\%APP_DIR%" goto skip32bit
> for /f %%I IN ('dir /b "%ProgramFiles%\%APP_DIR%\dia*uninstall.exe"') DO (
>   start /wait "Uninstall" "%ProgramFiles%\%APP_DIR%\%%I" %OPTIONS%
>   if !ERRORLEVEL! GTR !EXIT_CODE! set EXIT_CODE=!ERRORLEVEL!
> )
> :skip32bit
> 
> if not exist "%ProgramFiles(x86)%\%APP_DIR%" goto skip64bit
> for /f %%I IN ('dir /b "%ProgramFiles(x86)%\%APP_DIR%\dia*uninstall.exe"') DO (
>   start /wait "Uninstall" "%ProgramFiles(x86)%\%APP_DIR%\%%I" %OPTIONS%
>   if !ERRORLEVEL! GTR !EXIT_CODE! set EXIT_CODE=!ERRORLEVEL!
> )
> :skip64bit
> 
> if %ERRORLEVEL% GTR 0 goto end
> if exist "%ProgramFiles%\%APP_DIR%" rd /s /q "%ProgramFiles%\%APP_DIR%"
> if exist "%ProgramFiles(x86)%\%APP_DIR%" rd /s /q "%ProgramFiles(x86)%\%APP_DIR%"
> 
> :end
> exit /B %EXIT_CODE%
> ## END SCRIPT ##
> 
> In fact the script is quite generic and I use it for any kind of programs which
> require the uninstaller to be called from %ProgramFiles%. Well, usually the for
> loop loops over unins*.exe. In case of dia it's naming scheme is slightly different.
> 
> Moreover the Dia uninstaller seem to have an issue. When you have a Dia
> installation which has been upgraded earlier you might have multiple
> dia-<version>-uninstall.exe uninstallers. The script will just call them all in
> order.
> 
> In addition the uninstaller seems to be partially broken. It does not remove the
> folders but removes the registry entries and files. So you end up with the
> folders and some DLL files left. To fix this I will remove the "Dia" folder
> after successful uninstall. A quick test on my machine showed that uninstall
> works perfectly here (except it leaves the Dia folder itself in %ProgramFiles%).
> It will most likely even work when Dia is available as 64-bit edition.
> 
> Feel free to paste this script into the WPKG wiki.
> 
> br,
> Rainer
> 

Thanks Rainer, I'll give it a try tomorrow and see how it goes...

cheers
-m




More information about the wpkg-users mailing list