-
Notifications
You must be signed in to change notification settings - Fork 14
/
inno_setup.iss
141 lines (127 loc) · 4.56 KB
/
inno_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
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "AYON"
#define SourceDir GetEnv("BUILD_SRC_DIR")
#define OutputDir GetEnv("BUILD_DST_DIR")
#define OutputFilename GetEnv("BUILD_DST_FILENAME")
#define AppVer GetEnv("BUILD_VERSION")
[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={#MyAppName}{#AppVer}
AppName={#MyAppName}
AppVersion={#AppVer}
; 'AppVerName' What is shown in app remove section of Control Panel
AppVerName={#MyAppName} {#AppVer}
AppPublisher=Ynput s.r.o
AppPublisherURL=https://ynput.io
AppSupportURL=https://ynput.io
AppUpdatesURL=https://ynput.io
; 'DefaultDirName' We don't use this value!!! Go to 'InitializeWizard'
DefaultDirName={autopf64}\Ynput\AYON\app\{#MyAppName} {#AppVer}
UsePreviousAppDir=no
DisableProgramGroupPage=yes
OutputBaseFilename={#OutputFilename}
AllowCancelDuringInstall=yes
; Uncomment the following line to run in non administrative install mode (install for current user only.)
;PrivilegesRequired=lowest
PrivilegesRequiredOverridesAllowed=dialog
SetupIconFile=common\ayon_common\resources\AYON.ico
OutputDir={#OutputDir}
Compression=lzma2
SolidCompression=yes
WizardStyle=modern
UninstallDisplayIcon={app}\ayon.exe
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
[InstallDelete]
; clean everything in previous installation folder
Type: filesandordirs; Name: "{app}"
[UninstallDelete]
; clean everything in installation folder - it is not recommended by inno setup documentation but we need to do it
; because there may be files that were not available in install files (like .pyc files)
Type: filesandordirs; Name: "{app}"
[Files]
; AfterInstall functions are called for each file that is extracted. That's
; why README.md is copied in separate file definition so we can run
; 'AfterInstallProc' only once, at the end.
Source: "{#SourceDir}\*"; DestDir: "{app}"; Excludes: "\README.md"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "{#SourceDir}\README.md"; DestDir: "{app}"; AfterInstall: AfterInstallProc();
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Run]
Filename: "{app}\ayon.exe"; Description: "{cm:LaunchProgram,AYON}"; Flags: nowait postinstall skipifsilent
[Code]
procedure AfterInstallProc();
var
ResultCode: Integer;
ExecParams: String;
OutputFilepath: String;
InstallDir: String;
begin
ExecParams := 'init-ayon-launcher';
if WizardIsTaskSelected('desktopicon') then
begin
ExecParams := ExecParams + ' --create-desktop-icons';
end;
Exec(ExpandConstant('{app}\ayon.exe'), ExecParams, '', SW_HIDE, ewWaitUntilTerminated, ResultCode);
OutputFilepath := GetEnv('AYON_INSTALL_EXE_OUTPUT');
InstallDir := ExpandConstant('{app}');
if Length(OutputFilepath) > 0 then
begin
if FileExists(OutputFilepath) then
begin
SaveStringToFile(OutputFilepath, InstallDir+'\ayon.exe', False)
end;
end;
end;
function CompareParameter(param, expected: String): Boolean;
begin
Result := False;
if Length(param) >= Length(expected) then
begin
if CompareText(Copy(param, 1, Length(expected)), expected) = 0 then
begin
Result := True;
end;
end;
end;
function GetParameter(expectedParam: String): String;
var
i : LongInt;
begin
Result := '';
for i := 0 to ParamCount() do
begin
if CompareParameter(ParamStr(i), '/' + expectedParam + '=') then
begin
Result := Copy(ParamStr(i), Length(expectedParam) + 3, Length(ParamStr(i)));
break;
end;
end;
end;
procedure InitializeWizard();
var
NewInstallFolder: String;
NewInstallRoot: String;
CurrentDefaultDir: String;
ProgramFilesDir: String;
begin
NewInstallFolder := GetParameter('DIR');
if Length(NewInstallFolder) = 0 then
begin
NewInstallRoot := GetParameter('INSTALLROOT');
if Length(NewInstallRoot) = 0 then
begin
CurrentDefaultDir := ExpandConstant('{autopf64}');
ProgramFilesDir := ExpandConstant('{commonpf64}');
if CompareStr(CurrentDefaultDir, ProgramFilesDir) = 0 then
NewInstallRoot := ExpandConstant('{commonpf64}') + '\Ynput'
else
NewInstallRoot := ExpandConstant('{localappdata}') + '\Ynput\AYON\app';
end;
NewInstallFolder := NewInstallRoot + '\{#MyAppName} {#AppVer}';
end;
WizardForm.DirEdit.Text := NewInstallFolder;
end;