Welcome Guest.   Make a donation to an author on the site September 23, 2014, 11:23:13 AM  *

Please login or register.
Or did you miss your validation email?


Login with username and password (forgot your password?)
Why not become a lifetime supporting member of the site with a one-time donation of any amount? Your donation entitles you to a ton of additional benefits, including access to exclusive discounts and downloads, the ability to enter monthly free software drawings, and a single non-expiring license key for all of our programs.


You must sign up here before you can post and access some areas of the site. Registration is totally free and confidential.
 
Check out and download the GOE 2007 Freeware Challenge productivity tools.
   
   Forum Home   Thread Marks Chat! Downloads Search Login Register  
Pages: [1]   Go Down
  Reply  |  New Topic  |  Print  
Author Topic: FARR plugin installer with Inno Setup  (Read 2018 times)
phitsc
Honorary Member
**
Posts: 1,004



see users location on a map View Profile Give some DonationCredits to this forum member
« on: December 22, 2010, 02:53:53 PM »

I've made installers for most of my plugins a while ago to make them better accessible to users that don't feel comfortable unzipping and copying files into a directory of an already installed application. Amongst the FARR users, that might not be too many. Nevertheless, I just felt that the process of installing my FARR plugins was too cumbersome and error prone.

I'm using Inno Setup, a free tool to create windows installers. Inno Setup is quite easy to learn and use. Apart from the files that should be installed, it needs an ini-like configuration file that describes parameters relevant for the installer being created.


As an example, this is what FarrWebMetaSearch.iss, the Inno Setup file for FarrWebMetaSearch, looks like:

[Setup]
AppName=FarrWebMetaSearch
AppVersion=1.6.1
DefaultDirName={reg:HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Find and Run Robot_is1,InstallLocation|{pf}\FindAndRunRobot}\Plugins\FarrWebMetaSearch
OutputBaseFilename=FarrWebMetaSearchSetup
Uninstallable=no
Compression=lzma2
SolidCompression=yes
DirExistsWarning=no

[Files]
Source: "..\Deploy\CloseApp2.dll"; DestDir: "{tmp}"; Flags: onlyifdoesntexist
Source: "..\Deploy\FarrWebMetaSearch.dll"; DestDir: "{app}";
Source: "..\Deploy\FarrWebMetaSearch.ico"; DestDir: "{app}"
Source: "..\Deploy\FarrWebMetaSearch.dcupdate"; DestDir: "{app}"
Source: "..\Deploy\icons\*.ico"; DestDir: "{app}\icons"
Source: "..\Deploy\searches\*.conf"; DestDir: "{app}\searches"
Source: "..\Deploy\searches\*.ico"; DestDir: "{app}\searches"
Source: "..\Deploy\searches\*.html"; DestDir: "{app}\searches"
Source: "..\Deploy\FarrWebMetaSearch.html"; DestDir: "{app}"; Flags: isreadme

[Code]
// importing DLL functions from closeapp2.dll
procedure SendMsgUnloadPlugins_OnInstall(farrApplicationName: String);
external 'SendMsgUnloadPlugins@files:CloseApp2.dll cdecl setuponly';

procedure SendMsgLoadPlugins_OnInstall(farrApplicationName: String);
external 'SendMsgLoadPlugins@files:CloseApp2.dll cdecl setuponly';

//
procedure CurStepChanged(CurStep: TSetupStep);
begin
    case CurStep of
        ssInstall: SendMsgUnloadPlugins_OnInstall('FindAndRunRobot.exe');
        ssPostInstall: SendMsgLoadPlugins_OnInstall('FindAndRunRobot.exe');
    end;
end;


I've highlighted two interesting parts:
  • DefaultDirName: this defines the value for the {app} variable which is used in the [Files] section. I try to get the FARR installation path by querying the respective entry in the FARR uninstaller registry entry. If it's missing I'm assuming 'Program Files\FindAndRunRobot'. The user still has the possibility to choose a different installation location or directory name during the installation process.
  • CloseApp2.dll: This is a DLL provided by mouser that allows unloading and reloading the plugins so that they can be replaced while FARR is running. It can be downloaded from this thread.

The [Code] section at the end is where the unloading / reloading of the plugins happens.


I'm using a batch file to automate the creation of both the .zip package as well as the Setup.exe installer and use my UpdateVersion tool to update the version information in both the DCUpdater files as well as the Inno Setup .iss file.

@ECHO off
SET SevenZipPath="C:\Program Files\7-Zip\7z.exe"
SET InnoSetupPath="C:\Program Files\Inno Setup 5\ISCC.exe"

%PHI_PROJECTS%\UpdateVersion\Deploy\UpdateVersion.exe \
        -s %PHI_PROJECTS%\FarrWebMetaSearch\Deploy\FarrWebMetaSearch.dll \
        -t %PHI_PROJECTS%\FarrWebMetaSearch\Deploy\FarrWebMetaSearch.dcupdate \
        -t %PHI_PROJECTS%\FarrWebMetaSearch\Package\versioninfo.xml \
        -t %PHI_PROJECTS%\FarrWebMetaSearch\Package\FarrWebMetaSearch.iss
%SevenZipPath% a Output\FarrWebMetaSearch.zip %PHI_PROJECTS%\FarrWebMetaSearch\Deploy\*.* -r -xr!.svn -tzip -mx7
%InnoSetupPath% FarrWebMetaSearch.iss



I've tested the installer on Windows XP and Windows 7 32.
Logged

mouser
First Author
Administrator
*****
Posts: 33,386



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #1 on: December 22, 2010, 03:01:41 PM »

Thank you for sharing this!  thumbs up thumbs up
Logged
Pages: [1]   Go Up
  Reply  |  New Topic  |  Print  
 
Jump to:  
   Forum Home   Thread Marks Chat! Downloads Search Login Register  

DonationCoder.com | About Us
DonationCoder.com Forum | Powered by SMF
[ Page time: 0.034s | Server load: 0.14 ]