-
Notifications
You must be signed in to change notification settings - Fork 0
/
rig.iss
90 lines (81 loc) · 2.69 KB
/
rig.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
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "rig -- The R Installation Manager"
#define MyAppVersion "0.7.0"
#define MyAppPublisher "Gabor Csardi"
#define MyAppURL "https://github.com/r-lib/rig"
#define MyAppExeName "rig.exe"
[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={{A6B1E72E-CEB0-4E4B-A444-6DD0DC0DF0C0}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={autopf}\rig
DefaultGroupName={#MyAppName}
DisableProgramGroupPage=yes
; Uncomment the following line to run in non administrative install mode (install for current user only.)
;PrivilegesRequired=lowest
OutputBaseFilename=mysetup
Compression=lzma
SolidCompression=yes
WizardStyle=modern
ArchitecturesInstallIn64BitMode="x64 arm64"
ArchitecturesAllowed="x64 arm64"
ChangesEnvironment=yes
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
[Files]
Source: "target\release\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion
Source: "gsudo.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "_rig.ps1"; DestDir: "{app}"; Flags: ignoreversion
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Registry]
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; \
ValueType: expandsz; ValueName: "Path"; ValueData: "{olddata};{autopf}\rig;{autopf}\R\bin"; \
Check: NeedsAddPath('{autopf}\rig')
[Code]
function NeedsAddPath(Param: string): boolean;
var
OrigPath: string;
begin
Param := ExpandConstant(Param);
if not RegQueryStringValue(HKEY_LOCAL_MACHINE,
'SYSTEM\CurrentControlSet\Control\Session Manager\Environment',
'Path', OrigPath)
then begin
Result := True;
exit;
end;
{ look for the path with leading and trailing semicolon }
{ Pos() returns 0 if not found }
Result := Pos(';' + Param + ';', ';' + OrigPath + ';') = 0;
end;
function GHPath(): boolean;
var
fileName : string;
lines : TArrayOfString;
begin
Result := true;
fileName := GetEnv('GITHUB_PATH');
if fileName <> '' then
begin
SetArrayLength(lines, 2);
lines[0] := ExpandConstant('{autopf}\rig');
lines[1] := ExpandConstant('{autopf}\R\bin');
Result := SaveStringsToFile(fileName, lines, true);
end;
exit;
end;
procedure CurStepChanged(CurStep: TSetupStep);
begin
if CurStep=ssDone then
begin
GHPath();
end
end;