inno setup 打包mysql_使用Inno Setup 打包jdk、mysql、tomcat、webapp等为一个exe安装包
1 ; 腳本由 Inno Setup 腳本向導 生成!2 ; 有關創建 Inno Setup 腳本文件的詳細資料請查閱幫助文檔!3
4 #define MyAppName "abc"5 #define MyAppVersion "1.0"6 #define MyAppPublisher "aaa"7 #define MyAppURL "http://www.abc.com/"8
9 [Setup]10 ; 注: AppId的值為單獨標識該應用程序。11 ; 不要為其他安裝程序使用相同的AppId值。12 ; (生成新的GUID,點擊 工具|在IDE中生成GUID。)13 AppId={{9E044575-9CD9-4751-B0BE-F6758BA94548}
14 AppName={#MyAppName}
15 AppVersion={#MyAppVersion}
16 ;AppVerName={#MyAppName} {#MyAppVersion}
17 AppPublisher={#MyAppPublisher}
18 AppPublisherURL={#MyAppURL}
19 AppSupportURL={#MyAppURL}
20 AppUpdatesURL={#MyAppURL}
21 DefaultDirName={pf}\{#MyAppName}
22 DefaultGroupName=XX管理軟件(abc)23 AllowNoIcons=yes24 OutputBaseFilename=setup25 Compression=lzma26 SolidCompression=yes27 [Files]28 ;拷貝tomcat29 Source:"Source\apache-tomcat-6.0.41\*";DestDir:"{app}\tomcat6.0";Flags:igNoreversion recursesubdirs createallsubdirs30 ;拷貝jdk31 Source:"Source\jdk1.6.0_43\*";DestDir:"{app}\jdk1.6";Flags:igNoreversion recursesubdirs createallsubdirs32 ;拷貝mysql33 Source:"Source\MySql5.5\*";DestDir:"{app}\MySql5.5";Flags:igNoreversion recursesubdirs createallsubdirs34 ;拷貝源代碼35 Source:"Source\abc\*";DestDir:"{app}\tomcat6.0\webapps\ROOT";Flags:igNoreversion recursesubdirs createallsubdirs36 ;拷貝sdk37 Source:"Source\Sdk\*";DestDir:"{app}\Sdk";Flags:igNoreversion recursesubdirs createallsubdirs38 ;拷貝服務器39 Source:"Source\Server\*";DestDir:"{app}\Server";Flags:igNoreversion recursesubdirs createallsubdirs40 ;拷貝ftp41 Source:"Source\FtpServer\*";DestDir:"{app}\FtpServer";Flags:igNoreversion recursesubdirs createallsubdirs42 ;拷貝bat43 Source:"Source\*";DestDir:"{app}\";44 ;拷貝桌面快捷方式45 Source:"Source\xx系統.url";DestDir:"{userdesktop}\xx系統";46 [Languages]47 Name: "chinesesimp"; MessagesFile: "compiler:Default.isl"48 [Icons]49 Name: "{group}\{cm:ProgramOnTheWeb,{#MyAppName}}"; Filename: "{#MyAppURL}"50 Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"51 [INI]52 ;修改數據庫配置文件53 Filename:"{app}\MySql5.5\my.ini";Section:"mysqld";Key:"basedir"; String:"{app}\MySql5.5"54 Filename:"{app}\MySql5.5\my.ini";Section:"mysqld";Key:"datadir"; String:"{app}\MySql5.5\data"55 Filename:"{app}\MySql5.5\my.ini";Section:"mysqld";Key:"port"; String:"3308"56 Filename:"{app}\MySql5.5\my.ini";Section:"client";Key:"port"; String:"3308"57 ;修改服務器配置文件58 Filename:"{app}\Server\init.ini";Section:"RegAddr";Key:"port"; String:"5556"59 Filename:"{userdesktop}\xx系統.url";Section:"InternetShortcut";Key:"URL"; String:"http://127.0.0.1:7070/"60 [Run]61 ;修改tomcat配置文件62 Filename:"{app}\loading.bat";AfterInstall:ConfigXml(ExpandConstant('{app}\tomcat6.0\conf\server.xml'),'/Server/Service/Connector','port','7070')63 ;修改web數據庫連接配置文件64 Filename:"{app}\loading.bat";AfterInstall:ConfigXml(ExpandConstant('{app}\tomcat6.0\webapps\ROOT\META-INF\Context.xml'),'/Context/Resource','password','123456')65 Filename:"{app}\loading.bat";AfterInstall:ConfigXml(ExpandConstant('{app}\tomcat6.0\webapps\ROOT\META-INF\Context.xml'),'/Context/Resource','url','jdbc:mysql://127.0.0.1:3308/abc?characterEncoding=UTF-8')66 ;修改FTP配置文件67 Filename:"{app}\loading.bat";AfterInstall:ConfigXml(ExpandConstant('{app}\FtpServer\FileZilla Server.xml'),'/FileZillaServer/Users/User','Name','admin')68 Filename:"{app}\loading.bat";AfterInstall:ConfigXml2(ExpandConstant('{app}\FtpServer\FileZilla Server.xml'),'/FileZillaServer/Users/User/Option[0]','e10adc3949ba59abbe56e057f20f883e')69 Filename:"{app}\loading.bat";AfterInstall:ConfigXml(ExpandConstant('{app}\FtpServer\FileZilla Server.xml'),'/FileZillaServer/Users/User/Permissions/Permission','Dir',ExpandConstant('{app}\tomcat6.0\webapps\ROOT\SystemFile'))70 ;修改服務配置文件71 Filename:"{app}\loading.bat";AfterInstall:ConfigXml(ExpandConstant('{app}\Sdk\abc.config'),'/configuration/appSettings/add[1]','value','127.0.0.1')72 Filename:"{app}\loading.bat";AfterInstall:ConfigXml(ExpandConstant('{app}\Sdk\abc.config'),'/configuration/appSettings/add[2]','value','5556')73 Filename:"{app}\loading.bat";AfterInstall:ConfigXml(ExpandConstant('{app}\Sdk\abc.config'),'/configuration/appSettings/add[3]','value','127.0.0.1')74 Filename:"{app}\loading.bat";AfterInstall:ConfigXml(ExpandConstant('{app}\Sdk\abc.config'),'/configuration/appSettings/add[4]','value','7070')75 Filename:"{app}\install.bat";Description:"正在啟動或配置相關程序";76 [UninstallRun]77 Filename:"{app}\uninstall.bat";78 [UninstallDelete]79 Type:filesandordirs;Name:"{app}\Server"80 Type:filesandordirs;Name:"{app}\MySql5.5"81 Type:filesandordirs;Name:"{app}\Sdk"82 Type:filesandordirs;Name:"{app}\tomcat6.0"83 Type:files;Name:"{app}\InstallUtil.InstallLog"84 [Code]85 procedureConfigXml2(xmlPath:String;xPath:String;innerText:String);86 var
87 XMLDocument,XMLRoot,XMLNode:Variant;88 begin
89 try90 XMLDocument := CreateOleObject('MSXML2.DOMDocument');91 XMLDocument.async :=False;92 XMLDocument.resolveExternals :=False;93 XMLDocument.load(xmlPath);94 XMLRoot :=XMLDocument.documentElement;95
96 XMLNode:=XMLRoot.SelectSingleNode(xPath);97 XMLNode.Text:=innerText;98 XMLDocument.Save(xmlPath);99 except100 MsgBox('xml error', mbInformation, mb_Ok);101 end;102 end;103 procedureConfigXml(xmlPath:String;xPath:String;attrName:String;attrValue:String);104 var
105 XMLDocument,XMLRoot,XMLNode:Variant;106 begin
107 try108 XMLDocument := CreateOleObject('MSXML2.DOMDocument');109 XMLDocument.async :=False;110 XMLDocument.resolveExternals :=False;111 XMLDocument.load(xmlPath);112 XMLRoot :=XMLDocument.documentElement;113
114 XMLNode:=XMLRoot.SelectSingleNode(xPath);115 XMLNode.Attributes.GetNamedItem(attrName).Value:=attrValue;116 XMLDocument.Save(xmlPath);117 except118 MsgBox('xml error', mbInformation, mb_Ok);119 end;120 end;
總結
以上是生活随笔為你收集整理的inno setup 打包mysql_使用Inno Setup 打包jdk、mysql、tomcat、webapp等为一个exe安装包的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 计算机应用基础 a卷,计算机应用基础笔试
- 下一篇: 尤其是java程序员(转载)_JAVA程