Files
Thermo_SIM 9de1286290 Fix Setup
2021-03-15 12:38:22 +01:00

217 lines
7.8 KiB
Plaintext

;================================= 01.02.21 =====
; CMS S.p.A. - UX-HMI Office
;
; Setup for Active
; Inno Setup Compiler version 5.6.0
;==================================================
#define AppName "CMS Active"
#define FolderName "Thermo.Active"
#define MyAppPublisher "CMS"
#define MyAppURL "https://www.scmgroup.com/it/cms"
#define MyAppExeName "Thermo.Active.exe"
#define ProjectPath ""
#define MySourcePath ProjectPath + "bin"
#define WwwRootPath ProjectPath + "wwwroot"
#define IconsPath ProjectPath + "Desktop_Link"
#define ToolInstallerPath "SetupTools"
#define MyAppVersion GetFileVersion( MySourcePath + '\Thermo.Active.exe')
#define OutBaseDir "C:\CMS\AutoBuild"
#define OutDir OutBaseDir + "\" + MyAppVersion
; Support installers
; .Net
; MariaDb
; cms_inv_diag
#define DotNetInstallerName "NDP462-KB3151800-x86-x64-AllOS-ENU.exe"
#define MariaDBInstallerName "mariadb-10.3.13-winx64.msi"
#define CmsInvDiagPath "cms_inv_diag"
[Setup]
AppName={#AppName}
AppVersion={#MyAppVersion}
AppVerName={#AppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DisableDirPage=true
DisableProgramGroupPage=yes
Compression=lzma
SolidCompression=true
OutputDir={#OutDir}
UsePreviousAppDir=no
OutputBaseFilename=ActiveSetup_{#MyAppVersion}
VersionInfoVersion={#MyAppVersion}
VersionInfoCompany={#MyAppPublisher}
VersionInfoTextVersion={#MyAppVersion}
VersionInfoCopyright={#MyAppPublisher}
DefaultDirName = C:\CMS\{#FolderName}\{#FolderName}
WindowVisible=false
PrivilegesRequired=admin
; Setup installation type
[Types]
Name: custom; Description: CMS installation; Flags: iscustom
; Set NC types, this types are used to configure server config file
[Components]
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
Name: "italian"; MessagesFile: "compiler:Languages\Italian.isl"
[CustomMessages]
english.CreateStartupIcon=Create Startup &icon
italian.CreateStartupIcon = Crea il collegamento in &Esecuzione Automatica
english.InstallDotNet = Install .Net 4.6.2
english.InstallMariaDB = Install MariaDB
italian.InstallDotNet = Installa .Net 4.6.2
italian.InstallMariaDB = Installa MariaDB
italian.InstallingMariaDB = Installando MariaDB
english.InstallingMariaDB = Installing MariaDB
italian.InstallingDotNet = Installando .Net
english.InstallingDotNet = Installing .Net
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: checkablealone;
Name: quicklaunchicon; Description: {cm:CreateQuickLaunchIcon}; GroupDescription: {cm:AdditionalIcons}; Flags: checkablealone;
Name: startupicon; Description: {cm:CreateStartupIcon}; GroupDescription: {cm:AdditionalIcons}; Flags: checkablealone;
[Files]
Source: "{#MySourcePath}\Thermo.Active.exe"; DestDir: "{app}"; Flags: ignoreversion
; Path to exe resources (dll, xml, config)
Source: "{#MySourcePath}\*.config"; DestDir: "{app}"; Flags: ignoreversion;
; Configuration files
Source: "{#MySourcePath}\Config\*.xml"; DestDir: "{app}\Config\"; Flags: ignoreversion;
; Languages
Source: "{#MySourcePath}\languages\*.*"; DestDir: "{app}\languages\"; Flags: ignoreversion;
; dll
Source: "{#MySourcePath}\dll\*.*"; DestDir: "{app}\dll\"; Flags: ignoreversion recursesubdirs;
; Client copy
Source: "{#MySourcePath}\Client\*.*"; DestDir: "{app}\Client\"; Flags: recursesubdirs ignoreversion; AfterInstall: DeleteLocalStorage
; WWWRoot Files
Source: "{#WwwRootPath}\favicon.ico"; DestDir: "{app}\view\"; Flags: ignoreversion;
Source: "{#WwwRootPath}\index.html"; DestDir: "{app}\view\"; Flags: ignoreversion;
; WWWRoot Directories
Source: "{#WwwRootPath}\dist\*"; DestDir: "{app}\view\dist\"; Flags: recursesubdirs ignoreversion;
Source: "{#WwwRootPath}\libs\*"; DestDir: "{app}\view\libs\"; Flags: recursesubdirs ignoreversion;
Source: "{#WwwRootPath}\assets\*"; DestDir: "{app}\view\assets\"; Flags: recursesubdirs ignoreversion;
Source: "{#WwwRootPath}\scripts\*"; DestDir: "{app}\view\scripts\"; Flags: recursesubdirs ignoreversion;
;.Net Installer
Source: {#ToolInstallerPath}\{#DotNetInstallerName}; DestDir: {tmp}; Flags: deleteafterinstall;
;Check: FrameworkIsNotInstalled
Source: {#ToolInstallerPath}\{#MariaDBInstallerName}; DestDir: {tmp}; Flags: deleteafterinstall;
; --- UTILS
; Fanuc scripts - TEAMVIEWER
Source: "{#ProjectPath}Utility\*"; DestDir: "{app}\..\Utility\"; Flags: recursesubdirs ignoreversion;
[Icons]
; Default icons
Name: {group}\{#AppName}; Filename: {app}\{#MyAppExeName};
Name: {userdesktop}\{#AppName}; Filename: {app}\{#MyAppExeName}; Tasks: desktopicon;
Name: {userappdata}\Microsoft\Internet Explorer\Quick Launch\{#AppName}; Filename: {app}\{#MyAppExeName}; Tasks: quicklaunchicon;
Name: {userstartup}\{#AppName}; Filename: {app}\{#MyAppExeName}; Tasks: startupicon;
[Run]
; Install .net
Filename: {tmp}\{#DotNetInstallerName}; Description: {cm:InstallDotNet}; WorkingDir:{tmp}; StatusMsg: {cm:InstallingDotNet}; Check: NetFrameworkNeedInstall
;Check: NetFrameworkIsMissing
; Install MariaDb
Filename: "msiexec.exe"; Description: {cm:InstallDotNet}; WorkingDir:{tmp}; StatusMsg: {cm:InstallingMariaDB}; Parameters: "/i {tmp}\{#MariaDBInstallerName}"; Check: CheckHeidiSQLNeedInstall;
/// MinVersion: 10
[Registry]
Root: HKLM; Subkey: "SOFTWARE\Microsoft\Windows\CurrentVersion\Run"; ValueType: string; ValueName: "Active"; ValueData: "C:\CMS\ACTIVE\Active\Active.exe"; MinVersion: 10;
[Code]
///////////// SiemensPath ///////////////////////////////
var
CheckBoxIni: TCheckBox;
OverwriteConfig: Boolean;
///////////////// Check .NET Framework 4.6.2 ////////////////////////////////////
function NetFrameworkNeedInstall(): Boolean;
var
bSuccess: Boolean;
regVersion: Cardinal;
begin
Result := True;
bSuccess := RegQueryDWordValue(HKLM, 'Software\Microsoft\NET Framework Setup\NDP\v4\Full', 'Release', regVersion);
if (True = bSuccess) and (regVersion >= 394802) then begin
Result := False;
end;
end;
///////////// Check heidiSQL /////////////////
function CheckHeidiSQLNeedInstall: Boolean;
begin
if FileExists(ExpandConstant('C:\Program Files (x86)\Common Files\MariaDBShared\HeidiSQL\heidisql.exe'))
then Result:= false
else
begin
Result:= True
end;
end;
/////////////////// CheckConfigExistence /////////////////////////////
function OverwriteConfigModal: Boolean;
begin
if DirExists(ExpandConstant('C:\CMS\Thermo.Active\Thermo.Active\Config')) then begin
// Ask the user a Yes/No question, defaulting to No
if not (MsgBox('La cartella "Config" esiste già. Vuoi sovrascriverla?', mbConfirmation, MB_YESNO) = IDYES) then
begin
// user clicked NO
Result:= false;
Exit;
end;
end;
Result:= True;
end;
function GetOverwriteConfig: Boolean;
begin
Result:= OverwriteConfig;
end;
/////////////////// DeleteLocalStorage //////////////////////
procedure DeleteLocalStorage;
begin
DelTree(ExpandConstant('{app}\Client\LocalStorage'), True, True, True);
end;
///////////// InitializeWizard //////////////////////////
procedure InitializeWizard();
begin
OverwriteConfig := OverwriteConfigModal;
end;
procedure CurStepChanged(CurStep: TSetupStep);
begin
if CurStep = ssPostInstall then
begin
DeleteLocalStorage;
end;
end;