doliwamp.iss 45 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044
  1. ; ----- DoliWamp.iss ---------------------------------------------------------------------
  2. ; Script to build an auto installer for Dolibarr.
  3. ; Works with InnoSetup 5.4.0 (a)
  4. ; Idea from WampServer 2 (http://www.wampserver.com)
  5. ;----------------------------------------------------------------------------------------
  6. ; You must edit some path in this file to build an exe (like SourceDir).
  7. ; WARNING: Be sure that user.* files of Mysql database used to build
  8. ; package contains only one user called root with no password.
  9. ; For this, you can edit the mysql.user table of the source database to keep
  10. ; only the root user with no password, stop server and catch
  11. ; files user.MY* to put them in the Dolibarr build/exe/doliwamp/mysql directory.
  12. ;
  13. ;----------------------------------------------------------------------------------------
  14. [Setup]
  15. ; ----- Change this -----
  16. AppName=DoliWamp
  17. ; Replace key with DoliWamp-x.x.x or DoliWamp-x.x.x-alpha or DoliWamp-x.x.x-beta or DoliWamp-x.x.x-rc or DoliWamp-x.x.x
  18. AppVerName=__FILENAMEEXEDOLIWAMP__
  19. ; Replace key with DoliWamp-x.x x or DoliWamp-x.x.x-alpha or DoliWamp-x.x.x-beta or DoliWamp-x.x.x-rc or DoliWamp-x.x.x
  20. OutputBaseFilename=__FILENAMEEXEDOLIWAMP__
  21. ; ----- End of change
  22. ;OutputManifestFile=build\doliwampbuild.log
  23. ; Define full path from which all relative path are defined
  24. ; You must modify this to put here your dolibarr root directory
  25. ;SourceDir=Z:\home\ldestailleur\git\dolibarrxxx
  26. SourceDir=..\..\..
  27. AppId=doliwamp
  28. AppPublisher=DoliCloud
  29. AppPublisherURL=https://www.dolicloud.com
  30. AppSupportURL=https://www.dolibarr.org
  31. AppUpdatesURL=https://www.dolibarr.org
  32. AppComments=DoliWamp includes Dolibarr, Apache, PHP and Mysql software.
  33. AppCopyright=Copyright (C) 2008-2022 Laurent Destailleur (NLTechno), Fabian Rodriguez (Le Goût du Libre)
  34. DefaultDirName=c:\dolibarr
  35. DefaultGroupName=Dolibarr
  36. ;LicenseFile=COPYING
  37. ;Compression=none
  38. Compression=lzma
  39. SolidCompression=yes
  40. WizardImageFile=build\exe\doliwamp\doliwamp.bmp
  41. WizardSmallImageFile=build\exe\doliwamp\doliwampsmall.bmp
  42. SetupIconFile=doc\images\dolibarr_favicon.ico
  43. ;To say the installer must be ran as admin
  44. PrivilegesRequired=admin
  45. DisableProgramGroupPage=yes
  46. ChangesEnvironment=no
  47. CreateUninstallRegKey=yes
  48. ;UseSetupLdr=no
  49. ;UninstallDisplayIcon={app}\bidon
  50. OutputDir=build
  51. ShowLanguageDialog=auto
  52. ShowUndisplayableLanguages=no
  53. LanguageDetectionMethod=uilanguage
  54. ;SignedUninstaller=yes
  55. [Languages]
  56. Name: "en"; MessagesFile: "compiler:Default.isl,build\exe\doliwamp\Languages\MyEnglish.isl"
  57. Name: "br"; MessagesFile: "compiler:Languages\Portuguese.isl,build\exe\doliwamp\Languages\MyBrazilianPortuguese.isl"
  58. Name: "ca"; MessagesFile: "compiler:Languages\Catalan.isl,build\exe\doliwamp\Languages\MyCatalan.isl"
  59. Name: "da"; MessagesFile: "compiler:Languages\Danish.isl,build\exe\doliwamp\Languages\MyDanish.isl"
  60. Name: "es"; MessagesFile: "compiler:Languages\Spanish.isl,build\exe\doliwamp\Languages\MySpanish.isl"
  61. Name: "nl"; MessagesFile: "compiler:Languages\Dutch.isl,build\exe\doliwamp\Languages\MyDutch.isl"
  62. Name: "fi"; MessagesFile: "compiler:Languages\Finnish.isl,build\exe\doliwamp\Languages\MyFinnish.isl"
  63. Name: "fr"; MessagesFile: "compiler:Languages\French.isl,build\exe\doliwamp\Languages\MyFrench.isl"
  64. Name: "ge"; MessagesFile: "compiler:Languages\German.isl,build\exe\doliwamp\Languages\MyGerman.isl"
  65. Name: "it"; MessagesFile: "compiler:Languages\Italian.isl,build\exe\doliwamp\Languages\MyItalian.isl"
  66. Name: "nb"; MessagesFile: "compiler:Languages\Norwegian.isl,build\exe\doliwamp\Languages\MyNorwegian.isl"
  67. Name: "po"; MessagesFile: "compiler:Languages\Polish.isl,build\exe\doliwamp\Languages\MyPolish.isl"
  68. Name: "pt"; MessagesFile: "compiler:Languages\Portuguese.isl,build\exe\doliwamp\Languages\MyPortuguese.isl"
  69. Name: "ru"; MessagesFile: "compiler:Languages\Russian.isl,build\exe\doliwamp\Languages\MyRussian.isl"
  70. Name: "sv"; MessagesFile: "compiler:Languages\Slovenian.isl,build\exe\doliwamp\Languages\MySlovenian.isl"
  71. [Tasks]
  72. ;Name: "autostart"; Description: "Automatically launch DoliWamp server on startup. If you check this option, Services will be installed as automatic. Otherwise, services will be installed as manual and will start and stop with the service manager."; GroupDescription: "Auto Start:" ;Flags: unchecked;
  73. Name: "quicklaunchicon"; Description: {cm:CreateQuickLaunchIcon}; GroupDescription: {cm:AdditionalIcons}; Flags: unchecked
  74. Name: "desktopicon"; Description: {cm:CreateDesktopIcon}; GroupDescription: {cm:AdditionalIcons}; Flags: unchecked
  75. [Dirs]
  76. Name: "{app}\logs"
  77. Name: "{app}\tmp"
  78. Name: "{app}\dolibarr_documents"
  79. Name: "{app}\bin\apache\apache2.4.41\logs"
  80. [Files]
  81. ; Stop/start
  82. Source: "build\exe\doliwamp\stopdoliwamp.bat"; DestDir: "{app}\"; Flags: ignoreversion; AfterInstall: close()
  83. Source: "build\exe\doliwamp\startdoliwamp.bat"; DestDir: "{app}\"; Flags: ignoreversion;
  84. Source: "build\exe\doliwamp\install_services.bat.install"; DestDir: "{app}\"; Flags: ignoreversion;
  85. Source: "build\exe\doliwamp\uninstall_services.bat.install"; DestDir: "{app}\"; Flags: ignoreversion;
  86. Source: "build\exe\doliwamp\removefiles.bat"; DestDir: "{app}\"; Flags: ignoreversion;
  87. Source: "build\exe\doliwamp\rundoliwamp.bat.install"; DestDir: "{app}\"; Flags: ignoreversion;
  88. Source: "build\exe\doliwamp\rundolihelp.bat.install"; DestDir: "{app}\"; Flags: ignoreversion;
  89. Source: "build\exe\doliwamp\rundoliadmin.bat.install"; DestDir: "{app}\"; Flags: ignoreversion;
  90. Source: "build\exe\doliwamp\mysqlinitpassword.bat.install"; DestDir: "{app}\"; Flags: ignoreversion;
  91. Source: "build\exe\doliwamp\mysqltestinstall.bat.install"; DestDir: "{app}\"; Flags: ignoreversion;
  92. Source: "build\exe\doliwamp\startdoliwamp_manual_donotuse.bat.install"; DestDir: "{app}\"; Flags: ignoreversion;
  93. Source: "build\exe\doliwamp\builddemosslfiles.bat.install"; DestDir: "{app}\"; Flags: ignoreversion;
  94. Source: "build\exe\doliwamp\UsedPort.exe"; DestDir: "{app}\"; Flags: ignoreversion;
  95. ; Apache, Php, Mysql
  96. ; Put here path of Wampserver applications
  97. ; Value OK: apache 2.2.6, php 5.2.5 (5.2.11, 5.3.0 and 5.3.1 fails if php_exif, php_pgsql, php_zip is on), mysql 5.0.45
  98. ; Value OK: apache 2.2.11, php 5.3.0 (if no php_exif, php_pgsql, php_zip), mysql 5.0.45
  99. ; Value OK: apache 2.4.9, php 5.5.12, mysql 5.0.45 instead of 5.6.17 (wampserver2.5-Apache-2.4.9-Mysql-5.6.17-php5.5.12-32b.exe)
  100. ; Value OK: apache 2.4.41, php 7.3.12, mariadb10.4.10 (wampserver3.2.0_x64.exe)
  101. ;Source: "C:\Program Files\Wamp\bin\apache\apache2.4.9\*.*"; DestDir: "{app}\bin\apache\apache2.4.9"; Flags: ignoreversion recursesubdirs; Excludes: "php.ini,httpd.conf,wampserver.conf,*.log,*_log"
  102. Source: "C:\wamp64\bin\apache\apache2.4.41\*.*"; DestDir: "{app}\bin\apache\apache2.4.41"; Flags: ignoreversion recursesubdirs; Excludes: "php.ini,httpd.conf,wampserver.conf,*.log,*_log"
  103. ;Source: "C:\Program Files\Wamp\bin\php\php5.5.12\*.*"; DestDir: "{app}\bin\php\php5.5.12"; Flags: ignoreversion recursesubdirs; Excludes: "php.ini,phpForApache.ini,wampserver.conf,*.log,*_log"
  104. Source: "C:\wamp64\bin\php\php7.3.12\*.*"; DestDir: "{app}\bin\php\php7.3.12"; Flags: ignoreversion recursesubdirs; Excludes: "php.ini,phpForApache.ini,wampserver.conf,*.log,*_log"
  105. ;Source: "C:\Program Files\Wamp\bin\mysql\mysql5.0.45\*.*"; DestDir: "{app}\bin\mysql\mysql5.0.45"; Flags: ignoreversion recursesubdirs; Excludes: "my.ini,data\*,wampserver.conf,*.log,*_log,MySQLInstanceConfig.exe"
  106. Source: "C:\wamp64\bin\mariadb\mariadb10.4.10\*.*"; DestDir: "{app}\bin\mariadb\mariadb10.4.10"; Flags: ignoreversion recursesubdirs; Excludes: "my.ini,data\*,wampserver.conf,*.log,*_log,MySQLInstanceConfig.exe"
  107. ; Mysql data files (does not overwrite if exists)
  108. ; We must copy them because the tool mysql_install_db.exe to generate them at first install does not return to prompt so make install hang
  109. ;Source: "build\exe\doliwamp\mysql\*.*"; DestDir: "{app}\bin\mariadb\data\mysql"; Flags: onlyifdoesntexist ignoreversion recursesubdirs; Excludes: ".gitignore,.project,CVS\*,Thumbs.db"
  110. ; Dolibarr
  111. Source: "htdocs\*.*"; DestDir: "{app}\www\dolibarr\htdocs"; Flags: ignoreversion recursesubdirs; Excludes: ".gitignore,.project,CVS\*,Thumbs.db,custom\*,custom2\*,documents\*,includes\ckeditor\_source\*,includes\savant\*,includes\phpmailer\*,jquery\plugins\template\*,nltechno*\*,sabre\sabre\*\tests,tcpdf\fonts\dejavu-fonts-ttf-2.33\*,tcpdf\fonts\freefont-20100919\*,tcpdf\fonts\utils\*,*\conf.php,*\conf.php.mysql,*\conf.php.old,*\conf.php.postgres,*\conf.php.sav,*\install.forced.php"
  112. Source: "dev\*.*"; DestDir: "{app}\www\dolibarr\dev"; Flags: ignoreversion recursesubdirs; Excludes: ".gitignore,.project,CVS\*,Thumbs.db,dbmodel\*,fpdf\*,initdata\*,initdemo\*,iso-normes\*,licence\*,phpcheckstyle\*,phpunit\*,samples\*,test\*,uml\*,vagrant\*,xdebug\*"
  113. Source: "doc\*.*"; DestDir: "{app}\www\dolibarr\doc"; Flags: ignoreversion recursesubdirs; Excludes: ".gitignore,.project,CVS\*,Thumbs.db,wiki\*,plaquette\*,dev\*,images\dolibarr_screenshot2.png,images\dolibarr_screenshot3.png,images\dolibarr_screenshot4.png,images\dolibarr_screenshot5.png,images\dolibarr_screenshot6.png,images\dolibarr_screenshot7.png,images\dolibarr_screenshot8.png,images\dolibarr_screenshot9.png,images\dolibarr_screenshot10.png,images\dolibarr_screenshot11.png,images\dolibarr_screenshot12.png"
  114. Source: "scripts\*.*"; DestDir: "{app}\www\dolibarr\scripts"; Flags: ignoreversion recursesubdirs; Excludes: ".gitignore,.project,CVS\*,Thumbs.db,product\materiel.net.php,product\import-product.php"
  115. Source: "*.*"; DestDir: "{app}\www\dolibarr"; Flags: ignoreversion; Excludes: ".gitignore,.project,CVS\*,Thumbs.db,default.properties,install.lock"
  116. ; Config files
  117. Source: "build\exe\doliwamp\dolibarr.conf.install"; DestDir: "{app}\alias"; Flags: ignoreversion;
  118. ;Source: "build\exe\doliwamp\httpd.conf.install"; DestDir: "{app}\bin\apache\apache2.4.9\conf"; Flags: ignoreversion;
  119. Source: "build\exe\doliwamp\httpd.conf.install"; DestDir: "{app}\bin\apache\apache2.4.41\conf"; Flags: ignoreversion;
  120. Source: "build\exe\doliwamp\my.ini.install"; DestDir: "{app}\bin\mysql\mysql5.0.45"; Flags: ignoreversion;
  121. Source: "build\exe\doliwamp\my.ini.install"; DestDir: "{app}\bin\mariadb\mariadb10.4.10"; Flags: ignoreversion;
  122. ;Source: "build\exe\doliwamp\php.ini.install"; DestDir: "{app}\bin\php\php5.5.12"; Flags: ignoreversion;
  123. Source: "build\exe\doliwamp\php.ini.install"; DestDir: "{app}\bin\php\php7.3.12"; Flags: ignoreversion;
  124. Source: "build\exe\doliwamp\index.php.install"; DestDir: "{app}\www"; Flags: ignoreversion;
  125. Source: "build\exe\doliwamp\install.forced.php.install"; DestDir: "{app}\www\dolibarr\htdocs\install"; Flags: ignoreversion;
  126. Source: "build\exe\doliwamp\openssl.conf"; DestDir: "{app}"; Flags: ignoreversion;
  127. Source: "build\exe\doliwamp\ca_demo_dolibarr.crt"; DestDir: "{app}"; Flags: ignoreversion;
  128. Source: "build\exe\doliwamp\ca_demo_dolibarr.key"; DestDir: "{app}"; Flags: ignoreversion;
  129. ; Licence
  130. Source: "COPYRIGHT"; DestDir: "{app}"; Flags: ignoreversion;
  131. [Icons]
  132. Name: "{group}\Dolibarr ERP-CRM"; Filename: "{app}\rundoliwamp.bat"; WorkingDir: "{app}"; IconFilename: {app}\www\dolibarr\doc\images\dolibarr.ico
  133. Name: "{group}\Tools\Help center"; Filename: "{app}\rundolihelp.bat"; WorkingDir: "{app}"; IconFilename: {app}\www\dolibarr\doc\images\dolihelp.ico
  134. Name: "{group}\Tools\Host your ERP-CRM in the Cloud"; Filename: "http://wiki.dolibarr.org/index.php/Cloud_Solutions"; WorkingDir: "{app}"; IconFilename: {app}\www\dolibarr\doc\images\dolihelp.ico
  135. Name: "{group}\Tools\Start DoliWamp server"; Filename: "{app}\startdoliwamp.bat"; WorkingDir: "{app}"; IconFilename: {app}\www\dolibarr\doc\images\doliwampon.ico
  136. Name: "{group}\Tools\Stop DoliWamp server"; Filename: "{app}\stopdoliwamp.bat"; WorkingDir: "{app}"; IconFilename: {app}\www\dolibarr\doc\images\doliwampoff.ico
  137. Name: "{group}\Tools\Admin DoliWamp server"; Filename: "{app}\rundoliadmin.bat"; WorkingDir: "{app}"; IconFilename: {app}\www\dolibarr\doc\images\doliadmin.ico
  138. Name: "{group}\Tools\Uninstall DoliWamp"; Filename: "{app}\unins000.exe"; WorkingDir: "{app}"; IconFilename: {app}\uninstall_services.bat
  139. Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\Dolibarr"; WorkingDir: "{app}"; Filename: "{app}\rundoliwamp.bat"; Tasks: quicklaunchicon; IconFilename: {app}\www\dolibarr\doc\images\dolibarr.ico
  140. Name: "{userdesktop}\Dolibarr ERP-CRM"; Filename: "{app}\rundoliwamp.bat"; WorkingDir: "{app}"; Tasks: desktopicon; IconFilename: {app}\www\dolibarr\doc\images\dolibarr.ico
  141. Name: "{userdesktop}\Dolibarr Help center"; Filename: "{app}\rundolihelp.bat"; WorkingDir: "{app}"; Tasks: desktopicon; IconFilename: {app}\www\dolibarr\doc\images\dolihelp.ico
  142. ;Start of servers fromstartup menu disabled as services are auto
  143. ;Name: "{userstartup}\DoliWamp server"; Filename: "{app}\startdoliwamp.bat"; WorkingDir: "{app}"; Flags: runminimized; IconFilename: {app}\www\dolibarr\doc\images\dolibarr.ico
  144. [Registry]
  145. ; Add "run as admin" flag. Same than command line: reg add "HKCU\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers" /v "<Path to your exe>" /t REG_SZ /d RUNASADMIN
  146. Root: "HKLM"; Subkey: "SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers"; ValueType: string; ValueName: "{app}\startdoliwamp.bat"; ValueData: "RUNASADMIN";
  147. Root: "HKLM"; Subkey: "SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers"; ValueType: string; ValueName: "{app}\stopdoliwamp.bat"; ValueData: "RUNASADMIN";
  148. Root: "HKLM32"; Subkey: "SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers"; ValueType: string; ValueName: "{app}\startdoliwamp.bat"; ValueData: "RUNASADMIN";
  149. Root: "HKLM32"; Subkey: "SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers"; ValueType: string; ValueName: "{app}\stopdoliwamp.bat"; ValueData: "RUNASADMIN";
  150. Root: "HKLM64"; Subkey: "SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers"; ValueType: string; ValueName: "{app}\startdoliwamp.bat"; ValueData: "RUNASADMIN"; Check: IsWin64
  151. Root: "HKLM64"; Subkey: "SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers"; ValueType: string; ValueName: "{app}\stopdoliwamp.bat"; ValueData: "RUNASADMIN"; Check: IsWin64
  152. [Code]
  153. //variables globales
  154. var phpVersion: String;
  155. var apacheVersion: String;
  156. var path: String;
  157. var pfPath: String;
  158. var winPath: String;
  159. var pathWithSlashes: String;
  160. var Page: TInputQueryWizardPage;
  161. var smtpServer: String;
  162. var apachePort: String;
  163. var mysqlPort: String;
  164. var newPassword: String;
  165. var lockFile: String;
  166. var srcFile: String;
  167. var destFile: String;
  168. var srcFileH: String;
  169. var destFileH: String;
  170. var srcFileA: String;
  171. var destFileA: String;
  172. var srcContents: String;
  173. var browser: String;
  174. var mysqlVersion: String;
  175. var phpDllCopy: String;
  176. var batFile: String;
  177. var mysmtp: String;
  178. var myporta: String;
  179. var myportas: String;
  180. var myport: String;
  181. var mypass: String;
  182. var firstinstall: Boolean;
  183. var value: String;
  184. //-----------------------------------------------
  185. //procedures lancees au debut de l'installation
  186. function InitializeSetup(): Boolean;
  187. begin
  188. Result := MsgBox(CustomMessage('YouWillInstallDoliWamp')+#13#13+CustomMessage('ThisAssistantInstallOrUpgrade')+#13#13+CustomMessage('IfYouHaveTechnicalKnowledge')+#13#13+CustomMessage('ButIfYouLook')+#13#13+CustomMessage('DoYouWantToStart'), mbConfirmation, MB_YESNO) = IDYES;
  189. if Result then
  190. begin
  191. //----------------------------------------------
  192. // Test if msvcr110 DLL has been installed
  193. //----------------------------------------------
  194. if not FileExists ('c:/windows/system32/msvcr110.dll') and not FileExists ('c:/windows/sysWOW64/msvcr110.dll') and not FileExists ('c:/winnt/system32/msvcr110.dll') and not FileExists ('c:/winnt/sysWOW64/msvcr110.dll') then
  195. begin
  196. // TODO - offer to install the component by opening the URL in the default browser, abort installation if user doesn't accept
  197. Result := MsgBox(CustomMessage('DLLMissing')+#13#13+CustomMessage('ContinueAnyway'), mbConfirmation, MB_YESNO) = IDYES;
  198. end;
  199. // Pb seems similar with msvcp110.dll
  200. //vcredist_x64.exe
  201. end;
  202. end;
  203. procedure InitializeWizard();
  204. begin
  205. //version des applis, a modifier pour chaque version de WampServer 2
  206. //apacheVersion := '2.4.9';
  207. //phpVersion := '5.5.12' ;
  208. apacheVersion := '2.4.41';
  209. phpVersion := '7.3.12' ;
  210. //mysqlVersion := '5.0.45';
  211. mysqlVersion := '10.4.10';
  212. smtpServer := 'localhost';
  213. apachePort := '80';
  214. mysqlPort := '3306';
  215. newPassword := 'changeme';
  216. firstinstall := true;
  217. //LoadStringFromFile (srcFile, srcContents);
  218. //posvalue=Pos('$dolibarr_main_db_port=', srcFile);
  219. if RegQueryStringValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\NLTechno\DoliWamp','smtpServer', value) then
  220. begin
  221. if value <> '' then smtpServer:=value;
  222. end
  223. else
  224. begin
  225. if RegQueryStringValue(HKEY_CURRENT_USER, 'Software\Microsoft\Internet Account Manager\Accounts\00000001','SMTP Server', value) then
  226. begin
  227. if value <> '' then smtpServer:=value;
  228. end
  229. else
  230. begin
  231. if RegQueryStringValue(HKEY_LOCAL_MACHINE, 'PMail\ServiceInfo\Mail_Account_1','SvcSMTPHost', value) then
  232. begin
  233. if value <> '' then smtpServer:=value;
  234. end
  235. else
  236. begin
  237. if RegQueryStringValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\MSCRM','SMTPServer', value) then
  238. begin
  239. if value <> '' then smtpServer:=value;
  240. end;
  241. end;
  242. end;
  243. end;
  244. if RegQueryStringValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\NLTechno\DoliWamp','apachePort', value) then
  245. begin
  246. if value <> '' then apachePort:=value;
  247. end;
  248. if RegQueryStringValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\NLTechno\DoliWamp','mysqlPort', value) then
  249. begin
  250. if value <> '' then mysqlPort:=value;
  251. end;
  252. if RegQueryStringValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\NLTechno\DoliWamp','newPassword', value) then
  253. begin
  254. if value <> '' then newPassword:=value;
  255. end;
  256. // Prepare an object calle "Page" of type wpInstalling.
  257. // Object will be show later in NextButtonClick function.
  258. Page := CreateInputQueryPage(wpInstalling, CustomMessage('TechnicalParameters'), '', CustomMessage('IfFirstInstall'));
  259. // TODO Add control differently if first install or update
  260. if firstinstall
  261. then
  262. begin
  263. // False means it's not a password edit
  264. Page.Add(CustomMessage('SMTPServer'), False);
  265. Page.Add(CustomMessage('ApachePort'), False);
  266. Page.Add(CustomMessage('MySqlPort'), False);
  267. Page.Add(CustomMessage('MySqlPassword'), False);
  268. end
  269. else
  270. begin
  271. // False means it's not a password edit
  272. Page.Add(CustomMessage('SMTPServer'), False);
  273. Page.Add(CustomMessage('ApachePort'), False);
  274. Page.Add(CustomMessage('MySqlPort'), False);
  275. Page.Add(CustomMessage('MySqlPassword'), False);
  276. end;
  277. // Default values
  278. Page.Values[0] := smtpServer;
  279. Page.Values[1] := apachePort;
  280. Page.Values[2] := mysqlPort;
  281. Page.Values[3] := newPassword;
  282. end;
  283. //-----------------------------------------------
  284. // Stop all services (if exist)
  285. procedure close();
  286. var myResult: Integer;
  287. begin
  288. path := ExpandConstant('{app}');
  289. pfPath := ExpandConstant('{pf}');
  290. winPath := ExpandConstant('{win}');
  291. pathWithSlashes := path;
  292. StringChange (pathWithSlashes, '\','/');
  293. batFile := path+'\stopdoliwamp.bat';
  294. Exec(batFile, '',path+'\', SW_HIDE, ewWaitUntilTerminated, myResult);
  295. end;
  296. //-----------------------------------------------------------
  297. // Install pages
  298. function NextButtonClick(CurPageID: Integer): Boolean;
  299. var myResult: Integer;
  300. var res: Boolean;
  301. var paramok: Boolean;
  302. var datadir: String;
  303. var exedirold: String;
  304. var exedirnew: String;
  305. var themessage: String;
  306. begin
  307. res := True;
  308. //MsgBox(''+CurPageID,mbConfirmation,MB_YESNO);
  309. if CurPageID = Page.ID then
  310. begin
  311. // This must be in if curpage.id = page.id, otherwise it is executed after each Next button
  312. path := ExpandConstant('{app}');
  313. winPath := ExpandConstant('{win}');
  314. pathWithSlashes := path;
  315. StringChange (pathWithSlashes, '\','/');
  316. // Migration of database
  317. // datadir := pathWithSlashes+'/bin/mariadb/marradb10.4.10/data';
  318. // exedirold := pathWithSlashes+'/bin/mariadb/marradb10.4.10/';
  319. // exedirnew := pathWithSlashes+'/bin/mariadb/marradb10.4.10/';
  320. // If we have a new database version, we should only copy old my.ini file into new directory
  321. // and change only all basedir= strings to use new version. Like this, data dir is still correct.
  322. // Install of service and stop/start scripts are already rebuild by installer.
  323. // FileCopy(exedirold+'/my.ini',exedirnew+'/my.ini', true);
  324. // We should not need this, also databases may not be called dolibarr
  325. // res := RenameFile(ibdata1dirold+'/dolibarr',ibdata1dirnew+'/dolibarr');
  326. // if res then
  327. // begin
  328. // themessage := CustomMessage('OldVersionFoundAndMoveInNew');
  329. // MsgBox(themessage,mbInformation,MB_OK);
  330. // TODO Replace also mysql.ini and resintall service
  331. // end
  332. // else
  333. // begin
  334. // themessage := CustomMessage('OldVersionFoundButFailedToMoveInNew');
  335. // MsgBox(themessage,mbInformation,MB_OK);
  336. // end;
  337. //----------------------------------------------
  338. // Copie des dll de php vers apache
  339. //----------------------------------------------
  340. // TODO Update this list when changing PHP/Apache versions
  341. phpDllCopy := 'libssh2.dll';
  342. filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False);
  343. phpDllCopy := 'icuuc64.dll';
  344. filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False);
  345. phpDllCopy := 'icuin64.dll';
  346. filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False);
  347. phpDllCopy := 'icuio64.dll';
  348. filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False);
  349. phpDllCopy := 'icudt64.dll';
  350. filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False);
  351. phpDllCopy := 'libsasl.dll';
  352. filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False);
  353. phpDllCopy := 'php7apache2_4.dll';
  354. filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False);
  355. phpDllCopy := 'php7ts.dll';
  356. filecopy (pathWithSlashes+'/bin/php/php'+phpVersion+'/'+phpDllCopy, pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/'+phpDllCopy, False);
  357. // Remove lock file
  358. lockfile := pathWithSlashes+'/dolibarr_documents/install.lock';
  359. if FileExists (lockfile) and not DeleteFile(lockfile) then
  360. begin
  361. themessage := FmtMessage(CustomMessage('FailedToDeleteLock'),[pathWithSlashes]);
  362. MsgBox(themessage,mbInformation,MB_OK);
  363. end;
  364. // Check if parameters already defined in conf.php file
  365. srcFile := pathWithSlashes+'/www/dolibarr/htdocs/conf/conf.php';
  366. if not FileExists (srcFile) then
  367. begin
  368. firstinstall := true;
  369. // Values from wizard
  370. mysmtp := Page.Values[0];
  371. myporta := Page.Values[1];
  372. myportas:= '443';
  373. myport := Page.Values[2];
  374. mypass := Page.Values[3];
  375. end
  376. else
  377. begin
  378. firstinstall := false;
  379. // Values from registry
  380. mysmtp := smtpServer;
  381. myporta := apachePort;
  382. myportas:= '443';
  383. myport := mysqlPort;
  384. mypass := newPassword;
  385. end;
  386. paramok := True;
  387. // TODO Test if choice of param is ok if firstinstall
  388. if (firstinstall) then
  389. begin
  390. // Test serveur SMTP
  391. // if paramok then
  392. // begin
  393. // batFile := pathWithSlashes+'/UsedPort.exe';
  394. // MsgBox('batFile = '+batFile,mbConfirmation,MB_YESNO)
  395. // Exec(batFile, '-s '+smtpServer+' -p 25', path+'\', SW_HIDE, ewWaitUntilTerminated, myResult);
  396. //themessage := 'Le serveur '+smtpServer+' semble ne pas etre joignable pour l envoi de mail SMTP (port 25). Si vous avez un firewall, verifiez sa configuration. Sinon, revenez en arriere pour choisir une autre valeur pour le serveur SMTP sortant d envoi de mail (Cette information est doit etre fournie par votre fournisseur d acces Internet).';
  397. // themessage := 'The server '+smtpServer+' seems to be unreachable to send outgoing SMTP emails (port 25). If you have a firewall, check its setup. Otherwise, go back to choose another value for the SMTP server (This information shoud be given by your Internet Service Provider) or click "No" to ignore error. Cancel choice to choose another value ?';
  398. // if ((IntToStr(myResult) <> '0') and (MsgBox(themessage,mbConfirmation,MB_YESNO) = IDYES)) then
  399. // begin
  400. // paramok := False;
  401. // end;
  402. // end;
  403. if paramok then
  404. begin
  405. // Test port Apache
  406. batFile := pathWithSlashes+'/UsedPort.exe';
  407. //MsgBox('batFile = '+batFile,mbConfirmation,MB_YESNO)
  408. Exec(batFile, '-s localhost -p '+myporta, path+'\', SW_HIDE, ewWaitUntilTerminated, myResult);
  409. //themessage := 'Le port '+myporta+' semble deja pris. Revenez en arriere pour choisir une autre valeur pour le port Apache.';
  410. themessage := FmtMessage(CustomMessage('PortAlreadyInUse'),[myporta,'Apache']);
  411. if ((IntToStr(myResult) = '0') and (MsgBox(themessage,mbConfirmation,MB_YESNO) = IDYES)) then
  412. begin
  413. paramok := False;
  414. end;
  415. end;
  416. if paramok then
  417. begin
  418. // Test port Mysql
  419. batFile := pathWithSlashes+'/UsedPort.exe';
  420. //MsgBox('batFile = '+batFile,mbConfirmation,MB_YESNO)
  421. Exec(batFile, '-s localhost -p '+myport, path+'\', SW_HIDE, ewWaitUntilTerminated, myResult);
  422. //themessage := 'Le port '+myport+' semble deja pris. Revenez en arriere pour choisir une autre valeur pour le port MySQL.';
  423. themessage := FmtMessage(CustomMessage('PortAlreadyInUse'),[myport,'MySql']);
  424. if ((IntToStr(myResult) = '0') and (MsgBox(themessage,mbConfirmation,MB_YESNO) = IDYES)) then
  425. begin
  426. paramok := False;
  427. end;
  428. end;
  429. end;
  430. if paramok
  431. then
  432. begin
  433. //----------------------------------------------
  434. // check that we don't try an upgrade (mysql upgrade no supported)
  435. //----------------------------------------------
  436. if FileExists (pathWithSlashes+'/bin/mysql/mysql5.0.45/bin/mysqld-nt.exe') then
  437. begin
  438. MsgBox('An existing installation using an old version of Mysql exists. Sorry, upgrade with this installer is not possible.', mbInformation, MB_OK);
  439. Abort();
  440. end;
  441. //----------------------------------------------
  442. // Rename file c:/windows/php.ini (we don't want it)
  443. //----------------------------------------------
  444. if FileExists ('c:/windows/php.ini') then
  445. begin
  446. if MsgBox('A previous c:/windows/php.ini file has been detected in your Windows directory. Do you want DoliWamp to rename it to php_old.ini to avoid conflicts ?',mbConfirmation,MB_YESNO) = IDYES then
  447. begin
  448. RenameFile('c:/windows/php.ini','c:/windows/php_old.ini');
  449. end;
  450. end;
  451. if FileExists ('c:/winnt/php.ini') then
  452. begin
  453. if MsgBox('A previous c:/winnt/php.ini file has been detected in your Windows directory. Do you want DoliWamp to rename it to php_old.ini to avoid conflicts ?',mbConfirmation,MB_YESNO) = IDYES then
  454. begin
  455. RenameFile('c:/winnt/php.ini','c:/winnt/php_old.ini');
  456. end;
  457. end;
  458. //----------------------------------------------
  459. // Create rundoliwamp.bat, rundolihelp.bat and rundoliadmin.bat (if not exists)
  460. //----------------------------------------------
  461. destFile := pathWithSlashes+'/rundoliwamp.bat';
  462. srcFile := pathWithSlashes+'/rundoliwamp.bat.install';
  463. destFileH := pathWithSlashes+'/rundolihelp.bat';
  464. srcFileH := pathWithSlashes+'/rundolihelp.bat.install';
  465. destFileA := pathWithSlashes+'/rundoliadmin.bat';
  466. srcFileA := pathWithSlashes+'/rundoliadmin.bat.install';
  467. if (not FileExists (destFile) or not FileExists (destFileH) or not FileExists (destFileA))
  468. and (FileExists(srcFile) and FileExists(srcFileH) and FileExists(srcFileA)) then
  469. begin
  470. //navigateur
  471. browser := 'iexplore.exe';
  472. if browser = 'iexplore.exe' then
  473. begin
  474. if FileExists (pfPath+'/Google/Chrome/Application/chrome.exe') then
  475. begin
  476. if MsgBox(CustomMessage('ChromeDetected'),mbConfirmation,MB_YESNO) = IDYES then
  477. begin
  478. browser := pfPath+'/Google/Chrome/Application/chrome.exe';
  479. end;
  480. end;
  481. end;
  482. if browser = 'iexplore.exe' then
  483. begin
  484. if FileExists (pfPath+'/Mozilla Firefox/firefox.exe') then
  485. begin
  486. if MsgBox(CustomMessage('FirefoxDetected'),mbConfirmation,MB_YESNO) = IDYES then
  487. begin
  488. browser := pfPath+'/Mozilla Firefox/firefox.exe';
  489. end;
  490. end;
  491. end;
  492. if browser = 'iexplore.exe' then
  493. begin
  494. if FileExists (winPath+'/SystemApps/Microsoft.MicrosoftEdge_8wekyb3d8bbwe/MicrosoftEdge.exe') then
  495. begin
  496. if MsgBox(CustomMessage('MicrosoftEdgeDetected'),mbConfirmation,MB_YESNO) = IDYES then
  497. begin
  498. browser := winPath+'/SystemApps/Microsoft.MicrosoftEdge_8wekyb3d8bbwe/MicrosoftEdge.exe';
  499. end;
  500. end;
  501. end;
  502. if browser = 'iexplore.exe' then
  503. begin
  504. if FileExists (pfPath+'/Internet Explorer/iexplore.exe') then
  505. begin
  506. GetOpenFileName(CustomMessage('ChooseDefaultBrowser'), browser, pfPath+'/Internet Explorer', 'exe files (*.exe)|*.exe|All files (*.*)|*.*' ,'exe');
  507. end
  508. else
  509. begin
  510. GetOpenFileName(CustomMessage('ChooseDefaultBrowser'), browser, winPath, 'exe files (*.exe)|*.exe|All files (*.*)|*.*' ,'exe');
  511. end;
  512. end;
  513. LoadStringFromFile (srcFile, srcContents);
  514. StringChangeEx (srcContents, 'WAMPBROWSER', browser, True);
  515. StringChangeEx (srcContents, 'WAMPAPACHEPORT', myporta, True);
  516. StringChangeEx (srcContents, 'WAMPAPACHEPSSL', myportas, True);
  517. SaveStringToFile(destFile,srcContents, False);
  518. LoadStringFromFile (srcFileH, srcContents);
  519. StringChangeEx (srcContents, 'WAMPBROWSER', browser, True);
  520. StringChangeEx (srcContents, 'WAMPAPACHEPORT', myporta, True);
  521. StringChangeEx (srcContents, 'WAMPAPACHEPSSL', myportas, True);
  522. SaveStringToFile(destFileH,srcContents, False);
  523. LoadStringFromFile (srcFileA, srcContents);
  524. StringChangeEx (srcContents, 'WAMPBROWSER', browser, True);
  525. StringChangeEx (srcContents, 'WAMPAPACHEPORT', myporta, True);
  526. StringChangeEx (srcContents, 'WAMPAPACHEPSSL', myportas, True);
  527. SaveStringToFile(destFileA,srcContents, False);
  528. end;
  529. if MsgBox(CustomMessage('DoliWampWillStartApacheMysql'),mbConfirmation,MB_YESNO) = IDYES then
  530. begin
  531. //----------------------------------------------
  532. // Create file alias dolibarr (if not exists)
  533. //----------------------------------------------
  534. destFile := pathWithSlashes+'/alias/dolibarr.conf';
  535. srcFile := pathWithSlashes+'/alias/dolibarr.conf.install';
  536. if FileExists(srcFile) then
  537. begin
  538. if not FileExists (destFile) then
  539. begin
  540. LoadStringFromFile (srcFile, srcContents);
  541. StringChangeEx (srcContents, 'WAMPROOT', pathWithSlashes, True);
  542. StringChangeEx (srcContents, 'WAMPMYSQLNEWPASSWORD', mypass, True);
  543. SaveStringToFile(destFile, srcContents, False);
  544. end
  545. else
  546. begin
  547. // We must replace to use format 2.4 of apache
  548. DeleteFile(destFile);
  549. LoadStringFromFile (srcFile, srcContents);
  550. StringChangeEx (srcContents, 'WAMPROOT', pathWithSlashes, True);
  551. StringChangeEx (srcContents, 'WAMPMYSQLNEWPASSWORD', mypass, True);
  552. SaveStringToFile(destFile, srcContents, False);
  553. end;
  554. end;
  555. DeleteFile(srcFile);
  556. //----------------------------------------------
  557. // Create file httpd.conf (if not exists)
  558. //----------------------------------------------
  559. destFile := pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/conf/httpd.conf';
  560. srcFile := pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/conf/httpd.conf.install';
  561. if not FileExists (destFile) and FileExists (srcFile) then
  562. begin
  563. LoadStringFromFile (srcFile, srcContents);
  564. //installDir et version de php
  565. StringChangeEx (srcContents, 'WAMPROOT', pathWithSlashes, True);
  566. StringChangeEx (srcContents, 'WAMPPHPVERSION', phpVersion, True);
  567. StringChangeEx (srcContents, 'WAMPAPACHEVERSION', apacheVersion, True);
  568. StringChangeEx (srcContents, 'WAMPAPACHEPORT', myporta, True);
  569. StringChangeEx (srcContents, 'WAMPAPACHEPSSL', myportas, True);
  570. SaveStringToFile(destFile,srcContents, False);
  571. end;
  572. //----------------------------------------------
  573. // Create file my.ini (if not exists)
  574. //----------------------------------------------
  575. destFile := pathWithSlashes+'/bin/mariadb/mariadb'+mysqlVersion+'/my.ini';
  576. srcFile := pathWithSlashes+'/bin/mariadb/mariadb'+mysqlVersion+'/my.ini.install';
  577. if not FileExists (destFile) then
  578. begin
  579. LoadStringFromFile (srcFile, srcContents);
  580. //installDir et version de php
  581. StringChangeEx (srcContents, 'WAMPROOT', pathWithSlashes, True);
  582. StringChangeEx (srcContents, 'WAMPMYSQLPORT', myport, True);
  583. StringChangeEx (srcContents, 'WAMPMYSQLVERSION', mysqlVersion, True);
  584. SaveStringToFile(destFile,srcContents, False);
  585. end;
  586. //----------------------------------------------
  587. // Create file index.php (always but archive if exists)
  588. //----------------------------------------------
  589. destFile := pathWithSlashes+'/www/index.php';
  590. srcFile := pathWithSlashes+'/www/index.php.install';
  591. if not FileExists (destFile) then
  592. begin
  593. LoadStringFromFile (srcFile, srcContents);
  594. StringChangeEx (srcContents, 'WAMPPHPVERSION', phpVersion, True);
  595. StringChangeEx (srcContents, 'WAMPMYSQLVERSION', mysqlVersion, True);
  596. StringChangeEx (srcContents, 'WAMPAPACHEVERSION', apacheVersion, True);
  597. StringChangeEx (srcContents, 'WAMPAPACHEPORT', myporta, True);
  598. StringChangeEx (srcContents, 'WAMPAPACHEPSSL', myportas, True);
  599. SaveStringToFile(destFile, srcContents, False);
  600. end
  601. else
  602. begin
  603. RenameFile(destFile, destFile+'.old');
  604. LoadStringFromFile (srcFile, srcContents);
  605. StringChangeEx (srcContents, 'WAMPPHPVERSION', phpVersion, True);
  606. StringChangeEx (srcContents, 'WAMPMYSQLVERSION', mysqlVersion, True);
  607. StringChangeEx (srcContents, 'WAMPAPACHEVERSION', apacheVersion, True);
  608. StringChangeEx (srcContents, 'WAMPAPACHEPORT', myporta, True);
  609. StringChangeEx (srcContents, 'WAMPAPACHEPSSL', myportas, True);
  610. SaveStringToFile(destFile, srcContents, False);
  611. end;
  612. //----------------------------------------------
  613. // Create file dolibarr parametres predefinis install web (if not exists)
  614. //----------------------------------------------
  615. destFile := pathWithSlashes+'/www/dolibarr/htdocs/install/install.forced.php';
  616. srcFile := pathWithSlashes+'/www/dolibarr/htdocs/install/install.forced.php.install';
  617. if not FileExists (destFile) and FileExists (srcFile) then
  618. begin
  619. LoadStringFromFile (srcFile, srcContents);
  620. StringChangeEx (srcContents, 'WAMPROOT', pathWithSlashes, True);
  621. StringChangeEx (srcContents, 'WAMPMYSQLVERSION', mysqlVersion, True);
  622. StringChangeEx (srcContents, 'WAMPMYSQLPORT', myport, True);
  623. StringChangeEx (srcContents, 'WAMPMYSQLNEWPASSWORD', mypass, True);
  624. SaveStringToFile(destFile,srcContents, False);
  625. end;
  626. //----------------------------------------------
  627. // Create file install_services.bat (always)
  628. //----------------------------------------------
  629. destFile := pathWithSlashes+'/install_services.bat';
  630. srcFile := pathWithSlashes+'/install_services.bat.install';
  631. if FileExists(srcFile) then
  632. begin
  633. LoadStringFromFile (srcFile, srcContents);
  634. //version de apache et mysql
  635. StringChangeEx (srcContents, 'WAMPROOT', pathWithSlashes, True);
  636. StringChangeEx (srcContents, 'WAMPMYSQLVERSION', mysqlVersion, True);
  637. StringChangeEx (srcContents, 'WAMPAPACHEVERSION', apacheVersion, True);
  638. StringChangeEx (srcContents, 'WAMPMYSQLPORT', myport, True);
  639. StringChangeEx (srcContents, 'WAMPMYSQLNEWPASSWORD', mypass, True);
  640. SaveStringToFile(destFile,srcContents, False);
  641. end;
  642. //----------------------------------------------
  643. // Create file uninstall_services.bat (always)
  644. //----------------------------------------------
  645. destFile := pathWithSlashes+'/uninstall_services.bat';
  646. srcFile := pathWithSlashes+'/uninstall_services.bat.install';
  647. if FileExists (srcFile) then
  648. begin
  649. LoadStringFromFile (srcFile, srcContents);
  650. //version de apache et mysql
  651. StringChangeEx (srcContents, 'WAMPROOT', pathWithSlashes, True);
  652. StringChangeEx (srcContents, 'WAMPMYSQLVERSION', mysqlVersion, True);
  653. StringChangeEx (srcContents, 'WAMPAPACHEVERSION', apacheVersion, True);
  654. SaveStringToFile(destFile,srcContents, False);
  655. end;
  656. //----------------------------------------------
  657. // Create file mysqlinitpassword.bat (always)
  658. //----------------------------------------------
  659. destFile := pathWithSlashes+'/mysqlinitpassword.bat';
  660. srcFile := pathWithSlashes+'/mysqlinitpassword.bat.install';
  661. if FileExists (srcFile) then
  662. begin
  663. LoadStringFromFile (srcFile, srcContents);
  664. //version de apache et mysql
  665. StringChangeEx (srcContents, 'WAMPMYSQLVERSION', mysqlVersion, True);
  666. StringChangeEx (srcContents, 'WAMPMYSQLPORT', myport, True);
  667. StringChangeEx (srcContents, 'WAMPMYSQLNEWPASSWORD', mypass, True);
  668. SaveStringToFile(destFile,srcContents, False);
  669. end;
  670. //----------------------------------------------
  671. // Create file mysqltestinstall.bat (always)
  672. //----------------------------------------------
  673. destFile := pathWithSlashes+'/mysqltestinstall.bat';
  674. srcFile := pathWithSlashes+'/mysqltestinstall.bat.install';
  675. if FileExists (srcFile) then
  676. begin
  677. LoadStringFromFile (srcFile, srcContents);
  678. //version de apache et mysql
  679. StringChangeEx (srcContents, 'WAMPROOT', pathWithSlashes, True);
  680. StringChangeEx (srcContents, 'WAMPAPACHEVERSION', apacheVersion, True);
  681. StringChangeEx (srcContents, 'WAMPMYSQLVERSION', mysqlVersion, True);
  682. StringChangeEx (srcContents, 'WAMPMYSQLPORT', myport, True);
  683. SaveStringToFile(destFile,srcContents, False);
  684. end;
  685. //----------------------------------------------
  686. // Create file startdoliwamp_manual_donotuse.bat (always)
  687. //----------------------------------------------
  688. destFile := pathWithSlashes+'/startdoliwamp_manual_donotuse.bat';
  689. srcFile := pathWithSlashes+'/startdoliwamp_manual_donotuse.bat.install';
  690. if FileExists (srcFile) then
  691. begin
  692. LoadStringFromFile (srcFile, srcContents);
  693. //version de apache et mysql
  694. StringChangeEx (srcContents, 'WAMPROOT', pathWithSlashes, True);
  695. StringChangeEx (srcContents, 'WAMPAPACHEVERSION', apacheVersion, True);
  696. StringChangeEx (srcContents, 'WAMPMYSQLVERSION', mysqlVersion, True);
  697. StringChangeEx (srcContents, 'WAMPMYSQLPORT', myport, True);
  698. SaveStringToFile(destFile,srcContents, False);
  699. end;
  700. //----------------------------------------------
  701. // Create file builddemosslfiles.bat (always)
  702. //----------------------------------------------
  703. destFile := pathWithSlashes+'/builddemosslfiles.bat';
  704. srcFile := pathWithSlashes+'/builddemosslfiles.bat.install';
  705. if FileExists (srcFile) then
  706. begin
  707. LoadStringFromFile (srcFile, srcContents);
  708. //version de apache et mysql
  709. StringChangeEx (srcContents, 'WAMPROOT', pathWithSlashes, True);
  710. StringChangeEx (srcContents, 'WAMPAPACHEVERSION', apacheVersion, True);
  711. SaveStringToFile(destFile,srcContents, False);
  712. end;
  713. //----------------------------------------------
  714. // Create file php.ini in php (if not exists)
  715. //----------------------------------------------
  716. destFile := pathWithSlashes+'/bin/php/php'+phpVersion+'/php.ini';
  717. srcFile := pathWithSlashes+'/bin/php/php'+phpVersion+'/php.ini.install';
  718. if not FileExists (destFile) and FileExists(srcFile) then
  719. begin
  720. LoadStringFromFile (srcFile, srcContents);
  721. StringChangeEx (srcContents, 'WAMPROOT', pathWithSlashes, True);
  722. StringChangeEx (srcContents, 'WAMPSMTP', mysmtp, True);
  723. StringChangeEx (srcContents, 'WAMPPHPVERSION', phpVersion, True);
  724. SaveStringToFile(destFile,srcContents, False);
  725. end;
  726. //----------------------------------------------
  727. // Create file php.ini in apache (if not exists)
  728. //----------------------------------------------
  729. destFile := pathWithSlashes+'/bin/apache/apache'+apacheVersion+'/bin/php.ini';
  730. srcFile := pathWithSlashes+'/bin/php/php'+phpVersion+'/php.ini.install';
  731. if not FileExists (destFile) and FileExists(srcFile) then
  732. begin
  733. LoadStringFromFile (srcFile, srcContents);
  734. StringChangeEx (srcContents, 'WAMPROOT', pathWithSlashes, True);
  735. StringChangeEx (srcContents, 'WAMPSMTP', mysmtp, True);
  736. StringChangeEx (srcContents, 'WAMPPHPVERSION', phpVersion, True);
  737. SaveStringToFile(destFile,srcContents, False);
  738. end;
  739. // Uninstall services
  740. batFile := path+'\uninstall_services.bat';
  741. Exec(batFile, '',path+'\', SW_HIDE, ewWaitUntilTerminated, myResult);
  742. // Install services
  743. batFile := path+'\install_services.bat';
  744. Exec(batFile, '',path+'\', SW_HIDE, ewWaitUntilTerminated, myResult);
  745. // Start services
  746. batFile := path+'\startdoliwamp.bat';
  747. Exec(batFile, '',path+'\', SW_HIDE, ewWaitUntilTerminated, myResult);
  748. //MsgBox(myResult,mbInformation,MB_OK);
  749. // Change mysql password (works only if not yet defined)
  750. batFile := path+'\mysqlinitpassword.bat';
  751. Exec(batFile, '',path+'\', SW_HIDE, ewWaitUntilTerminated, myResult);
  752. // Remove dangerous files
  753. batFile := path+'\removefiles.bat';
  754. Exec(batFile, '',path+'\', SW_HIDE, ewWaitUntilTerminated, myResult);
  755. // Save parameters to registry
  756. RegWriteStringValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\NLTechno\DoliWamp', 'smtpServer', mysmtp);
  757. RegWriteStringValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\NLTechno\DoliWamp', 'apachePort', myporta);
  758. RegWriteStringValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\NLTechno\DoliWamp', 'apachePSSL', myportas);
  759. RegWriteStringValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\NLTechno\DoliWamp', 'mysqlPort', myport);
  760. RegWriteStringValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\NLTechno\DoliWamp', 'newPassword', mypass);
  761. res := True;
  762. end
  763. else
  764. begin
  765. // MsgBox('Apache and Mysql installation has been canceled. Please select parameters to start their installation.',mbInformation,MB_OK)
  766. res := False;
  767. end;
  768. end
  769. else
  770. begin
  771. //MsgBox('Selected values seems to be already used. Please choose other values.',mbInformation,MB_OK);
  772. res := False;
  773. end;
  774. end;
  775. Result := res;
  776. end;
  777. //-----------------------------------------------
  778. //procedure launched by the end of the installation, it deletes the installation files
  779. procedure DeinitializeSetup();
  780. begin
  781. // DeleteFile(path+'\install_services.bat');
  782. end;
  783. //-----------------------------------------------
  784. //procedure launched at beginning of the uninstallation
  785. function InitializeUninstall(): Boolean;
  786. begin
  787. Result := RegDeleteValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\NLTechno\DoliWamp','smtpServer');
  788. Result := RegDeleteValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\NLTechno\DoliWamp','apachePort');
  789. Result := RegDeleteValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\NLTechno\DoliWamp','mysqlPort');
  790. Result := RegDeleteValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\NLTechno\DoliWamp','newPassword');
  791. Result := RegDeleteKeyIncludingSubkeys(HKEY_LOCAL_MACHINE, 'SOFTWARE\NLTechno\DoliWamp');
  792. Result := True;
  793. end;
  794. //-----------------------------------------------
  795. //procedure launched by the end of the uninstallation
  796. procedure DeinitializeUninstall();
  797. begin
  798. path := ExpandConstant('{app}');
  799. winPath := ExpandConstant('{win}');
  800. pathWithSlashes := path;
  801. StringChange (pathWithSlashes, '\','/');
  802. MsgBox(FmtMessage(CustomMessage('ProgramHasBeenRemoved'),[path]),mbInformation,MB_OK);
  803. end;
  804. [Run]
  805. ; Launch Dolibarr in browser. This is run after Wizard because of postinstall flag
  806. Filename: "{app}\rundoliwamp.bat"; Description: {cm:LaunchNow}; Flags: shellexec postinstall skipifsilent runhidden
  807. [UninstallDelete]
  808. Type: files; Name: "{app}\*.*"
  809. Type: files; Name: "{app}\bin\mariadb\mariadb10.4.10\*.*"
  810. Type: filesandordirs; Name: "{app}\alias"
  811. Type: filesandordirs; Name: "{app}\apps"
  812. Type: filesandordirs; Name: "{app}\bin\apache"
  813. Type: filesandordirs; Name: "{app}\bin\php"
  814. Type: filesandordirs; Name: "{app}\help"
  815. Type: filesandordirs; Name: "{app}\lang"
  816. Type: filesandordirs; Name: "{app}\logs"
  817. Type: filesandordirs; Name: "{app}\scripts"
  818. Type: filesandordirs; Name: "{app}\tmp"
  819. Type: filesandordirs; Name: "{app}\www\dolibarr"
  820. [UninstallRun]
  821. Filename: "{app}\uninstall_services.bat"; Flags: runhidden