-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathke-setup.iss
161 lines (141 loc) · 7.48 KB
/
ke-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
; Script generated by the Inno Script Studio Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "Kivy Easier"
#define MyAppVersion "2.0.3"
#define MyAppPublisher "Nathan Araújo"
#define MyAppURL "https://github.com/ntaraujo/kivy-easier"
#define MyAppExeName "Kivy-Easier.exe"
#define MyPath "C:\Users\Nathan\Documents\GitHub\kivy-easier"
[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={{0CB8BD9E-F07A-4771-83A5-A809391CF3A8}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={commonpf}\{#MyAppName}
DefaultGroupName={#MyAppName}
AllowNoIcons=yes
LicenseFile={#MyPath}\dev\LICENSE
OutputDir={#MyPath}\dev\new
OutputBaseFilename=ke-setup
SetupIconFile={#MyPath}\dev\logo.ico
Compression=lzma2/ultra64
SolidCompression=yes
LZMAUseSeparateProcess=yes
LZMADictionarySize=1048576
LZMANumFastBytes=273
WizardStyle=modern
InternalCompressLevel=ultra64
ChangesEnvironment=true
WizardImageFile={#MyPath}\dev\big.bmp
WizardSmallImageFile={#MyPath}\dev\small\*.bmp
ExtraDiskSpaceRequired=2
VersionInfoVersion=2
MinVersion=10.0.16299
ArchitecturesInstallIn64BitMode=x64 arm64 ia64
ArchitecturesAllowed=x64 arm64 ia64
WizardImageStretch=False
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
Name: "armenian"; MessagesFile: "compiler:Languages\Armenian.isl"
Name: "brazilianportuguese"; MessagesFile: "compiler:Languages\BrazilianPortuguese.isl"
Name: "catalan"; MessagesFile: "compiler:Languages\Catalan.isl"
Name: "corsican"; MessagesFile: "compiler:Languages\Corsican.isl"
Name: "czech"; MessagesFile: "compiler:Languages\Czech.isl"
Name: "danish"; MessagesFile: "compiler:Languages\Danish.isl"
Name: "dutch"; MessagesFile: "compiler:Languages\Dutch.isl"
Name: "finnish"; MessagesFile: "compiler:Languages\Finnish.isl"
Name: "french"; MessagesFile: "compiler:Languages\French.isl"
Name: "german"; MessagesFile: "compiler:Languages\German.isl"
Name: "hebrew"; MessagesFile: "compiler:Languages\Hebrew.isl"
Name: "icelandic"; MessagesFile: "compiler:Languages\Icelandic.isl"
Name: "italian"; MessagesFile: "compiler:Languages\Italian.isl"
Name: "japanese"; MessagesFile: "compiler:Languages\Japanese.isl"
Name: "norwegian"; MessagesFile: "compiler:Languages\Norwegian.isl"
Name: "polish"; MessagesFile: "compiler:Languages\Polish.isl"
Name: "portuguese"; MessagesFile: "compiler:Languages\Portuguese.isl"
Name: "russian"; MessagesFile: "compiler:Languages\Russian.isl"
Name: "slovak"; MessagesFile: "compiler:Languages\Slovak.isl"
Name: "slovenian"; MessagesFile: "compiler:Languages\Slovenian.isl"
Name: "spanish"; MessagesFile: "compiler:Languages\Spanish.isl"
Name: "turkish"; MessagesFile: "compiler:Languages\Turkish.isl"
Name: "ukrainian"; MessagesFile: "compiler:Languages\Ukrainian.isl"
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
Name: "envPath"; Description: "Add to PATH variable"
Name: "WADB"; Description: "Let workarounds for ADB ready"
Name: "Keyring"; Description: "Let PACMAN ready for future uses"
[Files]
Source: "{#MyPath}\dev\Kivy-Easier.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#MyPath}\dev\new\rootfs.tar.gz"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#MyPath}\bin\*"; DestDir: "{app}\bin"; Flags: ignoreversion recursesubdirs createallsubdirs
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
[Run]
Filename: "{app}\{#MyAppExeName}"; Flags: nowait postinstall skipifsilent unchecked; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"
Filename: "{app}\Kivy-Easier.exe"; Parameters: "install"; Flags: waituntilterminated runhidden; Description: "Extract rootfs.tar.gz and register on WSL"; StatusMsg: "Installing on WSL (can be slow)"; BeforeInstall: UpdateProgress(0); AfterInstall: UpdateProgress(20)
Filename: "{app}\Kivy-Easier.exe"; Parameters: "run pacman-key --init"; Flags: waituntilterminated runhidden; Description: "The keyring is needed to install packages with PACMAN"; StatusMsg: "Starting the keyring"; Tasks: Keyring; AfterInstall: UpdateProgress(40)
Filename: "{app}\Kivy-Easier.exe"; Parameters: "run pacman-key --populate"; Flags: runhidden; Description: "The keyring is needed to install packages with PACMAN"; StatusMsg: "Finishing the keyring"; Tasks: Keyring; AfterInstall: UpdateProgress(60)
Filename: "{app}\Kivy-Easier.exe"; Parameters: "run /root/scripts/wadb-settings.sh y"; Flags: runhidden; Description: "WADB needs your IP, a PORT value and the WSL version to work"; StatusMsg: "Configuring WADB"; Tasks: WADB; AfterInstall: UpdateProgress(80)
Filename: "{app}\Kivy-Easier.exe"; Parameters: "run /root/scripts/wadb-run.sh upgrade"; Flags: runhidden; Description: "WADB needs a Windows version of ADB to work"; StatusMsg: "Installing ADB for Windows"; Tasks: WADB; AfterInstall: UpdateProgress(100)
[UninstallRun]
Filename: "{app}\Kivy-Easier.exe"; Parameters: "clean"; Flags: waituntilterminated; RunOnceId: "WSLUninstall"
[Code]
const EnvironmentKey = 'SYSTEM\CurrentControlSet\Control\Session Manager\Environment';
procedure EnvAddPath(Path: string);
var
Paths: string;
begin
{ Retrieve current path (use empty string if entry not exists) }
if not RegQueryStringValue(HKEY_LOCAL_MACHINE, EnvironmentKey, 'Path', Paths)
then Paths := '';
{ Skip if string already found in path }
if Pos(';' + Uppercase(Path) + ';', ';' + Uppercase(Paths) + ';') > 0 then exit;
{ App string to the end of the path variable }
Paths := Paths + ';'+ Path +';'
{ Overwrite (or create if missing) path environment variable }
if RegWriteStringValue(HKEY_LOCAL_MACHINE, EnvironmentKey, 'Path', Paths)
then Log(Format('The [%s] added to PATH: [%s]', [Path, Paths]))
else Log(Format('Error while adding the [%s] to PATH: [%s]', [Path, Paths]));
end;
procedure EnvRemovePath(Path: string);
var
Paths: string;
P: Integer;
begin
{ Skip if registry entry not exists }
if not RegQueryStringValue(HKEY_LOCAL_MACHINE, EnvironmentKey, 'Path', Paths) then
exit;
{ Skip if string not found in path }
P := Pos(';' + Uppercase(Path) + ';', ';' + Uppercase(Paths) + ';');
if P = 0 then exit;
{ Update path variable }
Delete(Paths, P - 1, Length(Path) + 1);
{ Overwrite path environment variable }
if RegWriteStringValue(HKEY_LOCAL_MACHINE, EnvironmentKey, 'Path', Paths)
then Log(Format('The [%s] removed from PATH: [%s]', [Path, Paths]))
else Log(Format('Error while removing the [%s] from PATH: [%s]', [Path, Paths]));
end;
procedure CurStepChanged(CurStep: TSetupStep);
begin
if (CurStep = ssPostInstall) and WizardIsTaskSelected('envPath')
then EnvAddPath(ExpandConstant('{app}') + '\bin');
end;
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
begin
if CurUninstallStep = usPostUninstall
then EnvRemovePath(ExpandConstant('{app}') +'\bin');
end;
procedure UpdateProgress(Position: Integer);
begin
WizardForm.ProgressGauge.Position := Position * WizardForm.ProgressGauge.Max div 100;
end;