Discussion:
InnoSetup Uninstall
le dahut
2009-12-08 16:51:42 UTC
Permalink
Hello,

I'm testing WPKG, I'm very happy with it but I've a little problem :
every InnoSetup doesn't uninstall correctly.
With "/VERYSILENT /NORESTART" or only with "/VERYSILENT" I get "exit
code=1". After this failed uninstall, only the file "unin000.exe" is
present in the application directory (%PROGRAMFILES%\myapp").

I thought it was a code to reboot but InnoSetup help says :
"""
Beginning with Inno Setup 4.0.8, the uninstaller will return a non-zero
exit code if the user cancels or a fatal error is encountered.
"""
so "1" is indicates uninstall has failed.

If I run it manually via command line I get exit code = 0.

Any idea ?

-------------------------------------------------------------------------
wpkg-users mailing list archives >> http://lists.wpkg.org/pipermail/wpkg-users/
le dahut
2009-12-09 08:40:13 UTC
Permalink
Post by le dahut
Hello,
every InnoSetup doesn't uninstall correctly.
With "/VERYSILENT /NORESTART" or only with "/VERYSILENT" I get "exit
code=1". After this failed uninstall, only the file "unin000.exe" is
present in the application directory (%PROGRAMFILES%\myapp").
"""
Beginning with Inno Setup 4.0.8, the uninstaller will return a non-zero
exit code if the user cancels or a fatal error is encountered.
"""
so "1" is indicates uninstall has failed.
If I run it manually via command line I get exit code = 0.
Any idea ?
I've build my own InnoSetup .exe file using one of the examples shipped
with InnoS. The result is the same : if I run the uninstall manually it
returns 0 as exit codes and if I run it via WPKG it returns 1 as exit code.


-------------------------------------------------------------------------
wpkg-users mailing list archives >> http://lists.wpkg.org/pipermail/wpkg-users/
Falko Trojahn
2009-12-09 08:50:03 UTC
Permalink
Bonjour!
Post by le dahut
Post by le dahut
every InnoSetup doesn't uninstall correctly.
With "/VERYSILENT /NORESTART" or only with "/VERYSILENT" I get "exit
code=1". After this failed uninstall, only the file "unin000.exe" is
present in the application directory (%PROGRAMFILES%\myapp").
"""
Beginning with Inno Setup 4.0.8, the uninstaller will return a
non-zero exit code if the user cancels or a fatal error is encountered.
"""
so "1" is indicates uninstall has failed.
If I run it manually via command line I get exit code = 0.
Any idea ?
I've build my own InnoSetup .exe file using one of the examples
shipped with InnoS. The result is the same : if I run the uninstall
manually it returns 0 as exit codes and if I run it via WPKG it
returns 1 as exit code.
If your check(s) work(s) correct and the software is really uninstalled
- don't care.

Others even use 'exit code="any"':

http://wpkg.org/R

Regards,
Falko

-------------------------------------------------------------------------
wpkg-users mailing list archives >> http://lists.wpkg.org/pipermail/wpkg-users/
le dahut
2009-12-09 16:45:29 UTC
Permalink
Post by Falko Trojahn
Bonjour!
Yes, you're right ! I wrote this mail at the end of a long day so
forgive me omitting this rules of polite society.
Post by Falko Trojahn
Post by le dahut
Post by le dahut
every InnoSetup doesn't uninstall correctly.
With "/VERYSILENT /NORESTART" or only with "/VERYSILENT" I get "exit
code=1". After this failed uninstall, only the file "unin000.exe" is
present in the application directory (%PROGRAMFILES%\myapp").
"""
Beginning with Inno Setup 4.0.8, the uninstaller will return a
non-zero exit code if the user cancels or a fatal error is encountered.
"""
so "1" is indicates uninstall has failed.
If I run it manually via command line I get exit code = 0.
Any idea ?
I've build my own InnoSetup .exe file using one of the examples
shipped with InnoS. The result is the same : if I run the uninstall
manually it returns 0 as exit codes and if I run it via WPKG it
returns 1 as exit code.
If your check(s) work(s) correct and the software is really uninstalled
- don't care.
http://wpkg.org/R
Regards,
Falko
InnoSetup says :
"""
Because Windows doesn't allow programs to delete their own EXEs, the
uninstaller creates and spawns a copy of itself in the TEMP directory.
This "clone" performs the actual uninstallation, and at the end,
terminates the original uninstaller EXE (at which point you get an exit
code back), deletes it, then displays the "uninstall complete" message box
"""

The problem is that the file "unin000.exe" is not deleted at the end of
uninstall.
I think the "exit code = 1" reflects that.

The side effect of this is that next time the application is installed,
it will generate an "unin001.exe" file (because a unin000.exe already
exists). And every time the app is installed/uninstalled it generates
"unin<prec_unin_number +1>.exe".

This makes next uninstall fail because "unin000.exe", as specified in
the "remove" section, is not the real uninstaller.

Since some applications are updated by :
* uninstall old version
* install new version
It should be better if the uninstall process returns 0


I've written a service that runs under SYSTEM account. It succeeds in
installing/uninstalling InnoSetup apps with exactly the same command
line as in <package>.xml.

Is it possible that WPKG puts its own lock on "unin000.exe" preventing
it to be erased ?


-------------------------------------------------------------------------
wpkg-users mailing list archives >> http://lists.wpkg.org/pipermail/wpkg-users/
Rainer Meier
2009-12-09 18:09:43 UTC
Permalink
Hi,
Post by le dahut
"""
Because Windows doesn't allow programs to delete their own EXEs, the
uninstaller creates and spawns a copy of itself in the TEMP directory.
This "clone" performs the actual uninstallation, and at the end,
terminates the original uninstaller EXE (at which point you get an exit
code back), deletes it, then displays the "uninstall complete" message box
"""
The problem is that the file "unin000.exe" is not deleted at the end of
uninstall.
I think the "exit code = 1" reflects that.
Oh, quite stupid way of doing it - from my point of view. Actually the
uninstaller could advise the OS to remove remaining files at next reboot and
return code 0 if there is only the unin000.exe running.
Post by le dahut
The side effect of this is that next time the application is installed,
it will generate an "unin001.exe" file (because a unin000.exe already
exists). And every time the app is installed/uninstalled it generates
"unin<prec_unin_number +1>.exe".
This makes next uninstall fail because "unin000.exe", as specified in
the "remove" section, is not the real uninstaller.
Uninstallation might be boxed into a small script which runs all available
unins*.exe scripts


@echo off
for /f "tokens=*" %%G in ('dir /b "%ProgramFiles%\program\unins*.exe"') DO %%G
exit /b 0


Actually I wrote another uninstall script I am using for some stupid
uninstallers which fork a sub-process...


@echo off

:: This script is an extended uninstaller script for programs which have tricky
:: uninstallers (e.g. VLC media player).
:: It is able to run an uninstaller application and then to monitor if the
:: uninstaller is erased from the system. Depending on the result (either
:: remove completes or timeout occurs) it exits with different ecit code:
:: code 0: all fine, program uninstalled
:: code 1: failed, uninstaller still exissts after timeout


:: 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=%PROGRAM_FILES%\dia

:: Path to the uninstaller (see path definition above)
set UNINSTALLER=%APP_DIR%\dia-0.96.1-9-uninstall.exe

:: 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 Program

if not exist "%UNINSTALLER%" goto good_end
start /wait "Uninstall" "%UNINSTALLER%" %OPTIONS%
REM Unfortunately the uninstaller seems to fork a child process and the parent
REM process exits immediately. So give it some time to uninstall
for /L %%C IN (1,1,30) DO (
if not exist "%UNINSTALLER%" goto good_end
ping -n 2 127.0.0.1 > NUL
)
:bad_end
exit /B 1

:good_end
if exist "%APP_DIR%" rmdir /s /q "%APP_DIR%"
exit /B 0


It supports 32-bit and 64-bit IS and you just need to fill the data in the header.
Well, this will not really work if the uninstlaler referred is not removed.

But this can be extended... just an (untested) example:



@echo off

:: This script is an extended uninstaller script for programs which have tricky
:: uninstallers (e.g. VLC media player).
:: It is able to run an uninstaller application and then to monitor if the
:: uninstaller is erased from the system. Depending on the result (either
:: remove completes or timeout occurs) it exits with different ecit code:
:: code 0: all fine, program uninstalled
:: code 1: failed, uninstaller still exissts after timeout


:: 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=%PROGRAM_FILES%\dia

:: Path to the file to be checked in order to detect if uninstall is complete
set APP_BIN=%APP_DIR%\app.exe

:: 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 Program

if not exist "%APP_BIN%" goto good_end
for /f "tokens=*" %%G in ('dir /b "%ProgramFiles%\program\unins*.exe"') DO start
/wait "uninstall" "%%G" %OPTIONS%

for /L %%C IN (1,1,30) DO (
if not exist "%APP_BIN%" goto good_end
ping -n 2 127.0.0.1 > NUL
)
:bad_end
exit /B 1

:good_end
if exist "%APP_DIR%" rmdir /s /q "%APP_DIR%"
exit /B 0
Post by le dahut
I've written a service that runs under SYSTEM account. It succeeds in
installing/uninstalling InnoSetup apps with exactly the same command
line as in <package>.xml.
Is it possible that WPKG puts its own lock on "unin000.exe" preventing
it to be erased ?
No. WPKG just executes the processes listed in XML package definition. The only
known issue we cannot work-around is a bug in Microsoft which makes the process
to get stuck if it prints more than 4k of data to STDOUT/STDERR. So just
redirect the output to NUL by appending " > NUL" to the command if in doubt.
Make sure to use the latest WPKG version (1.1.2).

br,
Rainer
-------------------------------------------------------------------------
wpkg-users mailing list archives >> http://lists.wpkg.org/pipermail/wpkg-users/
le dahut
2009-12-11 11:12:56 UTC
Permalink
I use the latest stable version of WPKG and WPKG Client.


For InnoSetup uninstall the following method succeeds :
* create a file \\<wpkg_server>\wpkg_share\softwares\mysoft\unin.bat
which calls '"%PROGRAMFILES%\Mysoft\unin000.exe" /VERYSILENT'
* use this .bat script in <remove> section of <package>.xml

With this method exit code is =0 and unin000.exe is deleted.


Seeing that I made some other tests :
* when unin000.exe is executed via another service (to be sure it is not
a BUILTIN\SYSTEM environment side effect) => uninstall OK
* when unin000.exe is executed via a .bat script => uninstall OK

* when calling manually 'cscript wpkg.js' as Administrator (with the
same option as in WPKG Cli) => uninstall OK
* when running 'cscript wpkg.js' (with the same option as in WPKG Cli)
from another service => uninstall OK

* when executed by WPKG Client service => uninstall FAILS !


For information, my "other service" is a NT service written in Python
and using "win32process.CreateProcess(None, cmd, ...)" to execute commands.


Hope this helps to debug WPKG Client.
Post by Rainer Meier
Hi,
Post by le dahut
"""
Because Windows doesn't allow programs to delete their own EXEs, the
uninstaller creates and spawns a copy of itself in the TEMP directory.
This "clone" performs the actual uninstallation, and at the end,
terminates the original uninstaller EXE (at which point you get an exit
code back), deletes it, then displays the "uninstall complete" message box
"""
The problem is that the file "unin000.exe" is not deleted at the end of
uninstall.
I think the "exit code = 1" reflects that.
Oh, quite stupid way of doing it - from my point of view. Actually the
uninstaller could advise the OS to remove remaining files at next reboot and
return code 0 if there is only the unin000.exe running.
Post by le dahut
The side effect of this is that next time the application is installed,
it will generate an "unin001.exe" file (because a unin000.exe already
exists). And every time the app is installed/uninstalled it generates
"unin<prec_unin_number +1>.exe".
This makes next uninstall fail because "unin000.exe", as specified in
the "remove" section, is not the real uninstaller.
Uninstallation might be boxed into a small script which runs all available
unins*.exe scripts
@echo off
for /f "tokens=*" %%G in ('dir /b "%ProgramFiles%\program\unins*.exe"') DO %%G
exit /b 0
Actually I wrote another uninstall script I am using for some stupid
uninstallers which fork a sub-process...
@echo off
:: This script is an extended uninstaller script for programs which have tricky
:: uninstallers (e.g. VLC media player).
:: It is able to run an uninstaller application and then to monitor if the
:: uninstaller is erased from the system. Depending on the result (either
:: code 0: all fine, program uninstalled
:: code 1: failed, uninstaller still exissts after timeout
:: 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=%PROGRAM_FILES%\dia
:: Path to the uninstaller (see path definition above)
set UNINSTALLER=%APP_DIR%\dia-0.96.1-9-uninstall.exe
:: 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 Program
if not exist "%UNINSTALLER%" goto good_end
start /wait "Uninstall" "%UNINSTALLER%" %OPTIONS%
REM Unfortunately the uninstaller seems to fork a child process and the parent
REM process exits immediately. So give it some time to uninstall
for /L %%C IN (1,1,30) DO (
if not exist "%UNINSTALLER%" goto good_end
ping -n 2 127.0.0.1 > NUL
)
:bad_end
exit /B 1
:good_end
if exist "%APP_DIR%" rmdir /s /q "%APP_DIR%"
exit /B 0
It supports 32-bit and 64-bit IS and you just need to fill the data in the header.
Well, this will not really work if the uninstlaler referred is not removed.
@echo off
:: This script is an extended uninstaller script for programs which have tricky
:: uninstallers (e.g. VLC media player).
:: It is able to run an uninstaller application and then to monitor if the
:: uninstaller is erased from the system. Depending on the result (either
:: code 0: all fine, program uninstalled
:: code 1: failed, uninstaller still exissts after timeout
:: 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=%PROGRAM_FILES%\dia
:: Path to the file to be checked in order to detect if uninstall is complete
set APP_BIN=%APP_DIR%\app.exe
:: 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 Program
if not exist "%APP_BIN%" goto good_end
for /f "tokens=*" %%G in ('dir /b "%ProgramFiles%\program\unins*.exe"') DO start
/wait "uninstall" "%%G" %OPTIONS%
for /L %%C IN (1,1,30) DO (
if not exist "%APP_BIN%" goto good_end
ping -n 2 127.0.0.1 > NUL
)
:bad_end
exit /B 1
:good_end
if exist "%APP_DIR%" rmdir /s /q "%APP_DIR%"
exit /B 0
Post by le dahut
I've written a service that runs under SYSTEM account. It succeeds in
installing/uninstalling InnoSetup apps with exactly the same command
line as in <package>.xml.
Is it possible that WPKG puts its own lock on "unin000.exe" preventing
it to be erased ?
No. WPKG just executes the processes listed in XML package definition. The only
known issue we cannot work-around is a bug in Microsoft which makes the process
to get stuck if it prints more than 4k of data to STDOUT/STDERR. So just
redirect the output to NUL by appending " > NUL" to the command if in doubt.
Make sure to use the latest WPKG version (1.1.2).
br,
Rainer
-------------------------------------------------------------------------
wpkg-users mailing list archives >> http://lists.wpkg.org/pipermail/wpkg-users/
_______________________________________________
wpkg-users mailing list
http://lists.wpkg.org/mailman/listinfo/wpkg-users
-------------------------------------------------------------------------
wpkg-users mailing list archives >> http://lists.wpkg.org/pipermail/wpkg-users/
Marco Gaiarin
2009-12-09 09:04:55 UTC
Permalink
Mandi! le dahut
In chel di` si favelave...
Post by le dahut
Any idea ?
/suppressmsgboxes

?!
--
dott. Marco Gaiarin GNUPG Key ID: 240A3D66
Associazione ``La Nostra Famiglia'' http://www.sv.lnf.it/
Polo FVG - Via della Bontà, 7 - 33078 - San Vito al Tagliamento (PN)
marco.gaiarin(at)sv.lnf.it tel +39-0434-842711 fax +39-0434-842797

Dona il 5 PER MILLE a LA NOSTRA FAMIGLIA!
http://www.lanostrafamiglia.it/chi_siamo/5xmille.php
(cf 00307430132, categoria ONLUS oppure RICERCA SANITARIA)
-------------------------------------------------------------------------
wpkg-users mailing list archives >> http://lists.wpkg.org/pipermail/wpkg-users/
Loading...