1!define PRODUCT_NAME "PRODUCTNAMEPLACEHOLDER" 2!define PRODUCT_VERSION "PRODUCTVERSIONPLACEHOLDER" 3!define PRODUCT_PUBLISHER "PUBLISHERPLACEHOLDER" 4!define PRODUCT_WEB_SITE "WEBSITEPLACEHOLDER" 5 6; Product Information 7VIAddVersionKey ProductName "Apache PRODUCTNAMEPLACEHOLDER" 8VIAddVersionKey CompanyName "Apache Software Foundation" 9VIAddVersionKey LegalCopyright "(c) 2012-2023 The Apache Software Foundation" 10VIAddVersionKey FileDescription "Apache PRODUCTNAMEPLACEHOLDER Installer" 11VIAddVersionKey ProductVersion "PRODUCTVERSIONPLACEHOLDER" 12VIProductVersion "4.1.9813.500" 13 14; Enable Unicode 15Unicode true 16 17; Compression options 18CRCCheck on 19SetCompressor zlib 20 21; MUI 1.67 compatible ------ 22!include "MUI.nsh" 23 24Function .onInit 25 26 Call GetParameters 27 Pop $1 28 ;MessageBox MB_OK "$1" 29 30 Push $1 31 Push "/HELP=" 32 Call GetOptions 33 Pop $2 34 ;MessageBox MB_OK "HELP: $2" 35 36 StrCmp $2 "ON" showhelp nohelp 37 showhelp: 38 MessageBox MB_OK|MB_ICONINFORMATION \ 39 "DOWNLOADNAMEPLACEHOLDER options: $\n $\n \ 40 /S : Silent installation $\n \ 41 /D=<path> : NSIS installation directory (must be the last option!) $\n \ 42 /EXTRACTONLY=ON : NSIS only extracts the PRODUCTNAMEPLACEHOLDER PRODUCTVERSIONPLACEHOLDER installation set $\n \ 43 /INSTALLLOCATION=<path> : PRODUCTNAMEPLACEHOLDER PRODUCTVERSIONPLACEHOLDER installation directory $\n \ 44 /POSTREMOVE=ON : Removes the unpacked installation set after PRODUCTNAMEPLACEHOLDER PRODUCTVERSIONPLACEHOLDER installation $\n \ 45 /INSTALLJAVA=ON : Installs JRE located in sub directory java, if exists $\n \ 46 /GUILEVEL=<guilevel> : Setting Windows Installer GUI level: qr, qb, qn, qf, ... $\n \ 47 /PARAM1=$\"key=value$\" : Flexible parameter 1. Example: /PARAM1=$\"INSTALLLEVEL=70$\" $\n \ 48 /PARAM2=$\"key=value$\" : Flexible parameter 2. $\n \ 49 /PARAM3=$\"key=value$\" : Flexible parameter 3. $\n \ 50 /HELP=ON : Shows this help $\n" 51 Quit 52 GoTo onInitDone 53 54 nohelp: 55 56 StrCmp $INSTDIR "" pathnotset pathset 57 pathnotset: 58 59 IfSilent onInitSilent onInitNoSilent 60 61 onInitSilent: 62 StrCpy $INSTDIR "$TEMP\PRODUCTPATHPLACEHOLDER Installation Files" 63 GoTo onInitDone 64 65 onInitNoSilent: 66 StrCpy $INSTDIR "$DESKTOP\PRODUCTPATHPLACEHOLDER Installation Files" 67 GoTo onInitDone 68 69 onInitDone: 70 pathset: 71 72FunctionEnd 73 74Function GetParameters 75 76 Push $R0 77 Push $R1 78 Push $R2 79 Push $R3 80 81 StrCpy $R2 1 82 83 StrLen $R3 $CMDLINE 84 85 ;Check for quote or space 86 StrCpy $R0 $CMDLINE $R2 87 88 StrCmp $R0 '"' 0 +3 89 StrCpy $R1 '"' 90 Goto loop 91 StrCpy $R1 " " 92 93 loop: 94 IntOp $R2 $R2 + 1 95 StrCpy $R0 $CMDLINE 1 $R2 96 StrCmp $R0 $R1 get 97 StrCmp $R2 $R3 get 98 Goto loop 99 100 get: 101 IntOp $R2 $R2 + 1 102 StrCpy $R0 $CMDLINE 1 $R2 103 StrCmp $R0 " " get 104 StrCpy $R0 $CMDLINE "" $R2 105 106 Pop $R3 107 Pop $R2 108 Pop $R1 109 Exch $R0 110 111FunctionEnd 112 113Function GetOptions 114 115 Exch $1 116 Exch 117 Exch $0 118 Exch 119 Push $2 120 Push $3 121 Push $4 122 Push $5 123 Push $6 124 Push $7 125 126 StrCpy $2 $1 '' 1 127 StrCpy $1 $1 1 128 StrLen $3 $2 129 StrCpy $7 0 130 131 begin: 132 StrCpy $4 -1 133 StrCpy $6 '' 134 135 quote: 136 IntOp $4 $4 + 1 137 StrCpy $5 $0 1 $4 138 StrCmp $5$7 '0' notfound 139 StrCmp $5 '' trimright 140 StrCmp $5 '"' 0 +7 141 StrCmp $6 '' 0 +3 142 StrCpy $6 '"' 143 goto quote 144 StrCmp $6 '"' 0 +3 145 StrCpy $6 '' 146 goto quote 147 StrCmp $5 `'` 0 +7 148 StrCmp $6 `` 0 +3 149 StrCpy $6 `'` 150 goto quote 151 StrCmp $6 `'` 0 +3 152 StrCpy $6 `` 153 goto quote 154 StrCmp $5 '`' 0 +7 155 StrCmp $6 '' 0 +3 156 StrCpy $6 '`' 157 goto quote 158 StrCmp $6 '`' 0 +3 159 StrCpy $6 '' 160 goto quote 161 StrCmp $6 '"' quote 162 StrCmp $6 `'` quote 163 StrCmp $6 '`' quote 164 StrCmp $5 $1 0 quote 165 StrCmp $7 0 trimleft trimright 166 167 trimleft: 168 IntOp $4 $4 + 1 169 StrCpy $5 $0 $3 $4 170 StrCmp $5 '' notfound 171 StrCmp $5 $2 0 quote 172 IntOp $4 $4 + $3 173 StrCpy $0 $0 '' $4 174 StrCpy $4 $0 1 175 StrCmp $4 ' ' 0 +3 176 StrCpy $0 $0 '' 1 177 goto -3 178 StrCpy $7 1 179 goto begin 180 181 trimright: 182 StrCpy $0 $0 $4 183 StrCpy $4 $0 1 -1 184 StrCmp $4 ' ' 0 +3 185 StrCpy $0 $0 -1 186 goto -3 187 StrCpy $3 $0 1 188 StrCpy $4 $0 1 -1 189 StrCmp $3 $4 0 end 190 StrCmp $3 '"' +3 191 StrCmp $3 `'` +2 192 StrCmp $3 '`' 0 end 193 StrCpy $0 $0 -1 1 194 goto end 195 196 notfound: 197 StrCpy $0 '' 198 199 end: 200 Pop $7 201 Pop $6 202 Pop $5 203 Pop $4 204 Pop $3 205 Pop $2 206 Pop $1 207 Exch $0 208 209FunctionEnd 210 211; MUI Settings 212!define MUI_HEADERIMAGE 213!define MUI_HEADERIMAGE_RIGHT 214!define MUI_HEADERIMAGE_BITMAP_NOSTRETCH 215!define MUI_HEADERIMAGE_BITMAP BANNERBMPPLACEHOLDER 216!define MUI_WELCOMEFINISHPAGE_BITMAP WELCOMEBMPPLACEHOLDER 217!define MUI_WELCOMEFINISHPAGE_BITMAP_NOSTRETCH 218!define MUI_WELCOMEPAGE_TITLE_3LINES 219!define MUI_ABORTWARNING 220!define MUI_ICON "SETUPICOPLACEHOLDER" 221 222; Welcome page 223!insertmacro MUI_PAGE_WELCOME 224!insertmacro MUI_PAGE_DIRECTORY 225!insertmacro MUI_PAGE_INSTFILES 226 227!macro MUI_LANGUAGE_PACK LANGUAGE 228 !verbose push 229 !verbose ${MUI_VERBOSE} 230 !insertmacro MUI_INSERT 231 LoadLanguageFile "NSISPATHPLACEHOLDER\${LANGUAGE}_pack.nlf" 232 ;Set default language file for MUI and backup user setting 233 !ifdef LANGFILE_DEFAULT 234 !define MUI_LANGFILE_DEFAULT_TEMP "${LANGFILE_DEFAULT}" 235 !undef LANGFILE_DEFAULT 236 !endif 237 !define LANGFILE_DEFAULT "${NSISDIR}\Contrib\Language files\English.nsh" 238 ;Include language file 239 !insertmacro LANGFILE_INCLUDE "NSISPATHPLACEHOLDER\${LANGUAGE}_pack.nsh" 240 ;Restore user setting for default language file 241 !undef LANGFILE_DEFAULT 242 !ifdef MUI_LANGFILE_DEFAULT_TEMP 243 !define LANGFILE_DEFAULT "${MUI_LANGFILE_DEFAULT}" 244 !endif 245 ;Add language to list of languages for selection dialog 246 !ifndef MUI_LANGDLL_LANGUAGES 247 !define MUI_LANGDLL_LANGUAGES "'${LANGFILE_${LANGUAGE}_NAME}' '${LANG_${LANGUAGE}}' " 248 !define MUI_LANGDLL_LANGUAGES_CP "'${LANGFILE_${LANGUAGE}_NAME}' '${LANG_${LANGUAGE}}' '${LANG_${LANGUAGE}_CP}' " 249 !else 250 !ifdef MUI_LANGDLL_LANGUAGES_TEMP 251 !undef MUI_LANGDLL_LANGUAGES_TEMP 252 !endif 253 !define MUI_LANGDLL_LANGUAGES_TEMP "${MUI_LANGDLL_LANGUAGES}" 254 !undef MUI_LANGDLL_LANGUAGES 255 !ifdef MUI_LANGDLL_LANGUAGES_CP_TEMP 256 !undef MUI_LANGDLL_LANGUAGES_CP_TEMP 257 !endif 258 !define MUI_LANGDLL_LANGUAGES_CP_TEMP "${MUI_LANGDLL_LANGUAGES_CP}" 259 !undef MUI_LANGDLL_LANGUAGES_CP 260 !define MUI_LANGDLL_LANGUAGES "'${LANGFILE_${LANGUAGE}_NAME}' '${LANG_${LANGUAGE}}' ${MUI_LANGDLL_LANGUAGES_TEMP}" 261 !define MUI_LANGDLL_LANGUAGES_CP "'${LANGFILE_${LANGUAGE}_NAME}' '${LANG_${LANGUAGE}}' '${LANG_${LANGUAGE}_CP}' ${MUI_LANGDLL_LANGUAGES_CP_TEMP}" 262 !endif 263 !verbose pop 264!macroend 265 266; Language files 267ALLLANGUAGESPLACEHOLDER 268 269; Reserve files 270;!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS 271 272; MUI end ------ 273 274Name "PRODUCTNAMEPLACEHOLDER PRODUCTVERSIONPLACEHOLDER" 275OutFile "OUTPUTDIRPLACEHOLDER\DOWNLOADNAMEPLACEHOLDER" 276; InstallDir "$DESKTOP\PRODUCTNAMEPLACEHOLDER PRODUCTVERSIONPLACEHOLDER Installation Files" 277; ShowInstDetails show 278 279Section "MainSection" SEC01 280ALLFILESPLACEHOLDER 281SectionEnd 282 283Section -Post 284 285 StrCpy $R9 "false" 286 287 Call GetParameters 288 Pop $1 289 290 Push $1 291 Push "/EXTRACTONLY=" 292 Call GetOptions 293 Pop $2 294 ;MessageBox MB_OK "EXTRACTONLY: $2" 295 296 StrCmp $2 "ON" onPostDone callsetup 297 callsetup: 298 299 Push $1 300 Push "/INSTALLLOCATION=" 301 Call GetOptions 302 Pop $2 303 ;MessageBox MB_OK "INSTALLLOCATION: $2" 304 305 StrCmp $2 "" installnotset installset 306 installset: 307 StrCpy $3 'INSTALLLOCATION="$2"' 308 installnotset: 309 310 Push $1 311 Push "/INSTALLJAVA=" 312 Call GetOptions 313 Pop $2 314 ;MessageBox MB_OK "INSTALLJAVA: $2" 315 316 StrCmp $2 "ON" setinstalljava setdontinstalljava 317 setinstalljava: 318 StrCpy $R9 "true" 319 setdontinstalljava: 320 321 Push $1 322 Push "/GUILEVEL=" 323 Call GetOptions 324 Pop $2 325 326 StrCmp $2 "" dontsetguilevel setguilevel 327 setguilevel: 328 StrCpy $7 "/" 329 StrCpy $7 $7$2 330 GoTo afterguilevel 331 dontsetguilevel: 332 StrCpy $7 "/qr" 333 afterguilevel: 334 335 ;MessageBox MB_OK "GUILEVEL: $7" 336 337 Push $1 338 Push "/PARAM1=" 339 Call GetOptions 340 Pop $2 341 ;MessageBox MB_OK "PARAM1: $2" 342 343 StrCmp $2 "" param1notset param1set 344 param1set: 345 StrCpy $4 "$2" 346 param1notset: 347 348 349 Push $1 350 Push "/PARAM2=" 351 Call GetOptions 352 Pop $2 353 ;MessageBox MB_OK "PARAM2: $2" 354 355 StrCmp $2 "" param2notset param2set 356 param2set: 357 StrCpy $5 "$2" 358 param2notset: 359 360 361 Push $1 362 Push "/PARAM3=" 363 Call GetOptions 364 Pop $2 365 ;MessageBox MB_OK "PARAM3: $2" 366 367 StrCmp $2 "" param3notset param3set 368 param3set: 369 StrCpy $6 "$2" 370 param3notset: 371 372 IfSilent onPostSilent onPostNoSilent 373 374 onPostSilent: 375 Push $1 376 Push "/POSTREMOVE=" 377 Call GetOptions 378 Pop $2 379 ;MessageBox MB_OK "POSTREMOVE: $2" 380 381 StrCmp $2 "ON" postremovesilent nopostremovesilent 382 nopostremovesilent: 383 StrCmp $R9 "true" installjava1 dontinstalljava1 384 installjava1: 385 ExecWait '$INSTDIR\java\WINDOWSJAVAFILENAMEPLACEHOLDER /s /v"/qn REBOOT=Suppress"' 386 dontinstalljava1: 387 ExecWait "$INSTDIR\setup.exe -lang $LANGUAGE $3 $4 $5 $6 $7 -ignore_running" $0 388 SetErrorLevel $0 389 Quit 390 GoTo onPostDone 391 postremovesilent: 392 StrCmp $R9 "true" installjava2 dontinstalljava2 393 installjava2: 394 ExecWait '$INSTDIR\java\WINDOWSJAVAFILENAMEPLACEHOLDER /s /v"/qn REBOOT=Suppress"' 395 dontinstalljava2: 396 ExecWait "$INSTDIR\setup.exe -lang $LANGUAGE $3 $4 $5 $6 $7 -ignore_running" $0 397 RMDir /r $INSTDIR 398 RMDir $INSTDIR 399 SetErrorLevel $0 400 Quit 401 GoTo onPostDone 402 403 onPostNoSilent: 404 Push $1 405 Push "/POSTREMOVE=" 406 Call GetOptions 407 Pop $2 408 ;MessageBox MB_OK "POSTREMOVE: $2" 409 410 StrCmp $2 "ON" postremove nopostremove 411 nopostremove: 412 Exec "$INSTDIR\setup.exe -lang $LANGUAGE $3 $4 $5 $6" 413 Quit 414 GoTo onPostDone 415 postremove: 416 StrCmp $R9 "true" installjava3 dontinstalljava3 417 installjava3: 418 ExecWait '$INSTDIR\java\WINDOWSJAVAFILENAMEPLACEHOLDER /s /v"/qr REBOOT=Suppress"' 419 dontinstalljava3: 420 ExecWait "$INSTDIR\setup.exe -lang $LANGUAGE $3 $4 $5 $6" $0 421 RMDir /r $INSTDIR 422 RMDir $INSTDIR 423 SetErrorLevel $0 424 Quit 425 GoTo onPostDone 426 427 onPostDone: 428 429SectionEnd 430