603e56f91964c6b75f5d0f26fdf480675b42dbe1
[public/netxms.git] / src / install / windows / common.iss
1 [Dirs]
2 Name: "{app}\etc"
3 Name: "{app}\database"
4 Name: "{app}\var\backgrounds"
5 Name: "{app}\var\images"
6 Name: "{app}\var\packages"
7 Name: "{app}\var\shared"
8
9 [Registry]
10 Root: HKLM; Subkey: "Software\NetXMS"; Flags: uninsdeletekeyifempty; Components: server
11 Root: HKLM; Subkey: "Software\NetXMS\Server"; Flags: uninsdeletekey; Components: server
12 Root: HKLM; Subkey: "Software\NetXMS\Server"; ValueType: string; ValueName: "InstallPath"; ValueData: "{app}"; Components: server
13 Root: HKLM; Subkey: "Software\NetXMS\Server"; ValueType: string; ValueName: "ConfigFile"; ValueData: "{app}\etc\netxmsd.conf"; Components: server
14
15 [Run]
16 Filename: "{app}\var\rm.exe"; Parameters: "-f ""{app}\bin\*.manifest"""; WorkingDir: "{app}\bin"; StatusMsg: "Removing old manifest files..."; Flags: runhidden
17 Filename: "{app}\var\rm.exe"; Parameters: "-rf ""{app}\bin\Microsoft.VC80.*"""; WorkingDir: "{app}\var"; StatusMsg: "Removing old CRT files..."; Flags: runhidden
18 Filename: "{app}\var\rm.exe"; Parameters: "-rf ""{app}\lib\ndd\Microsoft.VC80.CRT"""; WorkingDir: "{app}\var"; StatusMsg: "Removing old CRT files..."; Flags: runhidden
19 Filename: "{app}\var\vcredist.exe"; WorkingDir: "{app}\var"; StatusMsg: "Installing Visual C++ runtime..."; Flags: waituntilterminated
20 Filename: "{app}\bin\nxmibc.exe"; Parameters: "-z -d ""{app}\var\mibs"" -o ""{app}\var\mibs\netxms.mib"""; WorkingDir: "{app}\bin"; StatusMsg: "Compiling MIB files..."; Flags: runhidden; Components: server
21 Filename: "{app}\bin\nxconfig.exe"; Parameters: "--create-agent-config"; WorkingDir: "{app}\bin"; StatusMsg: "Creating agent's configuration file..."; Components: server
22 Filename: "{app}\bin\nxagentd.exe"; Parameters: "-c ""{app}\etc\nxagentd.conf"" -I"; WorkingDir: "{app}\bin"; StatusMsg: "Installing agent service..."; Flags: runhidden; Components: server
23 Filename: "{app}\bin\nxagentd.exe"; Parameters: "-s"; WorkingDir: "{app}\bin"; StatusMsg: "Starting agent service..."; Flags: runhidden; Components: server
24 Filename: "{app}\bin\nxconfig.exe"; Parameters: "--configure-if-needed"; WorkingDir: "{app}\bin"; StatusMsg: "Running server configuration wizard..."; Components: server
25 Filename: "{app}\bin\nxdbmgr.exe"; Parameters: "-c ""{app}\etc\netxmsd.conf"" upgrade"; WorkingDir: "{app}\bin"; StatusMsg: "Upgrading database..."; Flags: runhidden; Components: server
26 Filename: "{app}\bin\netxmsd.exe"; Parameters: "--check-service"; WorkingDir: "{app}\bin"; StatusMsg: "Checking core service configuration..."; Flags: runhidden; Components: server
27 Filename: "{app}\bin\netxmsd.exe"; Parameters: "-s"; WorkingDir: "{app}\bin"; StatusMsg: "Starting core service..."; Flags: runhidden; Components: server
28
29 [UninstallRun]
30 Filename: "{app}\bin\netxmsd.exe"; Parameters: "-S"; StatusMsg: "Stopping core service..."; RunOnceId: "StopCoreService"; Flags: runhidden; Components: server
31 Filename: "{app}\bin\netxmsd.exe"; Parameters: "-R"; StatusMsg: "Uninstalling core service..."; RunOnceId: "DelCoreService"; Flags: runhidden; Components: server
32 Filename: "{app}\bin\nxagentd.exe"; Parameters: "-S"; StatusMsg: "Stopping agent service..."; RunOnceId: "StopAgentService"; Flags: runhidden; Components: server
33 Filename: "{app}\bin\nxagentd.exe"; Parameters: "-R"; StatusMsg: "Uninstalling agent service..."; RunOnceId: "DelAgentService"; Flags: runhidden; Components: server
34
35 [Code]
36 Var
37 HttpdSettingsPage: TInputQueryWizardPage;
38 flagStartConsole: Boolean;
39
40 Function InitializeSetup(): Boolean;
41 Var
42 i, nCount : Integer;
43 param : String;
44 Begin
45 // Set default values for flags
46 flagStartConsole := FALSE;
47
48 // Parse command line parameters
49 nCount := ParamCount;
50 For i := 1 To nCount Do Begin
51 param := ParamStr(i);
52
53 If Pos('/RUNCONSOLE', param) = 1 Then Begin
54 flagStartConsole := TRUE;
55 End;
56 End;
57
58 Result := TRUE;
59 End;
60
61 Procedure DeinitializeSetup;
62 Var
63 strExecName: String;
64 iResult: Integer;
65 Begin
66 If flagStartConsole Then Begin
67 strExecName := ExpandConstant('{app}\bin\nxcon.exe');
68 If FileExists(strExecName) Then
69 Begin
70 Exec(strExecName, '', ExpandConstant('{app}\bin'), SW_SHOW, ewNoWait, iResult);
71 End;
72 End;
73 End;
74
75 Procedure StopAllServices;
76 Var
77 iResult: Integer;
78 Begin
79 Exec('net.exe', 'stop NetXMSCore', ExpandConstant('{app}\bin'), 0, ewWaitUntilTerminated, iResult);
80 Exec('net.exe', 'stop nxhttpd', ExpandConstant('{app}\bin'), 0, ewWaitUntilTerminated, iResult);
81 Exec('net.exe', 'stop NetXMSAgentdW32', ExpandConstant('{app}\bin'), 0, ewWaitUntilTerminated, iResult);
82 End;
83
84 Procedure InitializeWizard;
85 Begin
86 HttpdSettingsPage := CreateInputQueryPage(wpSelectTasks,
87 'Select Master Server', 'Where is master server for web interface?',
88 'Please enter host name or IP address of NetXMS master server. NetXMS web interface you are installing will provide connectivity to that server.');
89 HttpdSettingsPage.Add('NetXMS server:', False);
90 HttpdSettingsPage.Values[0] := GetPreviousData('MasterServer', 'localhost');
91 End;
92
93 Procedure RegisterPreviousData(PreviousDataKey: Integer);
94 Begin
95 SetPreviousData(PreviousDataKey, 'MasterServer', HttpdSettingsPage.Values[0]);
96 End;
97
98 Function ShouldSkipPage(PageID: Integer): Boolean;
99 Begin
100 If PageID = HttpdSettingsPage.ID Then
101 Result := not IsComponentSelected('websrv')
102 Else
103 Result := False;
104 End;
105
106 Function GetMasterServer(Param: String): String;
107 Begin
108 Result := HttpdSettingsPage.Values[0];
109 End;