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