Archive: Unpacking: before or during?


Unpacking: before or during?
  Hi, I hope this isn't what you call 'pestering the developers'.
I've noticed using the highest compression and placing all sections before the body of page functions and after the page macros in the script causes the installer to unpack data prior to running. When the sections are included after the functions the setup runs right away. Unpacking takes 2-3 seconds. Is there an advantage to unpacking before? Or does it depend on how much data there is? With 700MB (in theory), you might want to unpack first and not during the installation... But why does moving the sections have that effect? What do functions have to do with it?

regards,
Tom


My second reply in bug #987385 explains why this is done the way it's done.

What you need in your script is ReserveFile as all those page functions add files to the data block. If you put the sections with the files above the page functions, those files required for the pages will be at the end of the data block. That means it'll have to decompress everything before it can get to the pages' data.


I haven't completely been able to isolate the files needed on startup (I'm working on it) to prevent lengthy unpacking, but I stumbled on an oddity, part of initializing. Putting an .onGUIInit function above the .onInit function shows the "Please wait while Setup is loading..." banner indicating the progress of unpacking in percent until it completes. If the functions are the other way around (.onInit second), the unpacking is silent, no banner.

To be noted as well, .onInit internally jumps to FunctionEnd.

Function .onInit

>...
StrCmp $Language 1031 0 +4
SetOverwrite on
SetOutPath "$PLUGINSDIR"
File "/oname=$PLUGINSDIR\modern-wizard.bmp" "tigwgs.bmp"
>FunctionEnd

>Function .onGUIInit_func
>...
>FunctionEnd
>
displaying the banner.

onInit

>...
StrCmp $Language 1031 0 done
SetOverwrite on
SetOutPath "$PLUGINSDIR"
File "/oname=$PLUGINSDIR\modern-wizard.bmp" "tigwgs.bmp"
done:
>FunctionEnd

>Function .onGUIInit_func
>...
>FunctionEnd
>
not displaying the banner.

As said, banner or no banner, I would like to use ReserveFile (thank you for the suggestion:)) or place the sections below the page functions to avoid initial unpacking. This is a different matter.

That's because you skip the file extraction in the second code so it doesn't unpack it.

Simply reserve all files that are used outside of sections at the top of the script. Don't forget to reserve MUI files as well. See section 6 of the MUI readme - "Reserve files".


Alright, forget about the banner.

My code does extract MUI files first thing:


nsh

>; Things that need to be extracted on startup (keep these lines before any File command!)
; UseReserveFile for InstallOptions INI files too!
!
insertmacro MUI_RESERVEFILE_INSTALLOPTIONS ; InstallOptions plug-in
>!insertmacro MUI_RESERVEFILE_LANGDLL ; Language selection dialog
ReserveFile "ready.ini"
>ReserveFile "prep.ini"
The missing files aren't the usual suspects. I'm still looking, believe me. I'll get to the bottom of it, if I have to remove every other file from the installer. Thanks.

edit:
StartMenu.dll, UserInfo.dll, System.dll and tigwgs.bmp were also referenced. Problem solved.

I'm trying to streamline the installer which prompted this, because I wanted resolve, if possible, a hiccup sometimes when changing the image on the finish page. The image change should really happen after all files have been installed but before the finish page. You can't change the image earlier; someone might hit the Back button to return to the welcome page. I don't know if moving the sections has helped. Would it be pointless to extract the finish page image too as a ReserveFile?

Further to the banner not appearing when files are unpacked: I've since had no banner in other situations. My code didn't cause it or wasn't the only factor. To be honest, I didn't even know a banner was supposed to appear, but it was good when it did. Sorry for getting side-tracked.


If you want a different image for the finish page, don't extract on the same filename. Simply change the INI in the pre-callback function of the finish page so it'd load another image.


What's going on? I tried renaming the image before my last post, exactly as you suggest, and there was a blank page. The image didn't show up. It was there in the $PLUGINSDIR, but not on the finish page. Honest injun.

It works now. I owe you another thank you.:)

FWIW, I made an unrelated (rest assured only 'temporary') mistake (in the third post). Replacing the welcome page bitmap in .onInit is useless, because modern-wizard.bmp gets defined later and cancels out the change.