win32: Download deps during installation

This commit is contained in:
TingPing 2013-11-09 03:47:24 -05:00
parent 39aec3a45b
commit 3f1994f3bf

View File

@ -4,6 +4,9 @@
;#define APPARCH "x64"
;#define PROJECTDIR "C:\...\hexchat\win32\installer\"
;http://mitrich.net23.net/?/inno-download-plugin.html
#include <idp.iss>
[Setup]
AppName=HexChat
AppVersion={#APPVER}
@ -57,7 +60,7 @@ Name: "custom"; Description: "Custom Installation"; Flags: iscustom
Name: "libs"; Description: "HexChat"; Types: normal minimal custom; Flags: fixed
Name: "gtktheme"; Description: "GTK+ Theme"; Types: normal custom; Flags: disablenouninstallwarning
Name: "xctext"; Description: "HexChat-Text"; Types: custom; Flags: disablenouninstallwarning
Name: "xtm"; Description: "HexChat Theme Manager (Requires .NET 4.0)"; Types: normal custom; Flags: disablenouninstallwarning
Name: "xtm"; Description: "HexChat Theme Manager"; Types: normal custom; Flags: disablenouninstallwarning
Name: "translations"; Description: "Translations"; Types: normal custom; Flags: disablenouninstallwarning
Name: "plugins"; Description: "Plugins"; Types: custom; Flags: disablenouninstallwarning
Name: "plugins\checksum"; Description: "Checksum"; Types: custom; Flags: disablenouninstallwarning
@ -95,12 +98,11 @@ Root: HKCR; Subkey: ".hct\shell\open\command"; ValueType: string; ValueName: "";
[Run]
Filename: "{app}\hexchat.exe"; Description: "Run HexChat after closing the Wizard"; Flags: nowait postinstall skipifsilent
Filename: "https://www.microsoft.com/en-us/download/details.aspx?id=39315"; Description: "Download Visual C++ 2013 Redistributable"; Flags: shellexec runasoriginaluser postinstall skipifsilent
Filename: "http://www.microsoft.com/en-us/download/details.aspx?id=17851"; Description: "Download .NET 4.0 for theme manager"; Components: xtm; Flags: shellexec runasoriginaluser postinstall skipifsilent
Filename: "http://docs.hexchat.org/en/latest/changelog.html"; Description: "See what's changed"; Flags: shellexec runasoriginaluser postinstall skipifsilent unchecked
Filename: "http://hexchat.org/downloads.html"; Description: "Download Perl"; Flags: shellexec runasoriginaluser postinstall skipifsilent unchecked; Components: langs\perl and not langs\python
Filename: "http://hexchat.org/downloads.html"; Description: "Download Python"; Flags: shellexec runasoriginaluser postinstall skipifsilent unchecked; Components: langs\python and not langs\perl
Filename: "http://hexchat.org/downloads.html"; Description: "Download Perl and Python"; Flags: shellexec runasoriginaluser postinstall skipifsilent unchecked; Components: langs\perl and langs\python
Filename: "{tmp}\vcredist.exe"; Parameters: "/install /quiet /norestart"; StatusMsg: "Installing Visual C++ Redist"; Flags: skipifdoesntexist; Tasks: not portable
Filename: "{tmp}\dotnet4.exe"; Parameters: "/q /norestart"; StatusMsg: "Installing .NET"; Components: xtm; Flags: skipifdoesntexist; Tasks: not portable
Filename: "{tmp}\perl.msi"; StatusMsg: "Installing Perl"; Components: langs\perl; Flags: shellexec skipifdoesntexist; Tasks: not portable
Filename: "{tmp}\python.msi"; StatusMsg: "Installing Python"; Components: langs\python; Flags: shellexec skipifdoesntexist; Tasks: not portable
[Files]
Source: "portable-mode"; DestDir: "{app}"; Tasks: portable
@ -182,8 +184,89 @@ BeveledLabel= {#APPNAM}
procedure InitializeWizard;
begin
WizardForm.LicenseAcceptedRadio.Checked := True;
idpDownloadAfter(wpReady);
end;
/////////////////////////////////////////////////////////////////////
function GetSysDir(): String;
begin
#if APPARCH != "x64"
if IsWin64 then
Result := ExpandConstant('{syswow64}\')
else
Result := ExpandConstant('{sys}\');
#else
Result := ExpandConstant('{sys}\');
#endif
end;
/////////////////////////////////////////////////////////////////////
function CheckDLL(DLLName: String): Boolean;
var
ResultCode: Integer;
begin
if ExecAsOriginalUser(GetSysDir() + 'where.exe', '/Q ' + DLLName,
'', SW_HIDE, ewWaitUntilTerminated, ResultCode) then
Result := ResultCode = 0 // 0 is success
else
Result := False;
end;
/////////////////////////////////////////////////////////////////////
function CheckVCInstall(): Boolean;
begin
Result := FileExists(GetSysDir() + 'msvcr120.dll');;
end;
/////////////////////////////////////////////////////////////////////
function CheckDotNetInstall(): Boolean;
begin
Result := RegKeyExists(HKLM, 'SOFTWARE\Microsoft\NET Framework Setup\NDP\v4');
end;
/////////////////////////////////////////////////////////////////////
procedure CurPageChanged(CurPageID: Integer);
var
REDIST: String;
PERL: String;
PY2: String;
PY3: String;
DOTNET: String;
begin
if not IsTaskSelected('portable') and (CurPageID = wpReady) then
begin
idpClearFiles;
#if APPARCH == "x64"
REDIST := 'http://dl.hexchat.net/misc/vcredist_2013_x64.exe';
PERL := 'http://dl.hexchat.net/misc/perl/Perl%205.18.0%20x64.msi';
PY2 := 'http://python.org/ftp/python/2.7.5/python-2.7.5.amd64.msi';
PY3 := 'http://python.org/ftp/python/3.3.2/python-3.3.2.amd64.msi';
#else
REDIST := 'http://dl.hexchat.net/misc/vcredist_2013_x86.exe';
PERL := 'http://dl.hexchat.net/misc/perl/Perl%205.18.0%20x86.msi';
PY2 := 'http://python.org/ftp/python/2.7.5/python-2.7.5.msi';
PY3 := 'http://python.org/ftp/python/3.3.2/python-3.3.2.msi';
#endif
DOTNET := 'http://dl.hexchat.net/misc/dotnet_40.exe';
if not CheckVCInstall() then
idpAddFile(REDIST, ExpandConstant('{tmp}\vcredist.exe'));
if IsComponentSelected('xtm') and not CheckDotNetInstall() then
idpAddFile(DOTNET, ExpandConstant('{tmp}\dotnet4.exe'));
if IsComponentSelected('langs\perl') and not CheckDLL('perl518.dll') then
idpAddFile(PERL, ExpandConstant('{tmp}\perl.msi'));
if IsComponentSelected('langs\python\python2') and not CheckDLL('python27.dll') then
idpAddFile(PY2, ExpandConstant('{tmp}\python.msi'));
if IsComponentSelected('langs\python\python3') and not CheckDLL('python33.dll') then
idpAddFile(PY3, ExpandConstant('{tmp}\python.msi'));
end;
end;
/////////////////////////////////////////////////////////////////////
// these are required for x86->x64 or reverse upgrades
@ -211,7 +294,6 @@ begin
Result := sUnInstallString;
end;
/////////////////////////////////////////////////////////////////////
function IsUpgrade(): Boolean;
begin