Reply to Thread

Post a reply to the thread: Force rollback after failed RunProgram

Your Message

Click here to log in

What's the name of our main installation product (in uppercase letters), directly followed by the current year?

 

You may choose an icon for your message from this list

Additional Options

  • Will turn www.example.com into [URL]http://www.example.com[/URL].

Topic Review (Newest First)

  • 08-10-2014, 11:59 AM
    linder

    Re: Force rollback after failed RunProgram

    You are very welcome, André

    Friedrich
  • 08-10-2014, 11:54 AM
    andrelernhart

    Re: Force rollback after failed RunProgram

    Friedrich,

    yes, this helps me to save this Sunday :-)

    Perfect, thank you very much, highly appreciated!

    Best regards André
  • 08-10-2014, 11:41 AM
    linder

    Re: Force rollback after failed RunProgram

    André,

    Unfortunately, my demo really was too quick-n-dirty <g>. Sorry !!!

    Please re-dowonload:

    http://www.lindersoft.com/projects/SmartRollback.zip

    See Lines 39+40 in the "UpdateSetup.sb8" project:

    ! Backup Add/Remove Panel data
    Set Installer Flag $SB_BACKUPADDREMOVEPANEL$ to "1"

    This will backup the required registry items for updates.

    Does this help?

    Friedrich
  • 08-10-2014, 11:13 AM
    andrelernhart

    Re: Force rollback after failed RunProgram

    Friedrich,

    thank you very very much for this demo!
    Based on your demo (seeing that it works), I finally found the bug in my script. As always a stupid glitch I repeat frequently during the last 40 years or so: the variable pointing to the location for uninst.exe/uninst.log was not correctly initialized. I debugged and used a lot of messageBoxes until I found the bug.

    Smart Rollback works now like a charm, excellent!

    What I don't understand in your UpdateSetup.SB8 (line #34): you check for previous version using the PRODUCTGUID. Running the script a second time, the return value is 0, indicating "not found" (what you show in the MessageBox). Why the entry for this PRODUCTGUID in Registry is gone? A glitch in Smart Rollback or do I miss some basic understanding?

    Thanks again, best regards André
  • 08-10-2014, 08:19 AM
    linder

    Re: Force rollback after failed RunProgram

    André,

    I have uploaded a simple demo:

    http://www.lindersoft.com/projects/SmartRollback.zip

    Unzip the archive into a test folder. Then compile and run "InitialSetup.sb8". This will install two files: FILEA.TXT (contents is Version 1) and FILEB.TXT (contents is Version 1). Then compile and run "UpdateSetup.sb8". This will update FILEA.TXT to Version 2. But after that, it will execute the rollback feature and rollback Version 2 to Version 1. When you see the "Rollback" message box you can check the contents of FILEA.TXT -- it will tell you that it is Version 2., After the rollback it says again Version 1.

    Does this help?

    Friedrich
  • 08-10-2014, 07:02 AM
    andrelernhart

    Re: Force rollback after failed RunProgram

    Friedrich,

    I tried another couple of hours... no success so far. It seems that I miss some important "detail", it still uninstalls the whole installation, not only the failed update.

    A small sample would be very helpful, thanks in advance!

    regards
    André
  • 08-09-2014, 01:17 PM
    linder

    Re: Force rollback after failed RunProgram

    Hi André,

    We are doing this on a regular basis. The "update" has to use the same uninstall .exe / .log file. The /UR command line switch rolls-back all the logged items from the update install. Even the SetupBuilder install image uses this feature that lets you rollback to previous builds.

    BTW, if it displays messages then you forgot to run the uninstall in silent mode. And of course, you have to log the command in the uninstall. Otherwise, it can't be rolled back. If you are using a custom uninstall, it also has to handle the "smart rollback" scenario.

    I'll develop a simple demo project for you, no problem.

    Friedrich
  • 08-09-2014, 12:23 PM
    andrelernhart

    Re: Force rollback after failed RunProgram

    Hi Friedrich,

    thanks for fast reply!

    I was able to catch the "Run Program" return error code, stop writing to the log, and then invoke uninstall.exe using the "Run Command Line" feature with /UR.
    It first asks if everything should be uninstalled... if YES, the whole installation is uninstalled, not just a smart rollback of the failed update... and finally it tells the user that the installation was successful...

    This is not the intented behaviour. Thus, I'd really appreciate a sample script.

    Requirements:
    1) Assume a successful initial installation (e.g. an application.exe, some DB files, some .chm files)
    2) Run an update script which patches some of the previously installed files (such as .chm or the application.exe). During update, for some reasons a "Run Program" operation returns an error code.
    3) This error is catched and should invoke a smart rollback only of the already applied changes during this failed update - the previously successful installation should remain intact.
    The user should be informed that this failed update was not successful: either by means of a
    a) custom dialog (which content I can assemble knowing the offending details) or
    b) with a generic predefined dialog, just saying that the operation failed - (the particular failures I can show when they occur)

    Thanks ahead for your time, highly appreciated.
    best regards, André
  • 08-09-2014, 11:08 AM
    linder

    Re: Force rollback after failed RunProgram

    BTW, if you need an example project, just let me know and I'll develop one for you.

    Friedrich
  • 08-09-2014, 11:04 AM
    linder

    Re: Force rollback after failed RunProgram

    Hi André,

    The "Exit Installation" statement causes the script to terminate completely and returns to the operating system, optionally setting the errorlevel after the program terminates. It does NOT execute any other function (e.g. rollback).

    To programmatically invoke smart rollback for updates, you have to stop writing to the uninstall .log ("Set Installer Log Mode" -> Close Installation Log). You can launch the uninstaller (e.g. "Run Command Line...") in "smart rollback" mode. Call the uninstall .exe (point to your uninstall .log) and add the /UR command line switch.

    Friedrich
This thread has more than 10 replies. Click here to review the whole thread.

Posting Permissions

  • You may post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts
  •