-
Notifications
You must be signed in to change notification settings - Fork 0
/
package.iss
158 lines (137 loc) · 5 KB
/
package.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
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
[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={{C414BE13-5F10-48B7-AF92-9E4E7265D720}
AppName=Bibledit
AppVersion=5.1.021
AppPublisher=Teus Benschop
AppPublisherURL=https://bibledit.org
AppSupportURL=https://bibledit.org
AppUpdatesURL=https://bibledit.org
; Spaces in paths have not been tested on Windows.
; Therefore install Bibledit in C:\bibledit and do not allow the user to change the location.
DefaultDirName=C:\bibledit
DisableDirPage=yes
DefaultGroupName=Bibledit
LicenseFile=COPYING
; OutputDir=C:\bibledit-windows-packager
OutputBaseFilename=bibledit-5.1.021
Compression=lzma
SolidCompression=yes
; Create a log file in the user's TEMP directory detailing file installation and [Run] actions taken during the installation process.
; To find the location: Search %temp% in the Programs and Folders.
SetupLogging=yes
; Requires Microsoft Vista or higher.
MinVersion=0,6.1.0
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
[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: "*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs
[Dirs]
Name: "{app}"; Permissions: everyone-full
[Icons]
Name: "{group}\Bibledit"; Filename: "{app}\bibledit.exe"
Name: "{commondesktop}\Bibledit"; Filename: "{app}\bibledit.exe"; Tasks: desktopicon
Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\Bibledit"; Filename: "{app}\bibledit.exe"; Tasks: quicklaunchicon
[Run]
Filename: "{app}\bibledit.exe"; Description: "{cm:LaunchProgram,Bibledit}"; Flags: nowait postinstall skipifsilent
; The server.exe needs C++ 2015, 2017, 2019, 2022.
Filename: "{app}\VC2022_redist.x64.exe"; Parameters: "/install /passive /norestart"; Description: "Install Visual C++ Redistributable 2015, 2017, 2019, 2022"; Flags: runhidden skipifsilent
[Code]
procedure ReplaceValue (const FileName, Search, Replace: String);
var
I: Integer;
Line: String;
FileLines: TStringList;
begin
FileLines := TStringList.Create;
try
FileLines.LoadFromFile(FileName);
for I := 0 to FileLines.Count - 1 do
begin
Line := FileLines[I];
StringChangeEx (Line, Search, Replace, False);
FileLines[I] := Line;
end;
finally
FileLines.SaveToFile(FileName);
FileLines.Free;
end;
end;
function GetFileAttributes(lpFileName: PAnsiChar): DWORD;
external '[email protected] stdcall';
function SetFileAttributes(lpFileName: PAnsiChar; dwFileAttributes: DWORD): BOOL;
external '[email protected] stdcall';
procedure RemoveReadOnly(FileName : String);
var
Attr : DWord;
begin
Attr := GetFileAttributes(FileName);
if (Attr and 1) = 1 then
begin
Attr := Attr -1;
SetFileAttributes(FileName,Attr);
end;
end;
procedure DoPostInstall();
var
appPath: String;
bibleditWebSetupPath: String;
begin
appPath := ExpandConstant ('{app}');
// Set the setup folder to read write mode.
RemoveReadOnly (bibleditWebSetupPath);
end;
// Utility functions for Inno Setup
// used to add/remove programs from the windows firewall rules
// Code originally from http://news.jrsoftware.org/news/innosetup/msg43799.html
const
NET_FW_SCOPE_ALL = 0;
NET_FW_IP_VERSION_ANY = 2;
procedure SetFirewallException(AppName,FileName:string);
var
FirewallObject: Variant;
FirewallManager: Variant;
FirewallProfile: Variant;
begin
try
FirewallObject := CreateOleObject('HNetCfg.FwAuthorizedApplication');
FirewallObject.ProcessImageFileName := FileName;
FirewallObject.Name := AppName;
FirewallObject.Scope := NET_FW_SCOPE_ALL;
FirewallObject.IpVersion := NET_FW_IP_VERSION_ANY;
FirewallObject.Enabled := True;
FirewallManager := CreateOleObject('HNetCfg.FwMgr');
FirewallProfile := FirewallManager.LocalPolicy.CurrentProfile;
FirewallProfile.AuthorizedApplications.Add(FirewallObject);
except
end;
end;
procedure RemoveFirewallException( FileName:string );
var
FirewallManager: Variant;
FirewallProfile: Variant;
begin
try
FirewallManager := CreateOleObject('HNetCfg.FwMgr');
FirewallProfile := FirewallManager.LocalPolicy.CurrentProfile;
FireWallProfile.AuthorizedApplications.Remove(FileName);
except
end;
end;
procedure CurStepChanged(CurStep: TSetupStep);
begin
if CurStep=ssPostInstall then
SetFirewallException('Bibledit', ExpandConstant('{app}\')+'server.exe');
end;
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
begin
if CurUninstallStep=usPostUninstall then
RemoveFirewallException(ExpandConstant('{app}\')+'server.exe');
end;