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