Page 1 of 1

Installation order (purple and black commands)

Posted: Wed Jul 13, 2011 3:05 pm
by gsaunders
Using Installaware 11.

Let's say I have the following commands:

Code: Select all

~InstallAware Clipboard Data~
~Call DLL Function~
~{E049EA28-833C-41A0-B27B-96D6E3E6DD33}~
~kernel32.dll,RemoveDirectoryA,void,,"pointer to string",$BAMPACOMPATIBILITYLOCATION$,$~
~mIDEFunc.dll\mEXEFunc.dll~
~Delete Files Recursive~
~{37F6EE1C-0E6E-4CED-9054-6D1186594963}~
~$BAMPACOMPATIBILITYLOCATION$\~
~Copy/Move Local Files~
~{B1923F75-AE5C-470C-87A6-7F8F458661C2}~
~$BAMPACOMPATIBILITYLOCATION$~
~*.*~
~$BAMPAAPPDATA$.OLD~
~~
~TRUE~
~FALSE|FALSE~
~Copy/Move Local Files~
~{E3B55510-47D3-4C3F-9E80-C224F227BDBD}~
~$BAMPACOMPATIBILITYLOCATION$~
~*.*~
~$BAMPAAPPDATA$~
~~
~TRUE~
~FALSE|FALSE~
Basicly two purple Copy Local Files commands on a folder.
Then the third command is a black Recursively Delete Files command on the same folder.
Then the fourth command is a green Call DLL Function command which removes that folder.

These are in the Perform First Time or Maintenance Installation region.

My understanding are the purple commands don't happend until after the Apply Install... but the black and green ones happen immediately.

So should I be doing the sequence of commands I have done above??? Or should the black Recursively Delete and gree Call DLL Function be called after the Apply Install has completed?

Thanks,

Greg

Re: Installation order (purple and black commands)

Posted: Wed Jul 13, 2011 3:19 pm
by gsaunders
And a follow up question...

If someone allowed for a mainenance update or repair... do those same copy local files and recursively delete and call dll function get called again?

What determines what will run again?

Re: Installation order (purple and black commands)

Posted: Wed Jul 13, 2011 6:04 pm
by giaviv
Well, you can have it either way - what exactly are you trying to do? That will determine the order of commands.

As for your second question, I don't know how you structured your installer, but running a repair on a setup created from a template will definitely run these commands again - repair and update basically remove the first version and install it again.

Re: Installation order (purple and black commands)

Posted: Wed Jul 13, 2011 9:53 pm
by gsaunders
giaviv wrote:Well, you can have it either way - what exactly are you trying to do? That will determine the order of commands.

As for your second question, I don't know how you structured your installer, but running a repair on a setup created from a template will definitely run these commands again - repair and update basically remove the first version and install it again.
Well, what I am trying to do is execute the 3 commands I gave in the order I gave it. They could execute at different points during installation, but definitely in that order.

But my question is more based on when will they actually take place since there is a mixture of purple, black, and green commands. Will they happen in order or will the black happen first then green and then purple since these are all listed consecutively before the Apply Install. Since the black is recursively deleting what the purple is trying to copy I am guessing this will lead to a problem if the black executes before the purple.

The structure of the installer... I created the script with the standard project wizard. These 3 commands were added to the region for the Initial Install / Maintenance.

Here is the core details of what I am trying to do:

- There is already an existing application originally installed with an OLD wise installer.
- The application and database files are all in the same folder program files\appname.
- This older install could be on XP based or Win 7 based systems.
- The BIG issue is with this older installation on Windows 7 units. Since it was an application without themes enabled means that all data changes made to the db tables in the program files\appname get stored in the virtual storage location c:\users\username\AppData\Local\VirtualStore\Program Files\appname. So if you simply copy the files in the program files\appname you would not get the latest data, but the ORIGINAL empty tables.
- We have updated the program with the latest version of our develepment environment and the themes are enabled as well as the data is now being installed to the $MYAPPDATDA$\APPNAME which is c:\programdata\appname on windows 7.
- So if I was doing a new install none of this would be an issue, but since I want to retain the data from the old installation I need to get the old data into the new data location before removing the old application install.

So here are the steps I am trying to take:

1) I first determine if the old application exists. This can be done via several ways, but in this case I am simply checking to see if the folder exists program files\appname and if it is Windows Vista or 7 then I check for the existence of the c:\users\username\AppData\Local\VirtualStore\Program Files\appname.
2) If I find it I then want to copy all of the data files from program files\appname to the $myappdata$\newappname.
3) if I find the virtual storage location then I want to copy all of the data files in there to $myappdata$\newappname.
4) After I copy the data to the new data location I make a backup copy to $myappdata$\appname.old
5) Now that the data has been copied I run the uninstall of the old application silently
6) Then I recursively delete the old app folder and virtual storage folder.
7) Then I remove the directory via the call DLL function.
8 Then the install continues with installing the new exe and data files. The data files are set to not overwrite if the files already exist (which they do if they had the old version).

That is pretty much the sequence I would run things if I could sequentially run everything, BUT... do things run sequentially since I have a mix of purple, black, and green commands in the above sequence. I want to make sure I understand how this gets processed and in what order does it really attempt to happen. I can provide the script if needed.

If what I understand is correct then the sequence above will not run in that order. The commands that are black would run first and then the green and then the purple in the end. If that is the case then I need to try and make the black and green commands happen AFTER the apply install.

Then all this leads to the second question about NOT wanting steps 1 through 7 to run in the maintenance / repair process. How can I do this. Can you even run any of the purple commands so they are not part of the maintenance? Ultimately do I have to have some other method to doing steps 1 through 7 so it isn't run during the maintenance / repair.

Just trying to clear up some confusion in my mind about this.

Thanks for your help,
Greg

Re: Installation order (purple and black commands)

Posted: Wed Jul 13, 2011 10:10 pm
by giaviv
Dear Greg,

I strongly recommend using the Native Engine by setting the NATIVE_ENGINE variable to TRUE in the beginning of your script.

On top of many other advantages, using the Native Engine means that all commands are executed upon declaration, and there is no delay of execution.
This can save a lor of headaches, just like yours :)

Re: Installation order (purple and black commands)

Posted: Wed Jul 13, 2011 10:50 pm
by gsaunders
giaviv wrote:Dear Greg,

I strongly recommend using the Native Engine by setting the NATIVE_ENGINE variable to TRUE in the beginning of your script.

On top of many other advantages, using the Native Engine means that all commands are executed upon declaration, and there is no delay of execution.
This can save a lor of headaches, just like yours :)
Can the NATIVE_ENGINE be turned back off or once it is set it is set?

I take it by setting this flag then nothing is using MSI?

Re: Installation order (purple and black commands)

Posted: Wed Jul 13, 2011 10:56 pm
by gsaunders
Never mind on those last questions... found it readily in the help file.

I can switch in and out of NATIVE_ENGINE and standard mode.

Re: Installation order (purple and black commands)

Posted: Thu Jul 14, 2011 5:44 am
by gsaunders
Whether I use the native mode or not... How do make it where certain commands do not run again in maintenance mode... Like steps 1 - 7 ??? Those should only run during first time install.

Thanks

Re: Installation order (purple and black commands)

Posted: Thu Jul 14, 2011 11:12 am
by giaviv
Hi,

You can wrap these commands inside an If block that checks if the variable MAINTENANCE equals FALSE - that way it will only run if NOT in maintenance..

Re: Installation order (purple and black commands)

Posted: Thu Jul 14, 2011 11:28 am
by gsaunders
I forgot to also ask...

Those same seven steps I don't want to reverse if uninstalled. Is this the same if then block? Is an uninstall considered maintenance?

Thanks

Re: Installation order (purple and black commands)

Posted: Thu Jul 14, 2011 11:30 am
by giaviv
Uninstall is when the variable REMOVE equals TRUE, so revise that in the previous If block.

Re: Installation order (purple and black commands)

Posted: Thu Jul 14, 2011 11:57 am
by gsaunders
giaviv wrote:Dear Greg,

I strongly recommend using the Native Engine by setting the NATIVE_ENGINE variable to TRUE in the beginning of your script.

On top of many other advantages, using the Native Engine means that all commands are executed upon declaration, and there is no delay of execution.
This can save a lor of headaches, just like yours :)
Just wanted to be sure what I thought was happening was indeed happening. In my steps 1 though 7... the black commands and green commands are they running before the purple commands when NATIVE_ENGINE is not enabled???

So with three of the steps (5, 6, 7) being black and green commands (uninstall old app - black, recursive delete - black, and removes directory with call DLL - green)... these three commands will run before the purple commands in steps (1, 2, 3, 4). Is that correct???

If so then I would expect it to either fail or simply not successfully copy the data since the black commands got rid of it.

However, I believe I did see the data copied after this ran which confuses me, because I would expect it to not have copied if the purple run after the black and green. Or maybe I did something wrong.

If you could just recap here and help me make sure what I am thinking is correct (if I don't have NATIVE_ENGINE enabled).

Thanks for your time... you are being a big help.

Greg

Re: Installation order (purple and black commands)

Posted: Thu Jul 14, 2011 8:20 pm
by giaviv
Dear Greg,

As you said, black commands and plugin commands run immediately, unlike other commands. Therefore, if you were experiencing anything other than this, you probably did something wrong :)