📄 patientrunnerserver.iss
字号:
; -- PatientRunnerServer.iss --
;
; Download your copy of Inno Setup from http://www.jrsoftware.org/isinfo.php
;
; This self-installer installs MySQL from the "noinstall zip archive". In addition, a customized MySQL configuration
; file is installed that enables the loopback interface (bind-address=127.0.0.1) for security reasons. When
; finished, the MySQL service is installed and started. The PatientRunner database is then initiated. Optionally,
; the sample templates are installed. Finally, the root password is set also for security reasons.
;
[Setup]
AppName=PatientRunner Server
AppVerName=PatientRunner Server V2.0
DefaultDirName={pf}\PatientRunnerServer
DefaultGroupName=PatientRunner Server
OutputBaseFilename=PatientRunnerServer20
LicenseFile=C:\PatientRunner\docs\gpl.txt
[Types]
Name: full; Description: Full installation
Name: custom; Description: Custom installation; Flags: iscustom
[Components]
Name: server; Description: Server Files; Types: full custom; Flags: fixed
Name: templates; Description: Sample documentation templates; Types: full custom
[Files]
Source: "C:\PatientRunner\docs\gpl.txt"; DestDir: "{app}"; Components: server
Source: "C:\PatientRunner\docs\server readme.txt"; DestDir: "{app}"; Components: server
Source: "C:\PatientRunner\mysql-4.0.24-win\*"; DestDir: "{app}\mysql\"; Flags: recursesubdirs; Components: server
; add "nocompression" for debugging
Source: "C:\PatientRunner\installer\my.ini"; DestDir: "{win}"; Components: server
Source: "C:\PatientRunner\installer\dbinit.sql"; DestDir: "{app}\mysql\bin\"; Flags: deleteafterinstall; Components: server
Source: "C:\PatientRunner\installer\templatesdbinit.sql"; DestDir: "{app}\mysql\bin\"; Flags: deleteafterinstall; Components: templates
[Icons]
Name: "{group}\WinMySQLAdmin Server Manager"; Filename: "{app}\mysql\bin\winmysqladmin.exe"
Name: "{group}\PatientRunner Website"; Filename: "http://sf.net/projects/patientrunner"
Name: "{group}\Readme"; Filename: "{app}\server readme.txt"
Name: "{group}\License"; Filename: "{app}\gpl.txt"
Name: "{group}\Uninstall"; Filename: "{uninstallexe}"
[Run]
Filename: "{app}\mysql\bin\mysqld-nt.exe"; Description: "Installing MySQL service..."; Parameters: --install; Components: server
Filename: "net"; Parameters: start MySQL; Description: "Starting MySQL service..."; Components: server
Filename: "{cmd}"; Description: "Initializing PatientRunner database..."; Parameters: "/c ""mysql.exe -uroot < dbinit.sql"""; WorkingDir: "{app}\mysql\bin\"; Components: server
Filename: "{cmd}"; Description: "Importing sample documentation templates..."; Parameters: "/c ""mysql.exe -uroot < templatesdbinit.sql"""; WorkingDir: "{app}\mysql\bin\"; Components: templates
[INI]
Filename: "{win}\my.ini"; Section: "mysqld"; Key: "bind-address"; String: "127.0.0.1"
Filename: "{win}\my.ini"; Section: "mysqld"; Key: "basedir"; String: "{app}\mysql"
Filename: "{win}\my.ini"; Section: "mysqld"; Key: "datadir"; String: "{app}\mysql\data"
[Code]
var PasswordPage: TInputQueryWizardPage;
procedure InitializeWizard;
begin
PasswordPage := CreateInputQueryPage(wpSelectComponents, 'Create Database Password', 'What should your database root password be?',
'Please enter your desired password, then click Next.');
PasswordPage.Add('Password: ', False);
end;
function NextButtonClick(CurPageID: Integer): Boolean;
begin
// Validate certain pages before allowing the user to proceed:
if CurPageID = PasswordPage.ID then
begin
if PasswordPage.Values[0] = '' then
begin
MsgBox('You must enter a password.', mbError, MB_OK);
Result := False;
end
else Result := True;
end
else
Result := True;
end;
procedure CurStepChanged(CurStep: TSetupStep);
var ResultCode: integer;
begin
//This procedure is called after everything in [Run] has finished executing. By this point, MySQL has been installed and
//all the databases have been initiated. The only thing left to do is lock down MySQL by setting the root password.
//no need to check IsComponentSelected() as server component is mandatory
if CurStep=ssPostInstall then
begin
if not Exec(ExpandConstant('{app}\mysql\bin\mysqladmin.exe'),'-uroot flush-privileges password "'+PasswordPage.Values[0]+'"', '', SW_SHOW,
ewWaitUntilTerminated, ResultCode) then MsgBox('An error occured while trying to set the MySQL root password.', mbError, MB_OK);
end;
end;
[UninstallRun]
; Stop Windows MySQL service
Filename: net; Parameters: stop MySQL; Components: server
; Now uninstall MySQL service
Filename: {app}\mysql\bin\mysqld-nt.exe; Parameters: --remove; Components: server
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -