inno setup net vc 環境檢測 apahce php jdk mssql server 打包成安裝包

 將sqlserver安裝配置文件打包到setup.exe中

OutPut中所需要的文件及文件夾

 

inno setup腳本文件需要用到的文件

所有到到腳本文件

autoInstallapache.bat

@echo off
cd ..
set apacheroot=%~dp0%apache
echo %apacheroot%
cd %apacheroot% 
bin\httpd -k install
bin\httpd -k start

autoInstalljdk.bat

@echo off
cd ..
set jdkpath=%~dp0%javasdk
echo %jdkpath%
wmic ENVIRONMENT where "name='JAVA_HOME'" delete
wmic ENVIRONMENT create name="JAVA_HOME",username="<system>",VariableValue="%jdkpath%"
wmic ENVIRONMENT where "name='PATH' and username='<system>'" set VariableValue="%PATH%;%%JAVA_HOME%%\bin;%%JAVA_HOME%%\jre\bin;"

autoUnInstallapache.bat

 

@echo off
cd ..
set apacheroot=%~dp0%apache
echo %apacheroot%
cd %apacheroot% 
bin\httpd -k stop
bin\httpd -k uninstall

 

; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!


#define MyAppName "平臺"
#define MyAppVersion "1.0"
#define MyAppPublisher "責任公司"
#define MyAppURL "http://www.aaa.com"

[Languages]
Name: "chs"; MessagesFile: "compiler:Languages\ChineseSimplified.isl"

[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={{60A75221-BCC5-447F-B69D-F12EFD3DCAA3}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={autopf}\myprograme
DefaultGroupName={#MyAppName}
; Uncomment the following line to run in non administrative install mode (install for current user only.)
;PrivilegesRequired=lowest
OutputBaseFilename=setup
Compression=lzma
SolidCompression=yes
WizardStyle=modern
ArchitecturesAllowed=x64
ArchitecturesInstallIn64BitMode=x64
LicenseFile=LICENSE.txt
AlwaysRestart=yes


[Files]
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
Source: "{src}\apache\*"; DestDir: "{app}\apache";Flags: external igNoreversion recursesubdirs createallsubdirs
Source: "{src}\php\*"; DestDir: "{app}\php";Flags: external igNoreversion recursesubdirs createallsubdirs
Source: "{src}\javasdk\*"; DestDir: "{app}\javasdk";Flags: external igNoreversion recursesubdirs createallsubdirs
Source: "{src}\msodbcsql.msi"; DestDir: "{app}";Flags: external igNoreversion recursesubdirs createallsubdirs
Source: "{src}\vc_redist.x64.exe"; DestDir: "{app}";Flags: external igNoreversion recursesubdirs createallsubdirs
Source: "{src}\autoInstallapache.bat"; DestDir: "{app}";Flags: external igNoreversion recursesubdirs createallsubdirs
Source: "{src}\autoInstalljdk.bat"; DestDir: "{app}";Flags: external igNoreversion recursesubdirs createallsubdirs
Source: "{src}\autoUnInstallapache.bat"; DestDir: "{app}";Flags: external igNoreversion recursesubdirs createallsubdirs
Source: "{src}\www\*"; DestDir: "{app}\www";Flags: external igNoreversion recursesubdirs createallsubdirs
Source: "ConfigurationFile_simple.ini";Flags: dontcopy noencryption
Source: "{src}\sqlserverdata\*"; DestDir: "{app}";Flags: external igNoreversion recursesubdirs createallsubdirs


[Run]
Filename: "{src}\sqlserver_2012_xpr_x64_sp1\SETUP.EXE"; Parameters: "/ConfigurationFile={tmp}\ConfigurationFile_simple.ini"; Description: "sqlserver";Flags: waituntilterminated
Filename: "{app}\msodbcsql.msi"; Parameters: "/qb IACCEPTMSODBCSQLLICENSETERMS=YES"; Description: "msodbcsql"; Flags:shellexec waituntilterminated

;設置java環境變量
Filename: "{app}\autoInstalljdk.bat";Flags: runascurrentuser waituntilterminated    


[Code]
var
CheckNetEvnPageID:Integer;//CheckNetEvnPage的PageID
//CheckNetEvnPageBtnInstall:Tbutton;//安裝net46按鈕
CheckNetEvnPageDotNetLbl:TLabel; //顯示DotNet是否安裝標籤
CheckNetEvnPageVC14x64NetLbl:TLabel; //顯示DotNet是否安裝標籤
InstalledShowInfoPageID:Integer;

//*****************************************************************************************************
//net環境檢察函數
function IsDotNetDetected(version: string; service: cardinal): boolean;
// Indicates whether the specified version and service pack of the .NET Framework is installed.
//
// version -- Specify one of these strings for the required .NET Framework version:
//    'v1.1'          .NET Framework 1.1
//    'v2.0'          .NET Framework 2.0
//    'v3.0'          .NET Framework 3.0
//    'v3.5'          .NET Framework 3.5
//    'v4\Client'     .NET Framework 4.0 Client Profile
//    'v4\Full'       .NET Framework 4.0 Full Installation
//    'v4.5'          .NET Framework 4.5
//    'v4.5.1'        .NET Framework 4.5.1
//    'v4.5.2'        .NET Framework 4.5.2
//    'v4.6'          .NET Framework 4.6
//    'v4.6.1'        .NET Framework 4.6.1
//    'v4.6.2'        .NET Framework 4.6.2
//
// service -- Specify any non-negative integer for the required service pack level:
//    0               No service packs required
//    1, 2, etc.      Service pack 1, 2, etc. required
var
    key, versionKey: string;
    install, release, serviceCount, versionRelease: cardinal;
    success: boolean;
begin
    versionKey := version;
    versionRelease := 0;

    // .NET 1.1 and 2.0 embed release number in version key
    if version = 'v1.1' then begin
        versionKey := 'v1.1.4322';
    end else if version = 'v2.0' then begin
        versionKey := 'v2.0.50727';
    end

    // .NET 4.5 and newer install as update to .NET 4.0 Full
    else if Pos('v4.', version) = 1 then begin
        versionKey := 'v4\Full';
        case version of
          'v4.5':   versionRelease := 378389;
          'v4.5.1': versionRelease := 378675; // 378758 on Windows 8 and older
          'v4.5.2': versionRelease := 379893;
          'v4.6':   versionRelease := 393295; // 393297 on Windows 8.1 and older
          'v4.6.1': versionRelease := 394254; // 394271 on Windows 8.1 and older
          'v4.6.2': versionRelease := 394802; // 394806 on Windows 8.1 and older
        end;
    end;

    // installation key group for all .NET versions
    key := 'SOFTWARE\Microsoft\NET Framework Setup\NDP\' + versionKey;

    // .NET 3.0 uses value InstallSuccess in subkey Setup
    if Pos('v3.0', version) = 1 then begin
        success := RegQueryDWordValue(HKLM, key + '\Setup', 'InstallSuccess', install);
    end else begin
        success := RegQueryDWordValue(HKLM, key, 'Install', install);
    end;

    // .NET 4.0 and newer use value Servicing instead of SP
    if Pos('v4', version) = 1 then begin
        success := success and RegQueryDWordValue(HKLM, key, 'Servicing', serviceCount);
    end else begin
        success := success and RegQueryDWordValue(HKLM, key, 'SP', serviceCount);
    end;

    // .NET 4.5 and newer use additional value Release
    if versionRelease > 0 then begin
        success := success and RegQueryDWordValue(HKLM, key, 'Release', release);
        success := success and (release >= versionRelease);
    end;

    result := success and (install = 1) and (serviceCount >= service);
end;
//*****************************************************************************************************

//*****檢測vc環境方法**************
function IsVc14x64Detected():boolean;
var
str,CurVer:string;
begin
          RegQueryStringValue(HKLM, 'SOFTWARE\WOW6432Node\Microsoft\VisualStudio\14.0\VC\Runtimes\x64', 'Version', CurVer);
          str := Copy(CurVer,2,2);
          log(str);
          if str = '14' then
              begin
                  Result := true;
              end 
              else begin
                  Result := false;
              end;  
end;
//*****檢測vc環境方法**************



//****************安裝VC14X64方法***********************************************
procedure InstallVc14X64;
var srcpath:string;
ResultCode:Integer;
begin
      //同安裝setup同目錄下的文件{src}
       srcpath :=  ExpandConstant('{src}\vc_redist.x64.exe');
       Exec(srcpath, '', '', SW_SHOWNORMAL, ewWaitUntilTerminated, ResultCode);
end;
//****************安裝VC14X64方法***********************************************



procedure CheckNetEvnPageBtnVcInstallOnClick(Sender:TObject);
var
vc46installpackpath:string;
begin
vc46installpackpath:=ExpandConstant('{src}\vc_redist.x64.exe');
    if NOT  IsVc14x64Detected then begin
                if FileExists(vc46installpackpath) then begin
                     //MsgBox('文件存在', mbInformation, MB_OK);
                     InstallVc14X64;//調用安裝InstallVc14X64方法。 
                end else   MsgBox(vc46installpackpath +'文件不存在。', mbInformation, MB_OK);
    end else
            MsgBox('系統已安裝VC14X64環境,不需要安裝', mbInformation, MB_OK);
end;




//**安裝DotNet46方法************************
procedure InstallDotNet46;
var
srcpath:string;
ResultCode:Integer;
begin
       //同安裝setup同目錄下的文件{src}
       srcpath :=  ExpandConstant('{src}\NDP46-KB3045557-x86-x64-AllOS-ENU.exe');
       Exec(srcpath, '', '', SW_SHOWNORMAL, ewWaitUntilTerminated, ResultCode);
       log(srcpath);
end;
//**安裝DotNet46方法************************


//**************
procedure CheckNetEvnPageBtnInstallOnclick(Sender:TObject);
begin
      if NOT  IsDotNetDetected('v4.6',0)  then begin
            MsgBox('沒有安裝net46環境', mbInformation, MB_OK);

      end else
            MsgBox('系統已安裝net46環境', mbInformation, MB_OK);
end;

//***************************************************************************************

procedure InstallDotNet46ButtonOnClick(Sender:TObject);
var
net46installpackpath:string;
begin
net46installpackpath :=  ExpandConstant('{src}\NDP46-KB3045557-x86-x64-AllOS-ENU.exe');
    if NOT  IsDotNetDetected('v4.6',0) then begin
                if FileExists(net46installpackpath) then begin
                     //MsgBox('文件存在', mbInformation, MB_OK);
                     InstallDotNet46;//調用安裝DotNet46方法。 
                end else   MsgBox(net46installpackpath +'文件不存在。', mbInformation, MB_OK);
    end else
            MsgBox('系統已安裝net46環境,不需要安裝', mbInformation, MB_OK);
end;


procedure CheckNetEvnPageBtnVcCheckOnClick(Sender:TObject);
begin
    if NOT   IsVc14x64Detected     then begin
                MsgBox('vc14x64沒有安裝', mbInformation, MB_OK);
    end else
                MsgBox('vc14x64已安裝', mbInformation, MB_OK);
end;

//*******************AboutButtonOnClick****************************************
procedure AboutButtonOnClick(Sender: TObject);
begin
  MsgBox('華遠智能信息發佈系統V1.0。', mbInformation, mb_Ok);
end;
//*******************AboutButtonOnClick****************************************


//*********創建自定義嚮導頁面**************************************************
procedure CreateTheWizardPages;
var
CheckNetEvnPage:TwizardPage;//net環境檢測頁面
CheckNetEvnPageBtn:Tbutton;//檢查按鈕
CheckNetEvnPageBtnInstall:Tbutton;//安裝net46按鈕

CheckNetEvnPageBtnVcInstall:Tbutton;//安裝vc環境按鈕

InstalledShowInfoPage:TwizardPage;
InstalledShowInfoPageLbl1:Tlabel;//請使用谷歌瀏覽器登錄
InstalledShowInfoPageLbl2:Tlabel;//http://localhost:18080
InstalledShowInfoPageLbl3:Tlabel;//用戶名:admin,密碼:admin
InstalledShowInfoPageLbl4:Tlabel;
InstalledShowInfoPageLbl5:Tlabel;
InstalledShowInfoPageLbl6:Tlabel;



CheckNetEvnPageBtnVcCheck:Tbutton;
begin
  {net環境檢查}
  CheckNetEvnPage:=CreateCustomPage(wpLicense, '環境檢查', '安裝環境是必須的。');
  CheckNetEvnPageID:=CheckNetEvnPage.ID;


  CheckNetEvnPageDotNetLbl:=TLabel.Create(CheckNetEvnPage);
  CheckNetEvnPageDotNetLbl.Parent:=CheckNetEvnPage.Surface;
  CheckNetEvnPageDotNetLbl.Caption:='dotnet46';

  CheckNetEvnPageBtn:=TButton.Create(CheckNetEvnPage);
  CheckNetEvnPageBtn.Parent:=CheckNetEvnPage.Surface;
  CheckNetEvnPageBtn.Caption:='檢測net環境';
  CheckNetEvnPageBtn.Onclick:=@CheckNetEvnPageBtnInstallOnclick;
  CheckNetEvnPageBtn.Top:= CheckNetEvnPageDotNetLbl.Top;
  CheckNetEvnPageBtn.Left:= CheckNetEvnPageDotNetLbl.Left + 200;



  CheckNetEvnPageBtnInstall:=TButton.Create(CheckNetEvnPage);
  CheckNetEvnPageBtnInstall.Parent:=CheckNetEvnPage.Surface;
  CheckNetEvnPageBtnInstall.Caption:='安裝net環境';
  CheckNetEvnPageBtnInstall.Onclick:=@InstallDotNet46ButtonOnClick;
  CheckNetEvnPageBtnInstall.Top:= CheckNetEvnPageBtn.Top;
  CheckNetEvnPageBtnInstall.Left:= CheckNetEvnPageBtn.Left + 200;


  CheckNetEvnPageVC14x64NetLbl:=TLabel.Create(CheckNetEvnPage);
  CheckNetEvnPageVC14x64NetLbl.Parent:=CheckNetEvnPage.Surface;
  CheckNetEvnPageVC14x64NetLbl.Caption:='VC16X64';
  CheckNetEvnPageVC14x64NetLbl.Top:= CheckNetEvnPageDotNetLbl.Top + 40;

  
  CheckNetEvnPageBtnVcCheck:=TButton.Create(CheckNetEvnPage);
  CheckNetEvnPageBtnVcCheck.Parent:=CheckNetEvnPage.Surface;
  CheckNetEvnPageBtnVcCheck.Caption:='檢測vc環境';
  CheckNetEvnPageBtnVcCheck.Onclick:=@CheckNetEvnPageBtnVcCheckOnClick;
  CheckNetEvnPageBtnVcCheck.Top:= CheckNetEvnPageBtn.Top + 40;
  CheckNetEvnPageBtnVcCheck.Left:= CheckNetEvnPageBtn.Left 

  CheckNetEvnPageBtnVcInstall:=TButton.Create(CheckNetEvnPage);
  CheckNetEvnPageBtnVcInstall.Parent:=CheckNetEvnPage.Surface;
  CheckNetEvnPageBtnVcInstall.Caption:='安裝vc環境';
  CheckNetEvnPageBtnVcInstall.Onclick:=@CheckNetEvnPageBtnVcInstallOnClick;
  CheckNetEvnPageBtnVcInstall.Top:= CheckNetEvnPageBtn.Top + 40;
  CheckNetEvnPageBtnVcInstall.Left:= CheckNetEvnPageBtn.Left + 200 

  
  {安裝完顯示信息}
  InstalledShowInfoPage:=CreateCustomPage(wpInstalling, '安裝完成', '已安裝成功,請詳細閱讀操作手冊。');
  //InstalledShowInfoPage:=CreateCustomPage(CheckNetEvnPageID, '安裝完成', '已安裝成功,請詳細閱讀操作手冊。');
  InstalledShowInfoPageID:=InstalledShowInfoPage.ID;
  InstalledShowInfoPageLbl1:=TLabel.Create(InstalledShowInfoPage);
  InstalledShowInfoPageLbl1.Parent:=InstalledShowInfoPage.Surface;
  InstalledShowInfoPageLbl1.Caption:='請使用谷歌瀏覽器登錄';

  InstalledShowInfoPageLbl2:=TLabel.Create(InstalledShowInfoPage);
  InstalledShowInfoPageLbl2.Parent:=InstalledShowInfoPage.Surface;
  InstalledShowInfoPageLbl2.Caption:='http://localhost:18080';
  InstalledShowInfoPageLbl2.Top:=InstalledShowInfoPageLbl1.Top;
  InstalledShowInfoPageLbl2.Left:=InstalledShowInfoPageLbl1.Left + 200;
  InstalledShowInfoPageLbl2.Font.Color:=clBlue;
  InstalledShowInfoPageLbl2.Font.Style:=[fsUnderline];


  InstalledShowInfoPageLbl3:=TLabel.Create(InstalledShowInfoPage);
  InstalledShowInfoPageLbl3.Parent:=InstalledShowInfoPage.Surface;
  InstalledShowInfoPageLbl3.Caption:='用戶名:admin,密碼:admin';
  InstalledShowInfoPageLbl3.Top:=InstalledShowInfoPageLbl1.Top  + 20;
  InstalledShowInfoPageLbl3.Left:=InstalledShowInfoPageLbl1.Left + 200;


  InstalledShowInfoPageLbl4:=TLabel.Create(InstalledShowInfoPage);
  InstalledShowInfoPageLbl4.Parent:=InstalledShowInfoPage.Surface;
  InstalledShowInfoPageLbl4.Caption:='請詳細閱讀:';
  InstalledShowInfoPageLbl4.Top:=InstalledShowInfoPageLbl1.Top  + 60;
  InstalledShowInfoPageLbl4.Left:=InstalledShowInfoPageLbl1.Left;

  
  InstalledShowInfoPageLbl5:=TLabel.Create(InstalledShowInfoPage);
  InstalledShowInfoPageLbl5.Parent:=InstalledShowInfoPage.Surface;
  InstalledShowInfoPageLbl5.Caption:='華遠智能信息發佈系統操作手冊.pdf';
  InstalledShowInfoPageLbl5.Top:=InstalledShowInfoPageLbl4.Top;
  InstalledShowInfoPageLbl5.Left:=InstalledShowInfoPageLbl1.Left + 200;
  InstalledShowInfoPageLbl5.Font.Color:=clBlue;
  InstalledShowInfoPageLbl5.Font.Style:=[fsUnderline];




  
  InstalledShowInfoPageLbl6:=TLabel.Create(InstalledShowInfoPage);
  InstalledShowInfoPageLbl6.Parent:=InstalledShowInfoPage.Surface;
  InstalledShowInfoPageLbl6.Caption:='請記住這些關鍵信息,以後會經常用到。';
  InstalledShowInfoPageLbl6.Top:=InstalledShowInfoPageLbl5.Top + 60;
  InstalledShowInfoPageLbl6.Font.Color:=clRed;


   
end;
//************創建自定義嚮導頁面結束*********************************************** 




//*********點擊URLLabel事件****************************************************
procedure URLLabelOnClick(Sender: TObject);
var
  ErrorCode: Integer;
begin
  ShellExecAsOriginalUser('open', 'http://www.hysy-it.com/', '', '', SW_SHOWNORMAL, ewNoWait, ErrorCode);
end;
//*********點擊URLLabel事件****************************************************

procedure CreateAboutButtonAndURLLabel(ParentForm: TSetupForm; CancelButton: TNewButton);
var
  AboutButton: TNewButton;
  URLLabel: TNewStaticText;
begin
  AboutButton := TNewButton.Create(ParentForm);
  AboutButton.Left := ParentForm.ClientWidth - CancelButton.Left - CancelButton.Width;
  AboutButton.Top := CancelButton.Top;
  AboutButton.Width := CancelButton.Width;
  AboutButton.Height := CancelButton.Height;
  AboutButton.Anchors := [akLeft, akBottom];
  AboutButton.Caption := '&關於...';
  AboutButton.OnClick := @AboutButtonOnClick;
  AboutButton.Parent := ParentForm;

  URLLabel := TNewStaticText.Create(ParentForm);
  URLLabel.Caption := 'www.hysy-it.com';
  URLLabel.Cursor := crHand;
  URLLabel.OnClick := @URLLabelOnClick;
  URLLabel.Parent := ParentForm;
  { Alter Font *after* setting Parent so the correct defaults are inherited first }
  URLLabel.Font.Style := URLLabel.Font.Style + [fsUnderline];
  URLLabel.Font.Color := clHotLight
  URLLabel.Top := AboutButton.Top + AboutButton.Height - URLLabel.Height - 2;
  URLLabel.Left := AboutButton.Left + AboutButton.Width + ScaleX(20);
  URLLabel.Anchors := [akLeft, akBottom];
end;
//**************************CreateAboutButtonAndURLLabel*******************

//***************************************************************************************
procedure InitializeWizard();
begin
   WizardForm.LICENSEACCEPTEDRADIO.Checked:=true;
   CreateTheWizardPages;
   CreateAboutButtonAndURLLabel(WizardForm, WizardForm.CancelButton);
end;
//***************************************************************************************


procedure InitializeUninstallProgressForm();
begin
  CreateAboutButtonAndURLLabel(UninstallProgressForm, UninstallProgressForm.CancelButton);
end;



//*****************************************************************************************
function NextButtonClick(CurPageID:Integer): Boolean;
begin
  if CurpageId=CheckNetEvnPageID then
    begin
           if not IsDotNetDetected('v4.6', 0) then begin
            MsgBox('系統沒有net46環境,請安裝net46環境。', mbInformation, MB_OK);
            end else
                  if not IsVc14x64Detected then begin
                          MsgBox('系統沒有vc14x64環境,請安裝vc14x64環境。', mbInformation, MB_OK);

                  end else
                      result:=true;
    end else
    result:=true;
end;
//*********************************************************************************************

procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
begin
  case CurUninstallStep of
    usUninstall:
      begin
        //MsgBox('CurUninstallStepChanged:' #13#13 'Uninstall is about to start.', mbInformation, MB_OK)
        // ...insert code to perform pre-uninstall tasks here...
      end;
    usPostUninstall:
      begin
        //MsgBox('CurUninstallStepChanged:' #13#13 'Uninstall just finished.', mbInformation, MB_OK);
        // ...insert code to perform post-uninstall tasks here...
      end;
  end;
end;


//**********************************************************
//文件內容替換方法
//    SrcFIle:文件路徑   
//    sFrom:源字符
//    STo: 填的的字符
procedure FileReplace(SrcFile, sFrom, sTo: String);
var
    UnicodeStr:String;
    FileContent: AnsiString;
begin
    //Load srcfile to a string
    LoadStringFromFile(SrcFile, FileContent);
    //Replace Fraomstring by toString in file string content
    //StringChange (sTo,'/', '\');
    UnicodeStr :=String(FileContent);
    StringChangeEx (UnicodeStr, sFrom, sTo,True);
    //Replace old content srcfile by the new content
    DeleteFile(SrcFile);
    SaveStringToFile(SrcFile,UnicodeStr, True);
end;
//**********************************************************



//************************************************************
procedure CurStepChanged(CurStep: TSetupStep);
var
fileName:String;
SRVROOTPATH:String;//apahce 工作目錄
WWWPATH:String; //網站目錄
PHPPATH:String; //http-php.conf
PHPINIPATH:String;//php.ini 的擴展目錄
ErrorCode: Integer;


begin
  SRVROOTPATH :=ExpandConstant('{app}\apache');
  WWWPATH :=ExpandConstant('{app}\www');
  PHPPATH:=ExpandConstant('{app}');
  PHPINIPATH:=ExpandConstant('{app}\php\ext');
  //SqlserverIni:=ExpandConstant('{app}\sqlserverdata');

  //複製完文件後執行
  if CurStep=ssPostInstall then
  begin
     filename := ExpandConstant('{app}\apache\conf\httpd.conf');
     FileReplace(filename, '@@SRVROOT@@',SRVROOTPATH);

     filename := ExpandConstant('{app}\apache\conf\httpd.conf');
     FileReplace(filename, '@@www@@',WWWPATH);

     filename := ExpandConstant('{app}\apache\conf\extra\httpd-php.conf');
     FileReplace(filename, '@@php@@',PHPPATH);

     filename := ExpandConstant('{app}\php\php.ini');
     FileReplace(filename, '@@extensiondir@@',PHPINIPATH);

  end;

  if CurStep=ssDone   then
  begin
      ShellExecAsOriginalUser('open', 'http://localhost:18080', '', '', SW_SHOWNORMAL, ewNoWait, ErrorCode);
  end;

end;
//****************************************************************


//主要是程序調用“下一步”,然後在ShouldSkipPage函數中進行跳過。
function ShouldSkipPage(PageID: Integer): Boolean;
begin
if PageID=wpReady then
  result := true;
end;

function InitializeSetup: Boolean;
begin
  // Show the contents of Readme.txt (non Unicode) in a message box

  ExtractTemporaryFile('ConfigurationFile_simple.ini');
  //log(ExpandConstant('{tmp}\ConfigurationFile_simple.ini'));
  Result := True;
end;


procedure CurPageChanged(CurPageID: Integer);
var 
SQLSERVERDATAPATH:string;
SqlInifilename:string;
ResultCode:Integer;


begin
  if CurPageID=wpInstalling then begin
        //修改SQLSERVER實例安裝路徑
      SQLSERVERDATAPATH:=ExpandConstant('{app}\sqlserverdata'); 
      SqlInifilename := ExpandConstant('{tmp}\ConfigurationFile_simple.ini');
      FileReplace(SqlInifilename, '@@INSTANCEDIR@@',SQLSERVERDATAPATH);
  end;

  if CurPageID=InstalledShowInfoPageID then begin
      Exec(ExpandConstant('{app}\autoInstallapache.bat'),'','',SW_SHOW,ewWaitUntilTerminated,ResultCode);//重啓apache腳本
  end;    
end;


 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章