Page 1 of 1

When reboot?

Posted: Wed Apr 26, 2006 3:56 pm
by Guest
I've made some changes to my installer and it appears that now I need to reboot nearly every time an old version is uninstalled while installing a new version. I can trace the program and see this statement called:

Code: Select all

Install/Remove MSI Package $PRODUCTCODE$[REMOVE=ALL] (get result into variable REMOVEOLD)


Upon completion it sets REMOVEOLD to REBOOT. I assume that REMOVEOLD gets the same value as SUCCESS when Uninstalling returns from line:

Code: Select all

Apply Uninstall (get result into variable SUCCESS)


My question is, what would cause Apply Uninstall or Apply Install to return REBOOT? Or is my assumption wrong and the REBOOT is coming from somewhere else?

Posted: Wed Apr 26, 2006 4:41 pm
by MichaelNesmith
This means the computer really needs to reboot. If you take a template project, build it, install it, build again to simulate a new version, and install it again; you will see that no reboot is requested after the automatic uninstall. So Windows Installer determines a reboot is necessary, and although you could disable rebooting in the script, this is not recommended.

Posted: Wed Apr 26, 2006 5:09 pm
by Guest
I understand that a reboot really is necessary if it returns REBOOT. However, I would like to avoid it if I can. I was looking at msdn's msi documentation and could only find one example of what would cause a reboot: if it tries to replace a file that is currently being used by another program. I would like to look for that case and any others that might cause a reboot and deal with them in a way that would not require a reboot.

I posted a question earlier today about the InstallValidate action. If I could use that (or program something similar to it) then I can check to see what programs are using the files. I could then warn the user that they need to stop those programs before installing or reboot after installing.

So if you know where I could look to find any other conditions that require a reboot, I would appreciate it. If I overlooked some page in msdn that describes this, please point me to it.

Posted: Wed Apr 26, 2006 5:18 pm
by MichaelNesmith
To check for running programs or services, you can use the Check Process, Check Service commands. To terminate a program, you can use the Terminate Program command. To stop a service, you can use the Control Service command.

Posted: Wed May 03, 2006 6:17 pm
by Guest
After some more investigation I found the problem. It appears that the program that is holding a reference to one of the files I want to uninstall is actually my setup program. I put in the following code to grab a value stored in a file before uninstallation of a previous version:

Code: Select all

Does File Exist $COMMONFILES$\\IntelliServ\\Intelliserver.ini (get result into variable SUCCESS)
if Variable SUCCESS Equals FALSE
  GoTo Label: End Reading Loop
end
 
Set Variable EOF to FALSE
label: Start Reading Loop
Read from Text File $COMMONFILES$\\IntelliServ\\Intelliserver.ini into Variable INI (get EOF into EOF)
Parse String $INI$ into Variables Match and IP (Split at first occurrence of pattern)
if Variable Match Equals
  Set Variable NICIP to $IP$
  Set Variable OLDNICIP to $IP$
  Set Variable UPGRADESERVER to TRUE
  GoTo Label: End Reading Loop
end
if Variable EOF Equals FALSE
  GoTo Label: Start Reading Loop
end
label: End Reading Loop

If the Parse String command ever finds a match then the Intelliserver.ini file remains open. If it does not find a match then the file is closed. I assume that it gets closed because EOF is reached.

My question: Is there a way to get the file to close (so it can be uninstalled without a reboot) without adding a separate read loop to finish off the read (and thus close the file)?

*Note* While the file extension is .ini the format is different from normal .ini files so using the "Get INI File Settings" command does not work.

Posted: Wed May 03, 2006 9:24 pm
by MichaelNesmith
Sure! Try to read from a different (even non-existent) file. That'll close it!