-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.iss
182 lines (159 loc) · 8.54 KB
/
setup.iss
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "Ïàíåëü tqma3352"
#define MyAppVersion "1.0"
#define MyAppPublisher ""
#define MyAppURL ""
#define MyAppExeName "panel.exe"
#define MyProjectPath "C:\projects\panel\panel"
#define MyQtIntallPath "C:\Qt\5.8\mingw53_32"
[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={{8A2C754B-BDD2-4FE8-A696-9EDB62E1FCB6}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
VersionInfoVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName}
DefaultGroupName={#MyAppName}
OutputBaseFilename=setup
;SetupIconFile={#MyProjectPath}\asu\icon.ico
Compression=lzma
SolidCompression=yes
PrivilegesRequired=admin
ChangesEnvironment=yes
[Languages]
Name: "russian"; MessagesFile: "compiler:Languages\Russian.isl"
[Dirs]
Name: "{app}"; Permissions: users-modify
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked; OnlyBelowVersion: 0,6.1
[Files]
Source: "{#MyProjectPath}\build\pc\Release\panel.exe"; DestDir: "{app}"; Flags: ignoreversion;
Source: "{#MyProjectPath}\install\win\*"; DestDir: "{app}"; Flags: ignoreversion;
Source: "{#MyQtIntallPath}\bin\Qt5Widgets.dll"; DestDir: "{app}"; Flags: ignoreversion;
Source: "{#MyQtIntallPath}\bin\Qt5Script.dll"; DestDir: "{app}"; Flags: ignoreversion;
Source: "{#MyQtIntallPath}\bin\Qt5Network.dll"; DestDir: "{app}"; Flags: ignoreversion;
Source: "{#MyQtIntallPath}\bin\Qt5Gui.dll"; DestDir: "{app}"; Flags: ignoreversion;
Source: "{#MyQtIntallPath}\bin\Qt5Core.dll"; DestDir: "{app}"; Flags: ignoreversion;
Source: "{#MyQtIntallPath}\bin\libwinpthread-1.dll"; DestDir: "{app}"; Flags: ignoreversion;
Source: "{#MyQtIntallPath}\bin\libstdc++-6.dll"; DestDir: "{app}"; Flags: ignoreversion;
Source: "{#MyQtIntallPath}\bin\libgcc_s_dw2-1.dll"; DestDir: "{app}"; Flags: ignoreversion;
Source: "{#MyQtIntallPath}\plugins\platforms\qwindows.dll"; DestDir: "{app}\platforms"; Flags: ignoreversion;
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: quicklaunchicon
[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent runascurrentuser
[UninstallDelete]
;[Registry]
;Root: HKCU; Subkey: "Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers"; ValueName: "{app}\bin\{#MyAppExeName}"; ValueType: string; ValueData: "RUNASADMIN"; Flags: createvalueifdoesntexist uninsdeletevalue;
;Root: HKLM; Subkey: "Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers"; ValueName: "{app}\bin\{#MyAppExeName}"; ValueType: string; ValueData: "RUNASADMIN"; Flags: createvalueifdoesntexist uninsdeletevalue;
;Root: HKCU; Subkey: "Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers"; ValueName: "{app}\lib\upsOnConnected.bat"; ValueType: string; ValueData: "RUNASADMIN"; Flags: createvalueifdoesntexist uninsdeletevalue;
;Root: HKLM; Subkey: "Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers"; ValueName: "{app}\lib\upsOnConnected.bat"; ValueType: string; ValueData: "RUNASADMIN"; Flags: createvalueifdoesntexist uninsdeletevalue;
;Root: HKCU; Subkey: "Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers"; ValueName: "{app}\lib\upsOnDisconnected.bat"; ValueType: string; ValueData: "RUNASADMIN"; Flags: createvalueifdoesntexist uninsdeletevalue;
;Root: HKLM; Subkey: "Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers"; ValueName: "{app}\lib\upsOnDisconnected.bat"; ValueType: string; ValueData: "RUNASADMIN"; Flags: createvalueifdoesntexist uninsdeletevalue;
;Root: HKCU; Subkey: "Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers"; ValueName: "{app}\lib\upsOn.bat"; ValueType: string; ValueData: "RUNASADMIN"; Flags: createvalueifdoesntexist uninsdeletevalue;
;Root: HKLM; Subkey: "Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers"; ValueName: "{app}\lib\upsOn.bat"; ValueType: string; ValueData: "RUNASADMIN"; Flags: createvalueifdoesntexist uninsdeletevalue;
;Root: HKCU; Subkey: "Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers"; ValueName: "{app}\lib\upsOff.bat"; ValueType: string; ValueData: "RUNASADMIN"; Flags: createvalueifdoesntexist uninsdeletevalue;
;Root: HKLM; Subkey: "Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers"; ValueName: "{app}\lib\upsOff.bat"; ValueType: string; ValueData: "RUNASADMIN"; Flags: createvalueifdoesntexist uninsdeletevalue;
[Code]
function IsFrameworkInstalled: boolean;
begin
//Result := RegKeyExists(HKLM,'SOFTWARE\Microsoft\.NETFramework\v4.0.30319');
Result := RegKeyExists(HKLM,'SOFTWARE\Microsoft\.NETFramework\policy\v4.0');
end;
function IsVBInstalled: boolean;
begin
Result := RegKeyExists(HKLM,'SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{0F8B4D17-8E99-3C8B-9558-9099C6F85A71}');
end;
procedure RunOtherInstaller1;
var
ResultCode: Integer;
begin
if (IsVBInstalled = false) then begin
if not Exec(ExpandConstant('{app}\VisualBasicPowerPacksSetup.exe'), '', '', SW_SHOWNORMAL,
ewWaitUntilTerminated, ResultCode)
then
MsgBox('Other installer failed to run!' + #13#10 +
SysErrorMessage(ResultCode), mbError, MB_OK);
end
end;
procedure RunOtherInstaller2;
var
ResultCode: Integer;
begin
if (IsFrameworkInstalled = false) then begin
if not Exec(ExpandConstant('{app}\NDP451-KB2858728-x86-x64-AllOS-ENU.exe'), '', '', SW_SHOWNORMAL,
ewWaitUntilTerminated, ResultCode)
then
MsgBox('Other installer failed to run!' + #13#10 +
SysErrorMessage(ResultCode), mbError, MB_OK);
end;
end;
//èçìåíåíèÿ PATH
procedure SetEnvironmentPath(NewPath: String);
var
PathStr: String;
begin
{Ïîëó÷àåì çíà÷åíèå òåêóùåãî ñèñòåìíîãî %PATH%}
RegQueryStringValue(HKLM,'SYSTEM\CurrentControlSet\Control\Session Manager\Environment', 'Path', PathStr);
{Èùåì NewPath â òåêóùåì ñèñòåìíîì %PATH%}
if Pos(NewPath, PathStr) <= 0 then // Åñëè â òåêóùåì %PATH% íå íàéäåíî NewPath;
begin
PathStr := NewPath + ';' + PathStr;
RegWriteStringValue(HKLM,'SYSTEM\CurrentControlSet\Control\Session Manager\Environment', 'Path', PathStr);
end;
end;
procedure DeleteEnvironmentPath(OldPath: String);
var
PathStr: String;
StartPos, Len: Integer;
begin
{Ïîëó÷àåì çíà÷åíèå òåêóùåãî ñèñòåìíîãî %PATH%}
RegQueryStringValue(HKLM,'SYSTEM\CurrentControlSet\Control\Session Manager\Environment', 'Path', PathStr);
{Èùåì OldPath c ";" â òåêóùåì ñèñòåìíîì %PATH%}
StartPos := Pos(OldPath + ';', PathStr); //èíäåêñ íà÷àëà âõîæäåíèÿ OldPath c ";"
if StartPos > 0 then // Åñëè â òåêóùåì %PATH% íàéäåí OldPath;
begin
Len := Length(OldPath + ';'); //äëèíà ñòðîêè OldPath c ";"
Delete(PathStr, StartPos, Len); // óäàëÿåì èç òåêóùåãî ñèñòåìíîãî %PATH% (PathStr) ñòðîêó OldPath c ";"
{Çàïèñûâàåì èçìåíåíèÿ â ðååñòð}
RegWriteStringValue(HKLM,'SYSTEM\CurrentControlSet\Control\Session Manager\Environment', 'Path', PathStr);
Exit;
end;
{Èùåì OldPath áåç ";" â òåêóùåì ñèñòåìíîì %PATH%}
StartPos := Pos(OldPath, PathStr);
if StartPos > 0 then // Åñëè â òåêóùåì %PATH% íàéäåí OldPath áåç ";"
begin
Len := Length(OldPath); //èíäåêñ íà÷àëà âõîæäåíèÿ OldPath áåç ";"
Delete(PathStr, StartPos, Len); // óäàëÿåì èç òåêóùåãî ñèñòåìíîãî %PATH% (PathStr) ñòðîêó OldPath áåç ";"
{Çàïèñûâàåì èçìåíåíèÿ â ðååñòð}
RegWriteStringValue(HKLM,'SYSTEM\CurrentControlSet\Control\Session Manager\Environment', 'Path', PathStr);
end;
end;
{Ïîñëå èíñòàëëÿöèè:}
procedure CurStepChanged(CurStep: TSetupStep);
begin
if CurStep = ssPostInstall then
begin
SetEnvironmentPath(ExpandConstant('{app}\bin'));
end;
end;
{Ïåðåä äåèíñòàëëÿöèåé:}
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
begin
if CurUninstallStep = usUninstall then
begin
DeleteEnvironmentPath(ExpandConstant('{app}\bin'));
end;
end;