Rev 47 | Blame | Compare with Previous | Last modification | View Log | Download
; Script generated by the Inno Setup Script Wizard.; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!#define MyAppName "Domoticz"#define AppId "{{EC4A5746-2655-43CD-AC5F-73F4B2C12F46}"#define MyAppPublisher "Domoticz.com"#define MyAppURL "http://www.domoticz.com/"#define MyAppExeName "domoticz.exe"#define NSSM "WinSI.exe"#define SetupBaseName "DomoticzSetup_"#define SetupName "DomoticzSetup"#dim Version[4]#expr ParseVersion("..\Release\domoticz.exe", Version[0], Version[1], Version[2], Version[3])#define AppVersion Str(Version[0]) + "." + Str(Version[1]) + "." + Str(Version[2]) + "." + Str(Version[3])#define ShortAppVersion Str(Version[0]) + "." + Str(Version[1]) + "." + Str(Version[3])#define ShortAppVersionUnderscore Str(Version[0]) + "_" + Str(Version[1]) + "." + Str(Version[3])[Setup]; NOTE: The value of AppId uniquely identifies this application.; Do not use the same AppId value in installers for other applications.; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)AppId={#AppId}AppName={#MyAppName}AppVersion={#ShortAppVersion}AppPublisher={#MyAppPublisher}AppPublisherURL={#MyAppURL}AppSupportURL={#MyAppURL}AppUpdatesURL={#MyAppURL}DefaultDirName={autopf}\{#MyAppName}DefaultGroupName={#MyAppName}AllowNoIcons=yesLicenseFile=..\..\License.txtOutputDir=.OutputBaseFilename={#SetupBaseName + ShortAppVersionUnderscore}SetupIconFile=install.icoCompression=lzma2PrivilegesRequired=adminSolidCompression=yesUsePreviousAppDir=yesDirExistsWarning=no[Tasks]Name: RunAsApp; Description: "Run as application "; Flags: exclusive;Name: RunAsApp\desktopicon; Description: {cm:CreateDesktopIcon}; GroupDescription: {cm:AdditionalIcons};Name: RunAsApp\quicklaunchicon; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked;Name: RunAsApp\startupicon; Description: "Create a Startup Shortcut"; GroupDescription: "{cm:AdditionalIcons}";Name: RunAsService; Description: "Run as service"; Flags: exclusive unchecked[Files]Source: "..\Release\domoticz.exe"; DestDir: "{app}"; Flags: ignoreversion;Source: "..\Release\*.dll"; DestDir: "{app}"; Flags: ignoreversionSource: "..\..\www\*"; DestDir: "{app}\www"; Flags: recursesubdirs createallsubdirs ignoreversionSource: "..\..\Config\*"; DestDir: "{app}\Config"; Flags: recursesubdirs createallsubdirs ignoreversionSource: "..\..\scripts\*"; DestDir: "{app}\scripts"; Flags: recursesubdirs createallsubdirs ignoreversionSource: "..\..\dzVents\*"; DestDir: "{app}\dzVents"; Flags: recursesubdirs createallsubdirs ignoreversionSource: "..\Windows Libraries\openzwave\OpenZWave.dll"; DestDir: {app}; Flags: ignoreversion;Source: "..\..\History.txt"; DestDir: "{app}"; Flags: ignoreversionSource: ".\WinSI.exe"; DestDir: "{app}"; Flags: ignoreversionSource: "..\..\server_cert.pem"; DestDir: "{app}"; Flags: onlyifdoesntexist uninsneveruninstallSource: "..\Windows Libraries\Redist\*"; DestDir: {app}; Flags: ignoreversion;Needed for 64bit Source: "..\Windows Libraries\Redist\vcruntime140_1.dll"; DestDir: {app}; Flags: ignoreversion[Icons]Name: "{group}\Domoticz"; Filename: "{app}\{#MyAppExeName}"; Parameters: "{code:GetParams}" ; Tasks: RunAsApp;;Name: "{group}\Start Domoticz service"; Filename: "sc"; Parameters: "start {#MyAppName}"; Tasks: RunAsService;;Name: "{group}\Stop Domoticz service"; Filename: "sc"; Parameters: "stop {#MyAppName}"; Tasks: RunAsService;Name: "{group}\{cm:ProgramOnTheWeb,Domoticz}"; Filename: "{#MyAppURL}";Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}";Name: "{commonstartup}\Domoticz"; Filename: "{app}\{#MyAppExeName}"; Parameters: "-startupdelay 10 {code:GetParams}" ; Tasks: RunAsApp\startupiconName: "{commondesktop}\Domoticz"; Filename: "{app}\{#MyAppExeName}"; Parameters: "{code:GetParams}" ; Tasks: RunAsApp\desktopiconName: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\Domoticz"; Filename: "{app}\{#MyAppExeName}"; Tasks: RunAsApp\quicklaunchicon[Setup]UninstallDisplayIcon={app}\{#MyAppExeName}[Run];Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, "&", "&&")}}"; Flags: nowait postinstall skipifsilent runascurrentuser; Tasks: RunAsAppFilename: "{app}\{#NSSM}"; Parameters: "install {#MyAppName} ""{app}\{#MyAppExeName}"" ""{code:GetParams}"""; Flags: runhidden; Tasks: RunAsServiceFilename: "{app}\{#NSSM}"; Parameters: "set {#MyAppName} DependOnService RpcSS LanmanWorkstation"; Flags: runhidden; Tasks: RunAsServiceFilename: "{sys}\net.exe"; Parameters: "start {#MyAppName}"; Flags: runhidden; Tasks: RunAsService[Dirs]Name: "{app}\backups\hourly"Name: "{app}\backups\daily"Name: "{app}\backups\monthly"Name: "{app}\log"; Permissions: everyone-full[PostCompile]Name: "S:\Domoticz\msbuild\WindowsInstaller\makedist.bat"; Flags: cmdprompt redirectoutput[InstallDelete]Type: filesandordirs; Name: "{app}\scripts\dzVents\documentation"Type: filesandordirs; Name: "{app}\scripts\dzVents\runtime"[Code]varConfigPage: TInputQueryWizardPage;LogConfigPage: TInputDirWizardPage;LogNoLogButton: TRadioButton;LogUseLogButton: TRadioButton;LogOldNextButtonOnClick: TNotifyEvent;function GetParams(Value: string): string;beginResult := '-www ' + ConfigPage.Values[0] + ' -sslwww ' + ConfigPage.Values[1];if (LogUseLogButton.Checked) thenbeginResult := Result + ' -log """' + LogConfigPage.Values[0] + '"""';end;end;{ WORKAROUND }{ Checkboxes and Radio buttons created on runtime do }{ not scale their height automatically. }{ See https://stackoverflow.com/q/30469660/850848 }procedure ScaleFixedHeightControl(Control: TButtonControl);beginControl.Height := ScaleY(Control.Height);end;procedure UseLogButtonClick(Sender: TObject);beginLogConfigPage.Edits[0].Enabled := LogUseLogButton.Checked;LogConfigPage.Buttons[0].Enabled := LogUseLogButton.Checked;end;procedure InitializeWizard;begin// Create the pageConfigPage := CreateInputQueryPage(wpSelectComponents,'User settings', 'Port number', 'Please specify the port on which Domoticz will run');// Add items (False means it's not a password edit)ConfigPage.Add('HTTP Port number:', False);// Set initial values (optional)ConfigPage.Values[0] := ExpandConstant('8080');ConfigPage.Add('HTTPS Port number:', False);// Set initial values (optional)ConfigPage.Values[1] := ExpandConstant('443');LogConfigPage := CreateInputDirPage(wpSelectComponents,'Select Log File Location', 'Where should the log file be stored?','The log file will be stored in the installation folder by default.'#13#10 +'If you do not wish to retain the log file permanently, select a temp folder'#13#10 +'(c:\windows\temp for instance).'#13#10 +'To continue, click Next. If you would like to select a different folder, click Browse.',False, 'New Folder');LogConfigPage.Add('');LogNoLogButton := TRadioButton.Create(WizardForm);LogNoLogButton.Caption := 'No external Log';LogNoLogButton.Checked := True;LogNoLogButton.Parent :=LogConfigPage.Surface;LogNoLogButton.Top := LogConfigPage.Edits[0].Top;LogNoLogButton.OnClick := @UseLogButtonClick;ScaleFixedHeightControl(LogNoLogButton);LogUseLogButton := TRadioButton.Create(WizardForm);LogUseLogButton.Caption := 'Use external Log';LogUseLogButton.Parent := LogConfigPage.Surface;LogUseLogButton.Top :=LogNoLogButton.Top + LogNoLogButton.Height + ScaleY(8);LogUseLogButton.OnClick := @UseLogButtonClick;ScaleFixedHeightControl(LogNoLogButton);LogConfigPage.Buttons[0].Top :=LogConfigPage.Buttons[0].Top +((LogUseLogButton.Top + LogUseLogButton.Height + ScaleY(8)) -LogConfigPage.Edits[0].Top);LogConfigPage.Edits[0].Top :=LogUseLogButton.Top + LogUseLogButton.Height + ScaleY(8);LogConfigPage.Edits[0].Left := LogConfigPage.Edits[0].Left + ScaleX(16);LogConfigPage.Edits[0].Width := LogConfigPage.Edits[0].Width - ScaleX(16);LogConfigPage.Edits[0].TabOrder := LogUseLogButton.TabOrder + 1;LogConfigPage.Buttons[0].TabOrder := LogConfigPage.Edits[0].TabOrder + 1;UseLogButtonClick(nil);LogConfigPage.Values[0] := WizardDirValue+'\log';end;procedure CurStepChanged(CurStep: TSetupStep);varResultCode: Integer;beginif(CurStep = ssInstall) then beginExec('sc',ExpandConstant('stop "{#MyAppName}"'),'', SW_HIDE, ewWaitUntilTerminated, ResultCode);Exec('sc',ExpandConstant('delete "{#MyAppName}"'),'', SW_HIDE, ewWaitUntilTerminated, ResultCode);end;end;procedure CurPageChanged(CurPageID: Integer);beginif CurPageID=wpFinished thenbeginWizardForm.FinishedLabel.Caption := 'Setup has finished installing Domoticz. If you installed as a service, Domoticz will now start automatically.' + #13#10 + 'Otherwise you may start Domoticz from the start menu.'+ #13#10#13#10 + 'Click Finish to exit Setup.';end;end;procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);varResultCode: Integer;beginif CurUninstallStep = usUninstall then beginExec('sc',ExpandConstant('stop "{#MyAppName}"'),'', SW_HIDE, ewWaitUntilTerminated, ResultCode);Exec('sc',ExpandConstant('delete "{#MyAppName}"'),'', SW_HIDE, ewWaitUntilTerminated, ResultCode);sleep(4000); //allow service to stop before deleting filesend;end;function InitializeSetup: Boolean;beginif RegValueExists(HKEY_LOCAL_MACHINE,'Software\Microsoft\Windows\CurrentVersion\Uninstall\{#emit StringChange(SetupSetting("AppId"),"{{","{")}_is1', 'UninstallString') then beginMsgBox('You are upgrading an existing installation of Domoticz.'+ chr(13) +'It is recommended to reboot your system after this upgrade'+ chr(13) +'in order to avoid com port issues.', mbInformation, MB_OK);end;Result := True;end;