topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Thursday April 18, 2024, 2:48 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: FARR plugin installer with Inno Setup  (Read 4938 times)

phitsc

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 1,198
    • View Profile
    • Donate to Member
FARR plugin installer with Inno Setup
« on: December 22, 2010, 02: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.

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,900
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: FARR plugin installer with Inno Setup
« Reply #1 on: December 22, 2010, 03:01 PM »
Thank you for sharing this!  :up: :up: