Archive: Reboot Question


Reboot Question
I have a question which I fear may not have a very good answer. Forgive me if I am repeating a question asked in this forum previously, I did query the forum but found no direct references to my question.

I want to install several different packages (or portions of a bigger package). Each of these packages (or portions thereof) make registry and environmental settings changes (and other things) and therefore require a reboot. These packages depend on each other to properly function.

Here's what I currently do. I have my user select the first package. He/She installs the first package upon which the system automatically reboots and prepares the system for the next package. My user then selects the second package. The system is rebooted after installation in like manner. My user then selects the final package. After installation the system reboots and is ready to use.

This system works fine.

Do to severe OS problems on any PC I've tested with, if I install all three packages without reboot the system hangs and refuses to load Windows (thanks to Bill Gates and his development team). [Of course, muchos cudos to him I can simply use the LAST KNOWN GOOD configuration option in Windows 2000/NT and be back to square one if that happens.]

What I'd like to be able to do is this. I'd like to be able to set a tag of some kind in my installer such that...

(Pseudocode):



SectionOne Finished then call SavePlace

SavePlace:
set variable PLACE = SectionTwo
reboot
restart installer MyInstaller.exe

StartOfInstaller:
Read variable PLACE
Place = SectionTwo
Turn off SectionOne goto SectionTwo

SectionTwo Finished then call SavePlace

SavePlace:
set variable PLACE = SectionThree
reboot
restart installer MyInstaller.exe

StartofInstaller:
Read variable PLACE
place = SectionThree
Turn off SectionOne and SectionTwo goto SectionThree

SectionThree Finished then call SavePlace

SavePlace:
set variable PLACE = "No More Sections"
reboot
restart installer MyInstaller.exe

StartOfInstaller:
Read variable Plave
place = "No More Sections"
Turn off SectionOne, SectionTwo, and SectionThree goto Section "No More Sections"

"No More Sections":
MsgBox "No more sections...stuff installed"
quit


Is this possible? I don't know of any installer off the top of my head which has this kind of reboot support. Can this be done with NSIS? Do you think an external DLL or program could do this?

I know this isn't a tremendously exciting question but I thought I'd throw it out since, I couldn't find a method myself.

Sincerely,
Jacob


You don't need an external DLL for this. It's actually quite simple to achieve. All you need to do is get the installer to start up when Windows start up (a registry key), and save the variables and step number somewhere (registry would probably work best). When the installer starts check the step number and act according to it.

BTW, what's that poll for?


Alrighty then....
That's a good idea...

I didn't think of that. Would you use \HKEY_CURRENT_USER\software\microsoft\windows\currentversion\runonce to store your run data?

I'm really a novice at this scripting thing, though I can ask questions pretty well at this stage in my development.

I searched my registry for the terms "startup" and "boot" but didn't find anything remarkably useful (at least anything that cought my attention) except for the above.

I'm guessing you want to runonce at startup...each and every startup until completed.

I "googled" around just now to find out how much assistance is on the internet right now for my problem. Looks like there is a bit. I'll have to check it out.

The first 45 or 50 hits were Windows 98 related (i.e. HKLM\\Run) which doesn't help if I'm installing on lots of different types of windows boxes.

Thanks for your prompt and kind response. NSIS is awesome!

My minor is sociology and I thought it'd be fun to test the prevailing thought that people generally prefer monosyllabic (sp?) proper names over longer multiple-syllable names (and therefore give their children shorter and shorter names to make communication faster). You should have seen my mom run through the litagy trying to get my name out, "Stef...Aniela..Jani...no I need Jacob!!! Now!". She eventually cut my name to "Jake" to simplify it even further.
Enough of the personal stuff. That's what it's about. Just wondering if the whole world really follows the theory my professor teaches.

My personal theory based on a review of the roster and an informal questionarre is that most people have 5 or less characters in their name, several people have lots of characters (8 or more or so), while the average hits around 6 characters or so.

Oh well,
Let me know if you have any thoughts on either matter.
Sincerely,
Jacob


Yes, I was thinking of RunOnce. But you should only use it to tell Windows what file it needs to execute (process $CMDLINE for this). You should use another key, such as HKLM\Software\mySoftware to store the other data.

I think you professor is right, names do get shorter. Mine for example is 4 chars and can easily be pronounced as one syllable as opposed to my father's name that needs some serious distortion to be pronounced as one syllable.


Question
Well, when I started working on it from that angle another thought hit me. Why can't we use several small installer packages and simply edit the registry key Runonce everytime we are about to reboot?

Example:


Installed package One.
Write HKLM\Runonce = PackageTwo
Reboot

Installed package Two.
Write HKLM\Runonce = PackageThree
reboot

Installed package Three.
No write to HKLM\Runonce
reboot


Wouldn't that do what I want? How would it work in 98? I don't thing there is a RunOnce key in 98.

I'm going to work on this procedure a bit. Let me know if I'm forgetting something, or if you've got an easier method.

Sincerely,
Jacob Metro


The key:
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunOnce
works on all Windows versions.

I haven't suggested seperate installers because I figured you'd want this installer to be available is one download and it's faster to compile just one installer. You could pack the other two installers in the first instsaller (use !system to compile) if you want to save the extra registry keys. You can also pass a command line parameter using the RunOnce key (something like "$INSTDIR\myInstaller.exe" /part2).