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;