Problems handling upgrade scenario

Comments

3 comments

  • Avatar
    Philippe Renon

    PPS:

    Other "solutions" to implement approach 1 would be:

    - to make the unstallation of files on abort optional

    - to add a new action list that gets invoked once the installer is done with everything and that gets invoked in all cases.

     

  • Avatar
    michiel

    Hi,

    Please accept my sincere apologies for the delay in my reply. Regarding this issue, perhaps the following solution - building an upgrade installer in normal mode - would be a solution. In this way you just add the files in the installation directory to the new uninstaller.

         <readyToInstallActionList>
            ...
            <!-- Add the files installed by the previous
            installation to the uninstaller -->
            <addDirectoriesToUninstaller>
              <addContents>1</addContents>
              <matchHiddenFiles>1</matchHiddenFiles>
              <files>${installdir}/data;${installdir}/core</files>
              <ruleList>
                 <isTrue value="${isUpgradeMode}"/>
              </ruleList>
            </addDirectoriesToUninstaller>
            ...
         </readyToInstallActionList>

    You can find more information about this solution in the following section of our manual:

    https://support.bitrock.com/hc/en-us/community/posts/360031918113-Problems-handling-upgrade-scenario

    Regards,

    Michiel

     

  • Avatar
    Philippe Renon

    Hi,

    Thanks for the answer. Turns out "Approach 2" works. What prevented the directory renaming was the antivirus.
    It is not possible to rename the install dir while the antivirus is scanning the newly installed content.

    To work around it, I used a "safe rename" that tries to rename until it succeeds.

    `

    <actionDefinition>
    <name>renameFileSafe</name>
    <parameterList>
    <stringParameter name="origin" />
    <stringParameter name="destination" />
    </parameterList>
    <actionList>
    <if>
    <conditionRuleList>
    <platformTest type="windows" />
    <antivirusTest type="enabled" />
    </conditionRuleList>
    <actionList>
    <while>
    <conditionRuleList>
    <fileTest condition="not_exists" path="${destination}" />
    </conditionRuleList>
    <actionList>
    <renameFile origin="${origin}" destination="${destination}">
    <abortOnError>0</abortOnError>
    <showMessageOnError>0</showMessageOnError>
    <onErrorActionList>
    <logMessage text="Failed to rename ${origin} to ${destination}, retrying..." />
    <wait ms="1000" />
    </onErrorActionList>
    </renameFile>
    </actionList>
    </while>
    </actionList>
    <elseActionList>
    <renameFile origin="${origin}" destination="${destination}" />
    </elseActionList>
    </if>
    </actionList>

    `

     

Please sign in to leave a comment.