Archive: Online / Offline - Installer / Updater


Online / Offline - Installer / Updater
Hello!

I didn't find any installer for my requirements until I looked at NSIS which looks great to me as it is fully programmable. After reading quite some docs, posts and archive entries I'm not sure how to solve the following scenario: Updater/Installer with online/offline mode. Maybe someone can give me some hints or points me to the right direction.

The complicated part first: online/offline
I want two installers, one with all needed files (offline for CDROM) and one without files (online web installer). The online installer has to download some version information, compare this to already installed files (my software, Microsoft DLLs, ...) and download all newer or missing files. The offline installer should ask the user to use the online mode or just use the files in the package. Offline mode is obvious but online mode has to download version info and compare this with already installed files AND with version of the packaged files (of course each file has its own version).

Second component: updater/installer
I want all installers to detect earlier versions and go in update mode instead of install mode (saw some example for this already). Files may have been added to the software or deleted, so I think about silently uninstalling the software (old uninstall.exe) and installing it from scratch, but this would remove some files I now have to download again (unchanged files). But how do I know what the update has to uninstall?

The offline-online thing seems to be solvable like:
- extracting packaged files (if present) to TMP
- asking about online mode (if no files in TMP, force online mode)
- download online version, compare to installed version and packaged version (in offline mode just compare packaged version to installed version)
- download missing components
- install from TMP (copy files)
- installing some uninstaller

Maybe this will get complicated in detail (maintain all those version infos), because not all files may have version compiled into (TXT vs EXE/DLL).

Updating seems easy if no files get removed from the software (I don't want to maintain uninstall information in .nsi for each previous software version). But Updater in online mode should compare online version to installed version before uninstalling the old one and save this file (it's not necessary to download this file again). In general no file should be downloaded if the online version is not newer than the installed one or the packaged one (if available). State after updating should be the same as uninstalling with the old uninstall.exe and downloading and installing a new installer package.

To make the problem no more complicated: I don't need optional components (at this time...), so always all components will be installed. But I see problems combining the online/offline part with updating/installing.

Sorry for the long post, maybe someone has similar needs or ideas.


I couldn't find anything that can't and wasn't done during my brief reading. It seems you need nothing more than NSISdl, some INI files on the server and maybe a hash plug-in like the md5 plug-in (to compare files without versions such as TXT files).

I think it would be best if you start with what you have and ask more specific questions as you go. It's all possible so there shouldn't be any serious problems along the way...


I have done this using an ini file that I have online and I package it in the installer. If the program can't download the one online it uses the one that is packaged with it. Basicly the ini file has the minimum version I want at the client and and it also has a url where the latest can be downloaded from. I check the version's by looking them up in the registry or an xml file for 1 of the programs.

I use a !define in the beginning of the installer to tell it to Download the programs or package them up with the in staller to put on CD. I have 4 different programs and each one can be included with installer or forced to be downloaded seperately.

Here is a snipet where I DL a utility pack or include it based on the !define. I comment it out to force the files to be included in the installer

!define INS_UTILS "HTTP"

; later in installer
Function UpdateUtils
Push $R0
ReadRegStr $R0 HKLM "SOFTWARE\MPI\Millennium" "InstallPath"
; MessageBox MB_OK "M3 Install Path $R0"
StrCmp $R0 "" lbl_done lbl_install
lbl_install:
!ifdef INS_UTILS
call DLUTILS
goto lbl_done
!endif
!ifndef INS_UTILS
SetOutPath "$R0\QPS"
File /r ${QPS_IN}\UTILS
!endif
lbl_done:
Exch $R0
FunctionEnd

Function GetConfig
CreateDirectory "$INSTDIR\CFG"
nsisdl::download "${CFG_ADDR}" "$INSTDIR\CFG\HTTP_CFG.ini"
;Dumpstate::debug
; messagebox MB_OK "DOWNLOAD ${CFG_ADDR} = $0"
pop $0
StrCmp $0 "success" success
SetDetailsView show
DetailPrint "download failed: $0"
goto uselocal
success:
SetDetailsView show
DetailPrint "download Sucess: $0"
goto skip
uselocal:
SetOutPath "$INSTDIR\CFG"
File /r ${QPS_IN}\HTTP_CFG.ini
skip:
!define CFG_HERE "$0"
;Dumpstate::debug
FunctionEnd


I have done this using an ini file that I have online and I package it in the installer. If the program can't download the one online it uses the one that is packaged with it. Basicly the ini file has the minimum version I want at the client and and it also has a url where the latest can be downloaded from. I check the version's by looking them up in the registry or an xml file for 1 of the programs.

I use a !define in the beginning of the installer to tell it to Download the programs or package them up with the in staller to put on CD. I have 4 different programs and each one can be included with installer or forced to be downloaded seperately.

Here is a snipet where I DL a utility pack or include it based on the !define. I comment it out to force the files to be included in the installer

!define INS_UTILS "HTTP"

; later in installer
Function UpdateUtils
Push $R0
ReadRegStr $R0 HKLM "SOFTWARE\MPI\Millennium" "InstallPath"
; MessageBox MB_OK "M3 Install Path $R0"
StrCmp $R0 "" lbl_done lbl_install
lbl_install:
!ifdef INS_UTILS
call DLUTILS
goto lbl_done
!endif
!ifndef INS_UTILS
SetOutPath "$R0\QPS"
File /r ${QPS_IN}\UTILS
!endif
lbl_done:
Exch $R0
FunctionEnd

Function GetConfig
CreateDirectory "$INSTDIR\CFG"
nsisdl::download "${CFG_ADDR}" "$INSTDIR\CFG\HTTP_CFG.ini"
;Dumpstate::debug
; messagebox MB_OK "DOWNLOAD ${CFG_ADDR} = $0"
pop $0
StrCmp $0 "success" success
SetDetailsView show
DetailPrint "download failed: $0"
goto uselocal
success:
SetDetailsView show
DetailPrint "download Sucess: $0"
goto skip
uselocal:
SetOutPath "$INSTDIR\CFG"
File /r ${QPS_IN}\HTTP_CFG.ini
skip:
!define CFG_HERE "$0"
;Dumpstate::debug
FunctionEnd