├── elasticsearch Home.url ├── wizard.bmp ├── elasticsearch Guide.url ├── elasticsearch.ico ├── wizard-small.bmp ├── .gitignore ├── elasticsearch Setup Home.url ├── vendor ├── SetACL-2.2.0 │ ├── SetACL.exe │ └── README.txt ├── verpatch-1.0.10 │ ├── verpatch.exe │ ├── Simple Version Resource Tool for Windows.url │ └── verpatch-ReadMe.txt └── commons-daemon-1.1.0-bin-windows.zip.sha512 ├── elasticsearchw-uninstall.cmd ├── src ├── HasUnlimitedStrength.java ├── setup-helper-console.c └── setup-helper.c ├── elasticsearchw-install.cmd ├── Vagrantfile-locale.ps1 ├── Vagrantfile-GoogleChrome-external_extensions.json ├── elasticsearch-cmd.cmd ├── service-account.pas ├── Vagrantfile-GoogleChrome-master_preferences.json ├── Vagrantfile ├── Vagrantfile-GoogleChrome-master_bookmarks.html ├── Vagrantfile-ConEmu.reg ├── README.md ├── java.pas ├── Vagrantfile-provision-kibana.ps1 ├── elasticsearchw-update.cmd ├── shortcut.pas ├── Makefile ├── service.pas ├── jre.js ├── elasticsearch.iss ├── Vagrantfile-provision.ps1 └── Vagrantfile-ConEmu.xml /elasticsearch Home.url: -------------------------------------------------------------------------------- 1 | [InternetShortcut] 2 | URL=http://www.elasticsearch.org 3 | -------------------------------------------------------------------------------- /wizard.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rgl/elasticsearch-setup/HEAD/wizard.bmp -------------------------------------------------------------------------------- /elasticsearch Guide.url: -------------------------------------------------------------------------------- 1 | [InternetShortcut] 2 | URL=http://www.elasticsearch.org/guide/ 3 | -------------------------------------------------------------------------------- /elasticsearch.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rgl/elasticsearch-setup/HEAD/elasticsearch.ico -------------------------------------------------------------------------------- /wizard-small.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rgl/elasticsearch-setup/HEAD/wizard-small.bmp -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | out/ 2 | vendor/* 3 | *.exe 4 | *.class 5 | *.jar 6 | *.dll 7 | .vagrant/ 8 | .vscode/ 9 | -------------------------------------------------------------------------------- /elasticsearch Setup Home.url: -------------------------------------------------------------------------------- 1 | [InternetShortcut] 2 | URL=https://github.com/rgl/elasticsearch-setup 3 | -------------------------------------------------------------------------------- /vendor/SetACL-2.2.0/SetACL.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rgl/elasticsearch-setup/HEAD/vendor/SetACL-2.2.0/SetACL.exe -------------------------------------------------------------------------------- /vendor/verpatch-1.0.10/verpatch.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rgl/elasticsearch-setup/HEAD/vendor/verpatch-1.0.10/verpatch.exe -------------------------------------------------------------------------------- /vendor/verpatch-1.0.10/Simple Version Resource Tool for Windows.url: -------------------------------------------------------------------------------- 1 | [InternetShortcut] 2 | URL=http://www.codeproject.com/Articles/37133/Simple-Version-Resource-Tool-for-Windows 3 | -------------------------------------------------------------------------------- /vendor/SetACL-2.2.0/README.txt: -------------------------------------------------------------------------------- 1 | Download the complete SetACL program from: 2 | 3 | http://sourceforge.net/projects/setacl/files/ 4 | 5 | More information at: 6 | 7 | http://helgeklein.com/setacl/ 8 | -------------------------------------------------------------------------------- /vendor/commons-daemon-1.1.0-bin-windows.zip.sha512: -------------------------------------------------------------------------------- 1 | 10cda04d9a44286cb67107fdb9d20958013f075cad4accba048801f3677765c334dc16f6901e1d2e4a9df5a2c702797370de63393568df6fceb9e7902421f9ea *commons-daemon-1.1.0-bin-windows.zip 2 | -------------------------------------------------------------------------------- /elasticsearchw-uninstall.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | setlocal 3 | 4 | set SERVICE_NAME=elasticsearch 5 | for %%I in ("%~dp0..") do set ES_HOME=%%~dpfI 6 | set PRUNSRV=%ES_HOME%\bin\%SERVICE_NAME%w 7 | 8 | "%PRUNSRV%" //DS//%SERVICE_NAME% 9 | -------------------------------------------------------------------------------- /src/HasUnlimitedStrength.java: -------------------------------------------------------------------------------- 1 | import javax.crypto.Cipher; 2 | 3 | class HasUnlimitedStrength { 4 | public static void main(String[] args) throws Exception { 5 | int maxKeyLen = Cipher.getMaxAllowedKeyLength("AES"); 6 | System.out.println(maxKeyLen == Integer.MAX_VALUE ? "YES" : "NO"); 7 | } 8 | } -------------------------------------------------------------------------------- /elasticsearchw-install.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | rem NB the installer is not actually using this file. its here 3 | rem just for reference. 4 | setlocal 5 | 6 | set SERVICE_NAME=elasticsearch 7 | for %%I in ("%~dp0..") do set ES_HOME=%%~dpfI 8 | set PRUNSRV=%ES_HOME%\bin\%SERVICE_NAME%w 9 | 10 | "%PRUNSRV%" //IS//%SERVICE_NAME% 11 | -------------------------------------------------------------------------------- /Vagrantfile-locale.ps1: -------------------------------------------------------------------------------- 1 | $ErrorActionPreference = 'Stop' 2 | 3 | # set keyboard layout. 4 | # NB you can get the name from the list: 5 | # [Globalization.CultureInfo]::GetCultures('InstalledWin32Cultures') | Out-GridView 6 | Set-WinUserLanguageList pt-PT -Force 7 | 8 | # set the date format, number format, etc. 9 | Set-Culture pt-PT 10 | 11 | # set the timezone. 12 | # tzutil /l lists all available timezone ids 13 | & $env:windir\system32\tzutil /s "GMT Standard Time" 14 | -------------------------------------------------------------------------------- /Vagrantfile-GoogleChrome-external_extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | // JSON Formatter (https://chrome.google.com/webstore/detail/json-formatter/bcjindcccaagfpapjjmafapmmgkkhgoa). 3 | "bcjindcccaagfpapjjmafapmmgkkhgoa": { 4 | "external_update_url": "https://clients2.google.com/service/update2/crx" 5 | }, 6 | // uBlock Origin (https://chrome.google.com/webstore/detail/ublock-origin/cjpalhdlnbpafiamejdnhcphjbkeiagm). 7 | "cjpalhdlnbpafiamejdnhcphjbkeiagm": { 8 | "external_update_url": "https://clients2.google.com/service/update2/crx" 9 | } 10 | } -------------------------------------------------------------------------------- /elasticsearch-cmd.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | for %%I in ("%~dp0..") do set ES_HOME=%%~dpfI 4 | 5 | set JAVA_HOME=%ES_HOME%\jre 6 | set PATH=%ES_HOME%\bin;%JAVA_HOME%\bin;%PATH% 7 | 8 | TITLE Elasticsearch @@ES_VERSION@@ Command Prompt 9 | 10 | echo From here you can run administrative commands. 11 | echo. 12 | echo Stop the service: 13 | echo. 14 | echo net stop elasticsearch 15 | echo. 16 | echo Start the service: 17 | echo. 18 | echo net start elasticsearch 19 | echo. 20 | echo View installed plugins: 21 | echo. 22 | echo elasticsearch-plugin list 23 | echo. 24 | echo Install a plugin: 25 | echo. 26 | echo elasticsearch-plugin install ingest-attachment 27 | echo. 28 | 29 | cmd /k "cd %ES_HOME%" 30 | -------------------------------------------------------------------------------- /service-account.pas: -------------------------------------------------------------------------------- 1 | // Windows User Management access code by Rui Lopes (ruilopes.com). 2 | // 3 | // NB You MUST use the Unicode Inno Setup to use this unit; the 4 | // NetXXX functions (used by our helper dll) only accept wide 5 | // strings. 6 | // 7 | // NB setup-helper.dll is copied to the app directory because we 8 | // need to use it at uninstall time. 9 | 10 | function ServiceAccountExists(name: string): integer; 11 | external 'ServiceAccountExists@files:setup-helper.dll stdcall'; 12 | 13 | function CreateServiceAccount(name, password, comment: string): integer; 14 | external 'CreateServiceAccount@files:setup-helper.dll stdcall'; 15 | 16 | function DestroyServiceAccount(name: string): integer; 17 | external 'DestroyServiceAccount@{app}\setup-helper.dll stdcall uninstallonly'; 18 | -------------------------------------------------------------------------------- /Vagrantfile-GoogleChrome-master_preferences.json: -------------------------------------------------------------------------------- 1 | { 2 | "session": { 3 | "restore_on_startup": 1 4 | }, 5 | "bookmark_bar": { 6 | "show_on_all_tabs": true 7 | }, 8 | "sync_promo": { 9 | "show_on_first_run_allowed": false 10 | }, 11 | "distribution": { 12 | "import_bookmarks_from_file": "C:\\Program Files (x86)\\Google\\Chrome\\Application\\master_bookmarks.html", 13 | "import_bookmarks": true, 14 | "import_history": true, 15 | "import_home_page": true, 16 | "import_search_engine": true, 17 | "suppress_first_run_bubble": true, 18 | "do_not_create_desktop_shortcut": true, 19 | "do_not_create_quick_launch_shortcut": false, 20 | "do_not_launch_chrome": true, 21 | "do_not_register_for_update_launch": true, 22 | "make_chrome_default": true, 23 | "make_chrome_default_for_user": true, 24 | "suppress_first_run_default_browser_prompt": false, 25 | "system_level": true, 26 | "verbose_logging": true 27 | }, 28 | "first_run_tabs": [ 29 | "chrome://extensions", 30 | "chrome://version", 31 | "https://github.com/rgl", 32 | "https://ruilopes.com" 33 | ] 34 | } -------------------------------------------------------------------------------- /Vagrantfile: -------------------------------------------------------------------------------- 1 | Vagrant.configure(2) do |config| 2 | config.vm.box = "windows-2016-amd64" # see https://github.com/rgl/windows-2016-vagrant 3 | 4 | config.vm.provider "libvirt" do |lv, config| 5 | lv.memory = 4096 6 | lv.cpus = 2 7 | lv.cpu_mode = "host-passthrough" 8 | # lv.nested = true 9 | lv.keymap = "pt" 10 | config.vm.synced_folder ".", "/vagrant", type: "smb", smb_username: ENV["USER"], smb_password: ENV["VAGRANT_SMB_PASSWORD"] 11 | end 12 | 13 | config.vm.provider "virtualbox" do |vb| 14 | vb.linked_clone = true 15 | vb.memory = 4096 16 | vb.cpus = 2 17 | vb.customize ["modifyvm", :id, "--vram", 64] 18 | vb.customize ["modifyvm", :id, "--clipboard", "bidirectional"] 19 | vb.customize ["modifyvm", :id, "--draganddrop", "bidirectional"] 20 | end 21 | 22 | config.vm.provision "shell", inline: "$env:chocolateyVersion='0.10.11'; iwr https://chocolatey.org/install.ps1 -UseBasicParsing | iex", name: "Install Chocolatey" 23 | config.vm.provision "shell", path: "Vagrantfile-locale.ps1" 24 | config.vm.provision "shell", path: "Vagrantfile-provision.ps1" 25 | config.vm.provision "shell", path: "Vagrantfile-provision-kibana.ps1" 26 | end -------------------------------------------------------------------------------- /Vagrantfile-GoogleChrome-master_bookmarks.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Bookmarks 4 |

Bookmarks

5 |

6 |

Bookmarks bar

7 |

8 |

Channel 9: Videos for developers from the people building Microsoft Products & Services 9 |

10 |

11 | -------------------------------------------------------------------------------- /Vagrantfile-ConEmu.reg: -------------------------------------------------------------------------------- 1 | Windows Registry Editor Version 5.00 2 | 3 | [HKEY_CLASSES_ROOT\*\shell\ConEmu Here] 4 | "Icon"="C:\\Program Files\\ConEmu\\ConEmu64.exe,0" 5 | [HKEY_CLASSES_ROOT\*\shell\ConEmu Here\command] 6 | @="\"C:\\Program Files\\ConEmu\\ConEmu64.exe\" -here -run {MSYS2} -cur_console:n" 7 | 8 | [HKEY_CLASSES_ROOT\directory\background\shell\ConEmu Here] 9 | "Icon"="C:\\Program Files\\ConEmu\\ConEmu64.exe,0" 10 | [HKEY_CLASSES_ROOT\directory\background\shell\ConEmu Here\command] 11 | @="\"C:\\Program Files\\ConEmu\\ConEmu64.exe\" -here -run {MSYS2} -cur_console:n" 12 | 13 | [HKEY_CLASSES_ROOT\directory\shell\ConEmu Here] 14 | "Icon"="C:\\Program Files\\ConEmu\\ConEmu64.exe,0" 15 | [HKEY_CLASSES_ROOT\directory\shell\ConEmu Here\command] 16 | @="\"C:\\Program Files\\ConEmu\\ConEmu64.exe\" -here -dir \"%1\" -run {MSYS2} -cur_console:n" 17 | 18 | [HKEY_CLASSES_ROOT\Drive\shell\ConEmu Here] 19 | "Icon"="C:\\Program Files\\ConEmu\\ConEmu64.exe,0" 20 | [HKEY_CLASSES_ROOT\Drive\shell\ConEmu Here\command] 21 | @="\"C:\\Program Files\\ConEmu\\ConEmu64.exe\" -here -dir \"%1\" -run {MSYS2} -cur_console:n" 22 | 23 | [HKEY_CLASSES_ROOT\LibraryFolder\Background\shell\ConEmu Here] 24 | "Icon"="C:\\Program Files\\ConEmu\\ConEmu64.exe,0" 25 | [HKEY_CLASSES_ROOT\LibraryFolder\Background\shell\ConEmu Here\command] 26 | @="\"C:\\Program Files\\ConEmu\\ConEmu64.exe\" -here -run {MSYS2} -cur_console:n" 27 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Elasticsearch Setup 2 | 3 | This is a setup application for installing [Elasticsearch (OSS flavor)](https://www.elastic.co/products/elasticsearch) 4 | on a Windows machine. 5 | 6 | The setup will: 7 | 8 | * install all files into `Program Files` (the user can change the 9 | actual location) 10 | 11 | * create the `elasticsearch` Windows account (with 12 | `Logon as service privilege`) 13 | 14 | * install a Windows Service to automatically start `elasticsearch` 15 | (run as the `elasticsearch` account) at boot (but has to be manually 16 | started after install...). 17 | 18 | * grant the `elasticsearch` account: 19 | * read permissions to the `config` directory. 20 | * full permissions to the `config/elasticsearch.keystore` file. 21 | * full permissions to the `data` and `logs` directories. 22 | 23 | * create a bunch of Start Menu entries (link to home page, guide, etc). 24 | 25 | 26 | If you need to modify any service related setting (e.g. the maximum 27 | memory used by the JVM) edit the file: 28 | 29 | lib\elasticsearchw-update.cmd 30 | 31 | And then run it in a Administrator Command Prompt. 32 | 33 | ## Silent installation 34 | 35 | You can do a silent install with the `/VERYSILENT /SUPPRESSMSGBOXES` command 36 | line arguments. For more information see the `install elasticsearch` section 37 | inside the [Vagrantfile-provision.ps1](Vagrantfile-provision.ps1) file. 38 | 39 | # Development 40 | 41 | The setup is created inside a Vagrant environment. To create the 42 | environment install: 43 | 44 | * [Vagrant](https://www.vagrantup.com/) 45 | * [VirtualBox](https://www.virtualbox.org/) 46 | * [Windows Base Box](https://github.com/rgl/windows-2016-vagrant) 47 | 48 | Then run `vagrant up`. The setup executable should appear on the 49 | same directory as this README file. 50 | -------------------------------------------------------------------------------- /java.pas: -------------------------------------------------------------------------------- 1 | // The bulk of this code came from: 2 | // http://stackoverflow.com/questions/1297773/check-java-is-present-before-installing 3 | 4 | // function RequireJava(MinimalVersion: string): Boolean; 5 | 6 | // Both DecodeVersion and CompareVersion functions where taken from the inno setup wiki 7 | procedure DecodeVersion(verstr: String; var verint: array of Integer); 8 | var 9 | i,p: Integer; s: string; 10 | begin 11 | // initialize array 12 | verint := [0,0,0,0]; 13 | i := 0; 14 | while ((Length(verstr) > 0) and (i < 4)) do 15 | begin 16 | p := pos ('.', verstr); 17 | if p > 0 then 18 | begin 19 | if p = 1 then s:= '0' else s:= Copy (verstr, 1, p - 1); 20 | verint[i] := StrToInt(s); 21 | i := i + 1; 22 | verstr := Copy (verstr, p+1, Length(verstr)); 23 | end 24 | else 25 | begin 26 | verint[i] := StrToInt (verstr); 27 | verstr := ''; 28 | end; 29 | end; 30 | end; 31 | 32 | function CompareVersion(ver1, ver2: String): Integer; 33 | var 34 | verint1, verint2: array of Integer; 35 | i: integer; 36 | begin 37 | SetArrayLength (verint1, 4); 38 | DecodeVersion (ver1, verint1); 39 | 40 | SetArrayLength (verint2, 4); 41 | DecodeVersion (ver2, verint2); 42 | 43 | Result := 0; i := 0; 44 | while ((Result = 0) and ( i < 4 )) do 45 | begin 46 | if verint1[i] > verint2[i] then 47 | Result := 1 48 | else 49 | if verint1[i] < verint2[i] then 50 | Result := -1 51 | else 52 | Result := 0; 53 | i := i + 1; 54 | end; 55 | end; 56 | 57 | function RequireJava(MinimalVersion: string): Boolean; 58 | var 59 | ErrorCode: Integer; 60 | JavaVersion: String; 61 | begin 62 | RegQueryStringValue(HKLM, 'SOFTWARE\JavaSoft\Java Runtime Environment', 'CurrentVersion', JavaVersion); 63 | 64 | if Length(JavaVersion) > 0 then 65 | begin 66 | if CompareVersion(JavaVersion, MinimalVersion) >= 0 then 67 | begin 68 | Result := true; 69 | Exit; 70 | end; 71 | end; 72 | 73 | if MsgBox('This tool requires Java Runtime Environment (JRE) ' + MinimalVersion + ' or newer to run. Please download and install JRE and run this setup again.' + #13#10#13#10 + 'Do you want to open the download page now?', mbConfirmation, MB_YESNO) = idYes then 74 | begin 75 | ShellExec('open', 'http://www.oracle.com/technetwork/java/javase/downloads/', '', '', SW_SHOWNORMAL, ewNoWait, ErrorCode); 76 | end; 77 | 78 | Result := false; 79 | end; 80 | -------------------------------------------------------------------------------- /src/setup-helper-console.c: -------------------------------------------------------------------------------- 1 | /* Windows Setup Helper functions. 2 | * 3 | * Copyright (c) 2011, Rui Lopes (ruilopes.com) 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * 9 | * * Redistributions of source code must retain the above copyright notice, 10 | * this list of conditions and the following disclaimer. 11 | * * Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * * Neither the name of Redis nor the names of its contributors may be used 15 | * to endorse or promote products derived from this software without 16 | * specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | * POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #include "setup-helper.c" 32 | #include 33 | 34 | #define SERVICE_ACCOUNT_NAME L"elasticsearch" 35 | #define SERVICE_ACCOUNT_PASSWORD L"B0d_Pa$$w0rd!*" 36 | #define SERVICE_ACCOUNT_DESCRIPTION L"elasticsearch service" 37 | 38 | 39 | static void show_help() { 40 | printf("available commands:\n\n"); 41 | printf("create-account\n"); 42 | printf(" create the `elasticsearch' account and assign the `log on as a service right'.\n"); 43 | printf("\n"); 44 | printf("destroy-account\n"); 45 | printf(" destroy the `elasticsearch' account, respective rights and profile.\n"); 46 | } 47 | 48 | 49 | static int create_account() { 50 | int error = ServiceAccountExists(SERVICE_ACCOUNT_NAME); 51 | 52 | if (!error) { 53 | printf("ERROR did not create the account because it already exists.\n"); 54 | return -1; 55 | } 56 | 57 | int result = CreateServiceAccount(SERVICE_ACCOUNT_NAME, SERVICE_ACCOUNT_PASSWORD, SERVICE_ACCOUNT_DESCRIPTION); 58 | 59 | if (result != 0) { 60 | printf("ERROR failed to create account with result=%d\n", result); 61 | return -1; 62 | } 63 | 64 | printf("DONE.\n"); 65 | return 0; 66 | } 67 | 68 | 69 | static int delete_account() { 70 | int error = ServiceAccountExists(SERVICE_ACCOUNT_NAME); 71 | 72 | if (error) { 73 | printf("WARN did not destroy the account because it does not exists.\n"); 74 | return -1; 75 | } 76 | 77 | int result = DestroyServiceAccount(SERVICE_ACCOUNT_NAME); 78 | 79 | if (result != 0) { 80 | printf("ERROR failed to remove account with result=%d\n", result); 81 | return -1; 82 | } 83 | 84 | printf("DONE.\n"); 85 | return 0; 86 | } 87 | 88 | 89 | int main(int argc, char *argv[]) { 90 | if (argc == 2 && strcmp(argv[1], "create-account") == 0) { 91 | return create_account(); 92 | } 93 | 94 | if (argc == 2 && strcmp(argv[1], "destroy-account") == 0) { 95 | return delete_account(); 96 | } 97 | 98 | show_help(); 99 | return -1; 100 | } 101 | -------------------------------------------------------------------------------- /Vagrantfile-provision-kibana.ps1: -------------------------------------------------------------------------------- 1 | Set-StrictMode -Version Latest 2 | $ProgressPreference = 'SilentlyContinue' 3 | $ErrorActionPreference = 'Stop' 4 | trap { 5 | Write-Output "ERROR: $_" 6 | Write-Output (($_.ScriptStackTrace -split '\r?\n') -replace '^(.*)$','ERROR: $1') 7 | Write-Output (($_.Exception.ToString() -split '\r?\n') -replace '^(.*)$','ERROR EXCEPTION: $1') 8 | Exit 1 9 | } 10 | 11 | # wrap the choco command (to make sure this script aborts when it fails). 12 | function Start-Choco([string[]]$Arguments, [int[]]$SuccessExitCodes=@(0)) { 13 | $command, $commandArguments = $Arguments 14 | if ($command -eq 'install') { 15 | $Arguments = @($command, '--no-progress') + $commandArguments 16 | } 17 | for ($n = 0; $n -lt 10; ++$n) { 18 | if ($n) { 19 | # NB sometimes choco fails with "The package was not found with the source(s) listed." 20 | # but normally its just really a transient "network" error. 21 | Write-Host "Retrying choco install..." 22 | Start-Sleep -Seconds 3 23 | } 24 | &C:\ProgramData\chocolatey\bin\choco.exe @Arguments 25 | if ($SuccessExitCodes -Contains $LASTEXITCODE) { 26 | return 27 | } 28 | } 29 | throw "$(@('choco')+$Arguments | ConvertTo-Json -Compress) failed with exit code $LASTEXITCODE" 30 | } 31 | function choco { 32 | Start-Choco $Args 33 | } 34 | 35 | Import-Module C:\ProgramData\chocolatey\helpers\chocolateyInstaller.psm1 36 | 37 | Write-Output "Installing Kibana..." 38 | Push-Location $env:TEMP 39 | $p = Start-Process git clone,https://github.com/rgl/kibana-chocolatey-package -PassThru -Wait 40 | if ($p.ExitCode) { 41 | throw "git failed with exit code $($p.ExitCode)" 42 | } 43 | cd kibana-chocolatey-package 44 | choco pack 45 | choco install -y nssm 46 | choco install -y kibana -Source $PWD 47 | Pop-Location 48 | 49 | $kibanaHome = "$env:ChocolateyInstall\lib\kibana\kibana" 50 | $serviceName = 'kibana' 51 | $serviceUsername = "NT SERVICE\$serviceName" 52 | Write-Output "Modifying the $serviceName service to use the $serviceUsername managed service account instead of LocalSystem..." 53 | $result = sc.exe sidtype $serviceName unrestricted 54 | if ($result -ne '[SC] ChangeServiceConfig2 SUCCESS') { 55 | throw "sc.exe sidtype failed with $result" 56 | } 57 | $result = sc.exe config $serviceName obj= $serviceUsername 58 | if ($result -ne '[SC] ChangeServiceConfig SUCCESS') { 59 | throw "sc.exe config failed with $result" 60 | } 61 | $result = sc.exe failure $serviceName reset= 0 actions= restart/60000 62 | if ($result -ne '[SC] ChangeServiceConfig2 SUCCESS') { 63 | throw "sc.exe failure failed with $result" 64 | } 65 | $result = sc.exe config $serviceName start= auto 66 | if ($result -ne '[SC] ChangeServiceConfig SUCCESS') { 67 | throw "sc.exe config failed with $result" 68 | } 69 | 70 | Write-Output "Modifying the $serviceName service to write the kibana output into a log file..." 71 | nssm set $serviceName AppRotateFiles 1 72 | nssm set $serviceName AppRotateOnline 1 73 | nssm set $serviceName AppRotateSeconds 86400 74 | nssm set $serviceName AppRotateBytes (10*1024*1024) 75 | nssm set $serviceName AppStdout $kibanaHome\logs\service-stdout.log 76 | nssm set $serviceName AppStderr $kibanaHome\logs\service-stderr.log 77 | 78 | choco install -y carbon 79 | Update-SessionEnvironment 80 | 81 | Write-Output "Granting write permissions to selected directories...." 82 | @('optimize', 'data', 'logs') | ForEach-Object { 83 | $path = "$kibanaHome\$_" 84 | mkdir -Force $path | Out-Null 85 | Disable-AclInheritance $path 86 | 'Administrators',$serviceUsername | ForEach-Object { 87 | Write-Host "Granting $_ FullControl to $path..." 88 | Grant-Permission ` 89 | -Identity $_ ` 90 | -Permission FullControl ` 91 | -Path $path 92 | } 93 | } 94 | 95 | Write-Output "Starting the $serviceName service..." 96 | Start-Service $serviceName 97 | 98 | # add Local Kibana shortcut to the Desktop. 99 | [IO.File]::WriteAllText( 100 | "$env:USERPROFILE\Desktop\Kibana.url", 101 | @" 102 | [InternetShortcut] 103 | URL=http://localhost:5601 104 | "@) 105 | -------------------------------------------------------------------------------- /elasticsearchw-update.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | setlocal 3 | 4 | set SERVICE_NAME=elasticsearch 5 | set ES_VERSION=@@ES_VERSION@@ 6 | set ES_BITS=@@ES_BITS@@ 7 | for %%I in ("%~dp0..") do set ES_HOME=%%~dpfI 8 | set ES_LIB=%ES_HOME%\lib 9 | set PRUNSRV=%ES_HOME%\bin\%SERVICE_NAME%w 10 | 11 | rem Initial memory pool size in MB. 12 | set JVM_MS=1024 13 | rem Maximum memory pool size in MB. 14 | set JVM_MX=1024 15 | 16 | rem Other options. 17 | rem NB the pound (#) and semicolon (;) are separator characters. 18 | 19 | rem Force the JVM to use IPv4 stack 20 | rem JVM_OPTIONS=%JVM_OPTIONS% -Djava.net.preferIPv4Stack=true 21 | 22 | rem GC configuration. 23 | set JVM_OPTIONS=%JVM_OPTIONS% -XX:+UseConcMarkSweepGC 24 | set JVM_OPTIONS=%JVM_OPTIONS% -XX:CMSInitiatingOccupancyFraction=75 25 | set JVM_OPTIONS=%JVM_OPTIONS% -XX:+UseCMSInitiatingOccupancyOnly 26 | 27 | rem Pre-touch memory pages used by the JVM during initialization. 28 | set JVM_OPTIONS=%JVM_OPTIONS% -XX:+AlwaysPreTouch 29 | 30 | REM GC logging options -- uncomment to enable 31 | REM JVM_OPTIONS=%JVM_OPTIONS% -XX:+PrintGCDetails 32 | REM JVM_OPTIONS=%JVM_OPTIONS% -XX:+PrintGCTimeStamps 33 | REM JVM_OPTIONS=%JVM_OPTIONS% -XX:+PrintGCDateStamps 34 | REM JVM_OPTIONS=%JVM_OPTIONS% -XX:+PrintClassHistogram 35 | REM JVM_OPTIONS=%JVM_OPTIONS% -XX:+PrintTenuringDistribution 36 | REM JVM_OPTIONS=%JVM_OPTIONS% -XX:+PrintGCApplicationStoppedTime 37 | REM JVM_OPTIONS=%JVM_OPTIONS% -Xloggc:%ES_HOME%/logs/gc.log 38 | 39 | REM By default, the GC log file will not rotate. 40 | REM By uncommenting the lines below, the GC log file 41 | REM will be rotated every 128MB at most 32 times. 42 | REM -XX:+UseGCLogFileRotation 43 | REM -XX:NumberOfGCLogFiles=32 44 | REM -XX:GCLogFileSize=128M 45 | 46 | REM Causes the JVM to dump its heap on OutOfMemory. 47 | set JVM_OPTIONS=%JVM_OPTIONS% -XX:+HeapDumpOnOutOfMemoryError 48 | REM The path to the heap dump location, note directory must exists and have enough 49 | REM space for a full heap dump. 50 | REM JVM_OPTIONS=%JVM_OPTIONS% -XX:HeapDumpPath=$ES_HOME/logs/heapdump.hprof 51 | 52 | REM Ensure UTF-8 encoding by default (e.g. filenames) 53 | set JVM_OPTIONS=%JVM_OPTIONS% -Dfile.encoding=UTF-8 54 | 55 | REM Use our provided JNA always versus the system one 56 | set JVM_OPTIONS=%JVM_OPTIONS% -Djna.nosys=true 57 | 58 | REM turn off a JDK optimization that throws away stack traces for common 59 | REM exceptions because stack traces are important for debugging 60 | set JVM_OPTIONS=%JVM_OPTIONS% -XX:-OmitStackTraceInFastThrow 61 | 62 | REM use old-style file permissions on JDK9 63 | set JVM_OPTIONS=%JVM_OPTIONS% -Djdk.io.permissionsUseCanonicalPath=true 64 | 65 | REM Flags to configure Netty 66 | set JVM_OPTIONS=%JVM_OPTIONS% -Dio.netty.noUnsafe=true 67 | set JVM_OPTIONS=%JVM_OPTIONS% -Dio.netty.noKeySetOptimization=true 68 | set JVM_OPTIONS=%JVM_OPTIONS% -Dio.netty.recycler.maxCapacityPerThread=0 69 | 70 | REM log4j 2 71 | set JVM_OPTIONS=%JVM_OPTIONS% -Dlog4j.shutdownHookEnabled=false 72 | set JVM_OPTIONS=%JVM_OPTIONS% -Dlog4j2.disable.jmx=true 73 | 74 | set JVM_CLASSPATH=%ES_LIB%\* 75 | 76 | set JVM=auto 77 | if exist "%ES_HOME%\jre\bin\server\jvm.dll" set JVM=%ES_HOME%\jre\bin\server\jvm.dll 78 | if exist "%ES_HOME%\jre\bin\client\jvm.dll" set JVM=%ES_HOME%\jre\bin\client\jvm.dll 79 | 80 | "%PRUNSRV%" //US//%SERVICE_NAME% ^ 81 | --Jvm "%JVM%" ^ 82 | --DisplayName "Elasticsearch v%ES_VERSION% (%ES_BITS%-bit)" ^ 83 | --StdOutput auto ^ 84 | --StdError auto ^ 85 | --LogPath "%ES_HOME%\logs" ^ 86 | --StartPath "%ES_HOME%" ^ 87 | --StartMode jvm ^ 88 | --StartClass org.elasticsearch.bootstrap.Elasticsearch ^ 89 | --StartMethod main ^ 90 | --StartParams --quiet ^ 91 | --StopMode jvm ^ 92 | --StopClass org.elasticsearch.bootstrap.Elasticsearch ^ 93 | --StopMethod close ^ 94 | --Classpath "%JVM_CLASSPATH%" ^ 95 | --JvmMs %JVM_MS% ^ 96 | --JvmMx %JVM_MX% ^ 97 | %JVM_OPTIONS: = ++JvmOptions % ^ 98 | ++JvmOptions "-Des.path.home=%ES_HOME%" ^ 99 | ++JvmOptions "-Des.path.conf=%ES_HOME%\config" ^ 100 | ++JvmOptions "-Des.distribution.flavor=oss" ^ 101 | ++JvmOptions "-Des.distribution.type=zip" 102 | 103 | rem These settings are saved in the Windows Registry at: 104 | rem 105 | rem HKEY_LOCAL_MACHINE\SOFTWARE\Apache Software Foundation\Procrun 2.0\elasticsearch 106 | rem 107 | rem OR, on windows 64-bit procrun always uses the 32-bit registry at: 108 | rem 109 | rem HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Apache Software Foundation\Procrun 2.0\elasticsearch 110 | rem 111 | rem See http://commons.apache.org/daemon/procrun.html 112 | -------------------------------------------------------------------------------- /shortcut.pas: -------------------------------------------------------------------------------- 1 | // IShellLink descriptions code came from https://github.com/jrsoftware/issrc/blob/master/Examples/CodeAutomation2.iss 2 | 3 | // procedure CreateShortcut(AtPath: string; ToPath: string; RunAsAdministrator: boolean); 4 | 5 | const 6 | CLSID_ShellLink = '{00021401-0000-0000-C000-000000000046}'; 7 | 8 | const 9 | // IShellLinkDataList::GetFlags()/SetFlags() 10 | SLDF_HAS_ID_LIST = $00000001; // Shell link saved with ID list 11 | SLDF_HAS_LINK_INFO = $00000002; // Shell link saved with LinkInfo 12 | SLDF_HAS_NAME = $00000004; 13 | SLDF_HAS_RELPATH = $00000008; 14 | SLDF_HAS_WORKINGDIR = $00000010; 15 | SLDF_HAS_ARGS = $00000020; 16 | SLDF_HAS_ICONLOCATION = $00000040; 17 | SLDF_UNICODE = $00000080; // the strings are unicode 18 | SLDF_FORCE_NO_LINKINFO = $00000100; // don't create a LINKINFO (make a dumb link) 19 | SLDF_HAS_EXP_SZ = $00000200; // the link contains expandable env strings 20 | SLDF_RUN_IN_SEPARATE = $00000400; // Run the 16-bit target exe in a separate VDM/WOW 21 | SLDF_HAS_LOGO3ID = $00000800; // this link is a special Logo3/MSICD link 22 | SLDF_HAS_DARWINID = $00001000; // this link is a special Darwin link 23 | SLDF_RUNAS_USER = $00002000; // Run this link as a different user 24 | SLDF_HAS_EXP_ICON_SZ = $00004000; // contains expandable env string for icon path 25 | SLDF_NO_PIDL_ALIAS = $00008000; // don't ever resolve to a logical location 26 | SLDF_FORCE_UNCNAME = $00010000; // make GetPath() prefer the UNC name to the local name 27 | SLDF_RUN_WITH_SHIMLAYER = $00020000; // Launch the target of this link w/ shim layer active 28 | SLDF_RESERVED = $80000000; // Reserved-- so we can use the low word as an index value in the future 29 | 30 | type 31 | IShellLinkW = interface(IUnknown) 32 | '{000214F9-0000-0000-C000-000000000046}' 33 | procedure Dummy; 34 | procedure Dummy2; 35 | procedure Dummy3; 36 | function GetDescription(pszName: String; cchMaxName: Integer): HResult; 37 | function SetDescription(pszName: String): HResult; 38 | function GetWorkingDirectory(pszDir: String; cchMaxPath: Integer): HResult; 39 | function SetWorkingDirectory(pszDir: String): HResult; 40 | function GetArguments(pszArgs: String; cchMaxPath: Integer): HResult; 41 | function SetArguments(pszArgs: String): HResult; 42 | function GetHotkey(var pwHotkey: Word): HResult; 43 | function SetHotkey(wHotkey: Word): HResult; 44 | function GetShowCmd(out piShowCmd: Integer): HResult; 45 | function SetShowCmd(iShowCmd: Integer): HResult; 46 | function GetIconLocation(pszIconPath: String; cchIconPath: Integer; out piIcon: Integer): HResult; 47 | function SetIconLocation(pszIconPath: String; iIcon: Integer): HResult; 48 | function SetRelativePath(pszPathRel: String; dwReserved: DWORD): HResult; 49 | function Resolve(Wnd: HWND; fFlags: DWORD): HResult; 50 | function SetPath(pszFile: String): HResult; 51 | end; 52 | 53 | IShellLinkDataList = interface(IUnknown) 54 | '{45E2B4AE-B1C3-11D0-B92F-00A0C90312E1}' 55 | function AddDataBlock(pDataBlock: cardinal): HResult; 56 | function CopyDataBlock(dwSig: DWORD; var ppDataBlock: cardinal): HResult; 57 | function RemoveDataBlock(dwSig: DWORD): HResult; 58 | function GetFlags(var pdwFlags: DWORD): HResult; 59 | function SetFlags(dwFlags: DWORD): HResult; 60 | end; 61 | 62 | IPersist = interface(IUnknown) 63 | '{0000010C-0000-0000-C000-000000000046}' 64 | function GetClassID(var classID: TGUID): HResult; 65 | end; 66 | 67 | IPersistFile = interface(IPersist) 68 | '{0000010B-0000-0000-C000-000000000046}' 69 | function IsDirty: HResult; 70 | function Load(pszFileName: String; dwMode: Longint): HResult; 71 | function Save(pszFileName: String; fRemember: BOOL): HResult; 72 | function SaveCompleted(pszFileName: String): HResult; 73 | function GetCurFile(out pszFileName: String): HResult; 74 | end; 75 | 76 | procedure CreateShortcut(AtPath, ToPath, IconPath, WorkingDirectoryPath: string; RunAsAdministrator: boolean); 77 | var 78 | Obj: IUnknown; 79 | SL: IShellLinkW; 80 | PF: IPersistFile; 81 | DL: IShellLinkDataList; 82 | Flags: DWORD; 83 | begin 84 | Obj := CreateComObject(StringToGuid(CLSID_ShellLink)); 85 | 86 | SL := IShellLinkW(Obj); 87 | OleCheck(SL.SetPath(ToPath)); 88 | OleCheck(SL.SetWorkingDirectory(WorkingDirectoryPath)); 89 | OleCheck(Sl.SetIconLocation(IconPath, 0)); 90 | 91 | if RunAsAdministrator then 92 | begin 93 | DL := IShellLinkDataList(Obj); 94 | OleCheck(DL.GetFlags(Flags)); 95 | OleCheck(Dl.SetFlags(Flags or SLDF_RUNAS_USER)); 96 | end; 97 | 98 | PF := IPersistFile(Obj); 99 | OleCheck(PF.Save(AtPath, True)); 100 | end; 101 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | X64?= false 2 | 3 | ES_FILE_VERSION=6.3.2 4 | ES_VERSION=$(ES_FILE_VERSION) 5 | ES_SHA512=032e5740ee060b4985323f62dbf0aabfe66feb5792cfea55533cfa7fb4e39860231a5977cc809a690336a12daef499d11ab791cb9a8a7319778f9d44d5128b4a 6 | ES_NAME=elasticsearch-$(ES_VERSION) 7 | ES_HOME=vendor/$(ES_NAME) 8 | ES_LIB=$(ES_HOME)/lib 9 | ES_JAR=$(ES_LIB)/$(ES_NAME).jar 10 | ifeq ($(X64),false) 11 | ES_BITS=32 12 | else 13 | ES_BITS=64 14 | endif 15 | 16 | JRE_HOME=vendor/jre-$(ES_BITS)/jre 17 | JRE=$(JRE_HOME)/bin/java.exe 18 | 19 | COMMONS_DAEMON_VERSION=1.1.0 20 | COMMONS_DAEMON_NAME=commons-daemon-$(COMMONS_DAEMON_VERSION)-bin-windows 21 | COMMONS_DAEMON_HOME=vendor/$(COMMONS_DAEMON_NAME) 22 | ifeq ($(X64),false) 23 | COMMONS_DAEMON_PRUNSRV=$(COMMONS_DAEMON_HOME)/prunsrv.exe 24 | else 25 | COMMONS_DAEMON_PRUNSRV=$(COMMONS_DAEMON_HOME)/amd64/prunsrv.exe 26 | endif 27 | 28 | ES_SERVICE_EXE=$(ES_HOME)/bin/elasticsearchw-$(ES_BITS).exe 29 | 30 | ES_SERVICE_UPDATE_CMD_SRC=elasticsearchw-update.cmd 31 | ES_SERVICE_UPDATE_CMD=$(ES_HOME)/lib/elasticsearchw-update-$(ES_BITS).cmd 32 | 33 | ES_CMD_CMD_SRC=elasticsearch-cmd.cmd 34 | ES_CMD_CMD=$(ES_HOME)/lib/elasticsearch-cmd.cmd 35 | 36 | SETEXECUTABLEICON_EXE=vendor/SetExecutableIcon.exe 37 | 38 | ISCC?= '/c/Program Files (x86)/Inno Setup 5/ISCC.exe' 39 | 40 | ifneq ($(X64),false) 41 | ISCCOPT+= -d_WIN64 42 | endif 43 | 44 | all: 64bit 45 | 46 | 32bit: 47 | @X64=false $(MAKE) setup 48 | 49 | 64bit: 50 | @X64=true $(MAKE) setup 51 | 52 | setup-helper.dll: src/setup-helper.c 53 | gcc -o $@ -shared -std=gnu99 -pedantic -Os -Wall -m32 -Wl,--kill-at $< -lnetapi32 -ladvapi32 -luserenv 54 | strip $@ 55 | 56 | HasUnlimitedStrength.class: src/HasUnlimitedStrength.java 57 | javac -d . $< 58 | 59 | # NB when you run this outside an Administrator console, UAC will trigger 60 | # because this executable has the word "setup" in its name. 61 | setup-helper-console.exe: src/setup-helper-console.c src/setup-helper.c 62 | gcc -o $@ -std=gnu99 -pedantic -Os -Wall -m32 src/setup-helper-console.c -lnetapi32 -ladvapi32 -luserenv 63 | strip $@ 64 | 65 | setup: setup-helper.dll vendor $(ES_CMD_CMD) $(ES_SERVICE_UPDATE_CMD) $(ES_SERVICE_EXE) 66 | $(ISCC) elasticsearch.iss $(ISCCOPT) -dAppVersion=$(ES_VERSION) -dVersionInfoVersion=$(ES_FILE_VERSION) 67 | 68 | vendor: $(ES_JAR) $(COMMONS_DAEMON_PRUNSRV) $(JRE) 69 | 70 | $(ES_CMD_CMD): $(ES_CMD_CMD_SRC) 71 | sed -e "s,@@ES_VERSION@@,$(ES_VERSION),g" \ 72 | $(ES_CMD_CMD_SRC) > $(ES_CMD_CMD) 73 | 74 | $(ES_SERVICE_UPDATE_CMD): $(ES_SERVICE_UPDATE_CMD_SRC) 75 | sed -e "s,@@ES_BITS@@,$(ES_BITS),g" \ 76 | -e "s,@@ES_VERSION@@,$(ES_VERSION),g" \ 77 | $(ES_SERVICE_UPDATE_CMD_SRC) > $(ES_SERVICE_UPDATE_CMD) 78 | 79 | $(ES_SERVICE_EXE): $(COMMONS_DAEMON_PRUNSRV) $(SETEXECUTABLEICON_EXE) 80 | cp $(COMMONS_DAEMON_PRUNSRV) $(ES_SERVICE_EXE).tmp 81 | vendor/verpatch-1.0.10/verpatch $(ES_SERVICE_EXE).tmp $(ES_VERSION) //fn //high //s description "Elasticsearch v$(ES_VERSION) ($(ES_BITS)-bit)" 82 | $(SETEXECUTABLEICON_EXE) elasticsearch.ico $(ES_SERVICE_EXE).tmp 83 | mv $(ES_SERVICE_EXE).tmp $(ES_SERVICE_EXE) 84 | 85 | $(ES_JAR): 86 | wget -qO $(ES_HOME).zip https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-oss-$(ES_VERSION).zip 87 | [ `openssl sha512 $(ES_HOME).zip | awk '{print $$2}'` == $(ES_SHA512) ] 88 | rm -rf vendor-tmp && mkdir vendor-tmp 89 | unzip -q -d vendor-tmp $(ES_HOME).zip 90 | for batch in vendor-tmp/elasticsearch-*/bin/elasticsearch-*.bat; do \ 91 | sed -i -E 's,(@echo off),\1\n\nfor %%I in ("%~dp0..") do set JAVA_HOME=%%~dpfI\\jre,' "$$batch"; \ 92 | unix2dos "$$batch"; \ 93 | done 94 | mv vendor-tmp/elasticsearch-* vendor 95 | rmdir vendor-tmp 96 | 97 | $(COMMONS_DAEMON_PRUNSRV): 98 | wget -qO $(COMMONS_DAEMON_HOME).zip http://apache.org/dist/commons/daemon/binaries/windows/$(COMMONS_DAEMON_NAME).zip 99 | (cd vendor && sha512sum -c $(COMMONS_DAEMON_NAME).zip.sha512) 100 | unzip -q -d $(COMMONS_DAEMON_HOME) $(COMMONS_DAEMON_HOME).zip 101 | 102 | $(SETEXECUTABLEICON_EXE): 103 | wget -qO $@ https://github.com/rgl/SetExecutableIcon/releases/download/v0.0.1/SetExecutableIcon.exe 104 | 105 | $(JRE): HasUnlimitedStrength.class 106 | rm -rf vendor/jre-64 107 | mkdir vendor/jre-64 108 | curl \ 109 | --silent \ 110 | --insecure \ 111 | -L \ 112 | -b oraclelicense=accept-securebackup-cookie \ 113 | -o vendor/jre-64/server-jre-8u181-windows-x64.tar.gz \ 114 | http://download.oracle.com/otn-pub/java/jdk/8u181-b13/96a7b8442fe848ef90c96a2fad6ed6d1/server-jre-8u181-windows-x64.tar.gz 115 | [ `openssl sha256 vendor/jre-64/server-jre-8u181-windows-x64.tar.gz | awk '{print $$2}'` == '7799b9007760663da32a3b177a0b9ea42ec268afaa69dcf8518cdce5136c3768' ] 116 | tar xf vendor/jre-64/server-jre-*.tar.gz -C vendor/jre-64 117 | mv vendor/jre-64/jdk*/jre vendor/jre-64 118 | cp -p vendor/jre-64/jre/lib/security/{policy/unlimited/*,} 119 | [ "$$(./vendor/jre-64/jre/bin/java HasUnlimitedStrength)" == 'YES' ] 120 | # NB if you need to update the JRE run phantomjs jre.js 121 | 122 | clean: 123 | rm -rf $(ES_HOME){,.zip} 124 | rm -rf $(COMMONS_DAEMON_HOME){,.zip} 125 | rm -f $(SETEXECUTABLEICON_EXE) 126 | rm -rf out 127 | rm -f *.{class,jar,exe,dll} 128 | rm -rf vendor/jre-{32,64} 129 | 130 | .PHONY: all jar setup vendor clean 32bit 64bit 131 | -------------------------------------------------------------------------------- /service.pas: -------------------------------------------------------------------------------- 1 | // Windows Service Control Manager access code based on Silvio Iaccarino code available at: 2 | // http://www.iaccarino.de/silvio/winstuff.htm 3 | 4 | // function IsServiceInstalled(ServiceName: string): boolean; 5 | // function IsServiceRunning(ServiceName: string): boolean; 6 | // function InstallService(FileName, ServiceName, DisplayName, Description: string; ServiceType, StartType: cardinal; AccountName, AccountPassword: string): boolean; 7 | // function RemoveService(ServiceName: string): boolean; 8 | // function StartService(ServiceName: string): boolean; 9 | // function StopService(ServiceName: string): boolean; 10 | // function SetupService(service, port, comment: string): boolean; 11 | 12 | type 13 | SERVICE_STATUS = record 14 | dwServiceType : cardinal; 15 | dwCurrentState : cardinal; 16 | dwControlsAccepted : cardinal; 17 | dwWin32ExitCode : cardinal; 18 | dwServiceSpecificExitCode : cardinal; 19 | dwCheckPoint : cardinal; 20 | dwWaitHint : cardinal; 21 | end; 22 | HANDLE = cardinal; 23 | 24 | const 25 | SERVICE_QUERY_CONFIG = $1; 26 | SERVICE_CHANGE_CONFIG = $2; 27 | SERVICE_QUERY_STATUS = $4; 28 | SERVICE_START = $10; 29 | SERVICE_STOP = $20; 30 | SERVICE_ALL_ACCESS = $f01ff; 31 | SC_MANAGER_ALL_ACCESS = $f003f; 32 | SERVICE_WIN32_OWN_PROCESS = $10; 33 | SERVICE_WIN32_SHARE_PROCESS = $20; 34 | SERVICE_WIN32 = $30; 35 | SERVICE_INTERACTIVE_PROCESS = $100; 36 | SERVICE_BOOT_START = $0; 37 | SERVICE_SYSTEM_START = $1; 38 | SERVICE_AUTO_START = $2; 39 | SERVICE_DEMAND_START = $3; 40 | SERVICE_DISABLED = $4; 41 | SERVICE_DELETE = $10000; 42 | SERVICE_CONTROL_STOP = $1; 43 | SERVICE_CONTROL_PAUSE = $2; 44 | SERVICE_CONTROL_CONTINUE = $3; 45 | SERVICE_CONTROL_INTERROGATE = $4; 46 | SERVICE_STOPPED = $1; 47 | SERVICE_START_PENDING = $2; 48 | SERVICE_STOP_PENDING = $3; 49 | SERVICE_RUNNING = $4; 50 | SERVICE_CONTINUE_PENDING = $5; 51 | SERVICE_PAUSE_PENDING = $6; 52 | SERVICE_PAUSED = $7; 53 | 54 | function OpenSCManager(lpMachineName, lpDatabaseName: string; dwDesiredAccess: cardinal): HANDLE; 55 | external 'OpenSCManagerW@advapi32.dll stdcall'; 56 | 57 | function OpenService(hSCManager: HANDLE; lpServiceName: string; dwDesiredAccess: cardinal): HANDLE; 58 | external 'OpenServiceW@advapi32.dll stdcall'; 59 | 60 | function CloseServiceHandle(hSCObject: HANDLE): boolean; 61 | external 'CloseServiceHandle@advapi32.dll stdcall'; 62 | 63 | function CreateService(hSCManager: HANDLE; lpServiceName, lpDisplayName: string; dwDesiredAccess, dwServiceType, dwStartType, dwErrorControl: cardinal; lpBinaryPathName, lpLoadOrderGroup: string; lpdwTagId: cardinal; lpDependencies, lpServiceStartName, lpPassword: string): cardinal; 64 | external 'CreateServiceW@advapi32.dll stdcall'; 65 | 66 | function DeleteService(hService: HANDLE): boolean; 67 | external 'DeleteService@advapi32.dll stdcall'; 68 | 69 | function StartNTService(hService: HANDLE; dwNumServiceArgs: cardinal; lpServiceArgVectors: cardinal): boolean; 70 | external 'StartServiceW@advapi32.dll stdcall'; 71 | 72 | function ControlService(hService: HANDLE; dwControl: cardinal; var ServiceStatus: SERVICE_STATUS): boolean; 73 | external 'ControlService@advapi32.dll stdcall'; 74 | 75 | function QueryServiceStatus(hService: HANDLE; var ServiceStatus: SERVICE_STATUS): boolean; 76 | external 'QueryServiceStatus@advapi32.dll stdcall'; 77 | 78 | function QueryServiceStatusEx(hService: HANDLE; ServiceStatus: SERVICE_STATUS): boolean; 79 | external 'QueryServiceStatus@advapi32.dll stdcall'; 80 | 81 | function GetLastError(): cardinal; 82 | external 'GetLastError@kernel32.dll stdcall'; 83 | 84 | function OpenServiceManager(): HANDLE; 85 | begin 86 | if UsingWinNT() then 87 | begin 88 | Result := OpenSCManager('', '', SC_MANAGER_ALL_ACCESS); 89 | if Result = 0 then 90 | MsgBox('the service control manager is not available', mbError, MB_OK) 91 | end 92 | else 93 | begin 94 | MsgBox('only NT based systems support services', mbError, MB_OK) 95 | Result := 0; 96 | end 97 | end; 98 | 99 | function IsServiceInstalled(ServiceName: string): boolean; 100 | var 101 | hSCM : HANDLE; 102 | hService: HANDLE; 103 | begin 104 | hSCM := OpenServiceManager(); 105 | Result := false; 106 | if hSCM <> 0 then 107 | begin 108 | hService := OpenService(hSCM, ServiceName, SERVICE_QUERY_CONFIG); 109 | if hService <> 0 then 110 | begin 111 | Result := true; 112 | CloseServiceHandle(hService) 113 | end; 114 | CloseServiceHandle(hSCM) 115 | end 116 | end; 117 | 118 | function InstallService(FileName, ServiceName, DisplayName, Description: string; ServiceType, StartType: cardinal; AccountName, AccountPassword: string): boolean; 119 | var 120 | hSCM : HANDLE; 121 | hService: HANDLE; 122 | ServiceStartName: string; 123 | begin 124 | hSCM := OpenServiceManager(); 125 | Result := false; 126 | if hSCM <> 0 then 127 | begin 128 | if AccountName <> '' then 129 | ServiceStartName := '.\' + AccountName; 130 | hService := CreateService(hSCM, ServiceName, DisplayName, SERVICE_ALL_ACCESS, ServiceType, StartType, 0, FileName, '', 0, '', ServiceStartName, AccountPassword); 131 | if hService <> 0 then 132 | begin 133 | Result := true; 134 | // Win2K & WinXP supports aditional description text for services 135 | if Description<> '' then 136 | RegWriteStringValue(HKLM, 'System\CurrentControlSet\Services\' + ServiceName, 'Description', Description); 137 | CloseServiceHandle(hService) 138 | end; 139 | CloseServiceHandle(hSCM) 140 | end 141 | end; 142 | 143 | function RemoveService(ServiceName: string): boolean; 144 | var 145 | hSCM : HANDLE; 146 | hService: HANDLE; 147 | begin 148 | hSCM := OpenServiceManager(); 149 | Result := false; 150 | if hSCM <> 0 then 151 | begin 152 | hService := OpenService(hSCM, ServiceName, SERVICE_DELETE); 153 | if hService <> 0 then 154 | begin 155 | Result := DeleteService(hService); 156 | CloseServiceHandle(hService) 157 | end; 158 | CloseServiceHandle(hSCM) 159 | end 160 | end; 161 | 162 | function StartService(ServiceName: string): boolean; 163 | var 164 | hSCM : HANDLE; 165 | hService: HANDLE; 166 | begin 167 | hSCM := OpenServiceManager(); 168 | Result := false; 169 | if hSCM <> 0 then 170 | begin 171 | hService := OpenService(hSCM, ServiceName, SERVICE_START); 172 | if hService <> 0 then 173 | begin 174 | Result := StartNTService(hService, 0, 0); 175 | CloseServiceHandle(hService) 176 | end; 177 | CloseServiceHandle(hSCM) 178 | end; 179 | end; 180 | 181 | function StopService(ServiceName: string): boolean; 182 | var 183 | hSCM : HANDLE; 184 | hService: HANDLE; 185 | Status : SERVICE_STATUS; 186 | begin 187 | hSCM := OpenServiceManager(); 188 | Result := false; 189 | if hSCM <> 0 then 190 | begin 191 | hService := OpenService(hSCM, ServiceName, SERVICE_STOP); 192 | if hService <> 0 then 193 | begin 194 | Result := ControlService(hService, SERVICE_CONTROL_STOP, Status); 195 | CloseServiceHandle(hService) 196 | end; 197 | CloseServiceHandle(hSCM) 198 | end; 199 | end; 200 | 201 | function IsServiceRunning(ServiceName: string): boolean; 202 | var 203 | hSCM : HANDLE; 204 | hService: HANDLE; 205 | Status : SERVICE_STATUS; 206 | begin 207 | hSCM := OpenServiceManager(); 208 | Result := false; 209 | if hSCM <> 0 then 210 | begin 211 | hService := OpenService(hSCM, ServiceName, SERVICE_QUERY_STATUS); 212 | if hService <> 0 then 213 | begin 214 | if QueryServiceStatus(hService, Status) then 215 | Result := (Status.dwCurrentState = SERVICE_RUNNING); 216 | CloseServiceHandle(hService) 217 | end; 218 | CloseServiceHandle(hSCM) 219 | end 220 | end; 221 | -------------------------------------------------------------------------------- /src/setup-helper.c: -------------------------------------------------------------------------------- 1 | /* Windows Setup Helper functions. 2 | * 3 | * Copyright (c) 2011, Rui Lopes (ruilopes.com) 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * 9 | * * Redistributions of source code must retain the above copyright notice, 10 | * this list of conditions and the following disclaimer. 11 | * * Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * * Neither the name of Redis nor the names of its contributors may be used 15 | * to endorse or promote products derived from this software without 16 | * specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | * POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | // TODO On Windows 7+ or Windows 2008 R2+ use NetAddServiceAccount, 32 | // NetRemoveServiceAccount and NetIsServiceAccount. 33 | // NB When we do this, we MUST also stop generating a service password 34 | // in the setup (managed service accounts do not have a password). 35 | 36 | #define _WIN32_WINNT 0x0501 37 | #define WINVER _WIN32_WINNT 38 | #define WIN32_LEAN_AND_MEAN 39 | #define STATUS_SUCCESS 0 40 | #define UNICODE 41 | #define _UNICODE 42 | 43 | #include 44 | #include 45 | #include 46 | #include 47 | #include 48 | #include 49 | #include 50 | 51 | 52 | static int addAccountRight(LPWSTR accountName, LPWSTR rightName); 53 | static int addRemoveAccountRight(LPWSTR accountName, LPWSTR rightName, BOOL add); 54 | 55 | 56 | /* Creates a new service account (with "log on as a service" user right). 57 | * 58 | * You can check the user rights with the "Local Security Policy" application. 59 | * Under the "Local Policies" / "User Rights Assignment" node see which 60 | * accounts are listed in the "Log on as a service" policy line. 61 | * 62 | * See How To Use NetUserAdd 63 | * at http://support.microsoft.com/kb/140165 64 | * See How To Manage User Privileges Programmatically in Windows NT 65 | * at http://support.microsoft.com/kb/132958 66 | */ 67 | __declspec(dllexport) int __stdcall CreateServiceAccount(LPWSTR accountName, LPWSTR password, LPWSTR comment) 68 | { 69 | USER_INFO_1 userInfo; 70 | 71 | ZeroMemory(&userInfo, sizeof(userInfo)); 72 | userInfo.usri1_name = accountName; 73 | userInfo.usri1_password = password; 74 | userInfo.usri1_priv = USER_PRIV_USER; 75 | userInfo.usri1_comment = comment; 76 | userInfo.usri1_flags = UF_DONT_EXPIRE_PASSWD | UF_SCRIPT; // TODO UF_NOT_DELEGATED too? ADD user cannot change password flag 77 | 78 | DWORD paramError; 79 | NET_API_STATUS status = NetUserAdd(NULL, 1, (PBYTE)&userInfo, ¶mError); 80 | 81 | if (status) { 82 | return status; 83 | } 84 | 85 | return addAccountRight(accountName, SE_SERVICE_LOGON_NAME); 86 | } 87 | 88 | 89 | __declspec(dllexport) int __stdcall DestroyServiceAccount(LPWSTR accountName) 90 | { 91 | return addRemoveAccountRight(accountName, NULL, FALSE); 92 | } 93 | 94 | 95 | __declspec(dllexport) int __stdcall ServiceAccountExists(LPWSTR accountName) 96 | { 97 | PUSER_INFO_0 userInfo = NULL; 98 | 99 | NET_API_STATUS status = NetUserGetInfo(NULL, accountName, 0, (PBYTE *)&userInfo); 100 | 101 | NetApiBufferFree(userInfo); 102 | 103 | return status; 104 | } 105 | 106 | 107 | static int addAccountRight(LPWSTR accountName, LPWSTR rightName) 108 | { 109 | return addRemoveAccountRight(accountName, rightName, TRUE); 110 | } 111 | 112 | 113 | static int addRemoveAccountRight(LPWSTR accountName, LPWSTR rightName, BOOL add) 114 | { 115 | BYTE sidBuffer[1024]; 116 | DWORD sidBufferSize = sizeof(sidBuffer); 117 | PSID sid = sidBuffer; 118 | 119 | TCHAR sidReferenceDomainName[512]; 120 | DWORD sidReferenceDomainNameLength = 512; 121 | 122 | SID_NAME_USE sidNameUse; 123 | 124 | ZeroMemory(sidBuffer, sidBufferSize); 125 | 126 | if (!LookupAccountName(L".", accountName, sid, &sidBufferSize, sidReferenceDomainName, &sidReferenceDomainNameLength, &sidNameUse)) { 127 | return -2; 128 | } 129 | 130 | LSA_HANDLE lsaHandle; 131 | LSA_OBJECT_ATTRIBUTES objectAttributes; 132 | 133 | ZeroMemory(&objectAttributes, sizeof(objectAttributes)); 134 | 135 | if (STATUS_SUCCESS != LsaOpenPolicy(NULL, &objectAttributes, POLICY_CREATE_ACCOUNT | POLICY_LOOKUP_NAMES, &lsaHandle)) { 136 | return -3; 137 | } 138 | 139 | if (rightName) { 140 | LSA_UNICODE_STRING privilegeString; 141 | privilegeString.Buffer = rightName; 142 | privilegeString.Length = wcslen(privilegeString.Buffer)*sizeof(WCHAR); 143 | privilegeString.MaximumLength = privilegeString.Length+sizeof(WCHAR); 144 | 145 | if (add) { 146 | if (STATUS_SUCCESS != LsaAddAccountRights(lsaHandle, sid, &privilegeString, 1)) { 147 | LsaClose(lsaHandle); 148 | return -4; 149 | } 150 | } 151 | else { 152 | if (STATUS_SUCCESS != LsaRemoveAccountRights(lsaHandle, sid, FALSE, &privilegeString, 1)) { 153 | LsaClose(lsaHandle); 154 | return -5; 155 | } 156 | } 157 | } 158 | else if (!add) { 159 | // remove the account altogether... 160 | 161 | // NB even though the documentation says LsaRemoveAccountRights will 162 | // remove the account, it does not really remove it... so we 163 | // remove it manually bellow. 164 | // NB if for some reason the account does not have any rights, we 165 | // accept that as success. 166 | NTSTATUS status = LsaRemoveAccountRights(lsaHandle, sid, TRUE, NULL, 0); 167 | if (STATUS_SUCCESS != status && STATUS_OBJECT_NAME_NOT_FOUND != status) { 168 | LsaClose(lsaHandle); 169 | return -6; 170 | } 171 | 172 | // delete the account profile (this is the account home directory that 173 | // is normally at C:\Users\ACCOUNT_NAME). 174 | { 175 | LPTSTR sidString = NULL; 176 | 177 | if (!ConvertSidToStringSid(sid, &sidString)) { 178 | LsaClose(lsaHandle); 179 | return -7; 180 | } 181 | 182 | if (!DeleteProfile(sidString, NULL, NULL)) { 183 | DWORD lastError = GetLastError(); 184 | 185 | // NB when the profile directory does not exist 186 | // GetLastError returns ERROR_FILE_NOT_FOUND; we 187 | // accept that as success. 188 | if (lastError != ERROR_FILE_NOT_FOUND) { 189 | LocalFree(sidString); 190 | LsaClose(lsaHandle); 191 | return -8; 192 | } 193 | } 194 | 195 | LocalFree(sidString); 196 | } 197 | 198 | // delete the account. 199 | if (NERR_Success != NetUserDel(NULL, accountName)) { 200 | LsaClose(lsaHandle); 201 | return -9; 202 | } 203 | } 204 | 205 | LsaClose(lsaHandle); 206 | 207 | return 0; 208 | } 209 | -------------------------------------------------------------------------------- /jre.js: -------------------------------------------------------------------------------- 1 | // developed by Rui Lopes (ruilopes.com). licensed under GPLv3. 2 | 3 | // TODO set a global timeout and abort the process if it expires. 4 | 5 | phantom.onError = function(msg, trace) { 6 | var msgStack = ["PHANTOM ERROR: " + msg]; 7 | if (trace && trace.length) { 8 | msgStack.push("TRACE:"); 9 | trace.forEach(function(t) { 10 | msgStack.push(" -> " + (t.file || t.sourceURL) + ": " + t.line + (t.function ? " (in function " + t.function + ")" : "")); 11 | }); 12 | } 13 | console.error(msgStack.join("\n")); 14 | phantom.exit(2); 15 | }; 16 | 17 | function printArgs() { 18 | var i, ilen; 19 | for (i = 0, ilen = arguments.length; i < ilen; ++i) { 20 | console.log(" arguments[" + i + "] = " + JSON.stringify(arguments[i])); 21 | } 22 | console.log(""); 23 | } 24 | 25 | function open(url, cb) { 26 | var page = require("webpage").create(); 27 | 28 | // window.console.log(msg); 29 | page.onConsoleMessage = function() { 30 | console.log("page console:"); 31 | printArgs.apply(this, arguments); 32 | }; 33 | 34 | // NB even thou the global phantom.onError should have run when there is a 35 | // page error... in practice, it does not happen on phantom 1.9.7... so 36 | // set the handler on the page too. 37 | // See https://github.com/ariya/phantomjs/wiki/API-Reference-phantom#onerror 38 | page.onError = phantom.onError; 39 | 40 | page.open(url, function(status) { cb(page, status); }); 41 | } 42 | 43 | // as-of phantomjs 1.9.7, things returned from page.evaluate are read-only, 44 | // this function makes them read-write by JSON serializing. 45 | function rw(o) { 46 | return JSON.parse(JSON.stringify(o)); 47 | }; 48 | 49 | function getIndexFromPage(page, filter) { 50 | return page.evaluate(function() { 51 | var $$ = function(selector) { 52 | return Array.prototype.slice.call(document.querySelectorAll(selector), 0); 53 | }; 54 | 55 | // look for url alike: 56 | // http://www.oracle.com/technetwork/java/javase/downloads/server-jre8-downloads-2133154.html 57 | // http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html 58 | // 59 | // and return something like: 60 | // [ 61 | // { 62 | // version: "8", 63 | // type: "client", 64 | // url: "http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html" 65 | // } 66 | // ] 67 | 68 | var index = $$("a[href*='javase/downloads/server-jre'], a[href*='javase/downloads/jre']").map(function(a) { 69 | var m = a.href.match(/[\-/]((server)-)?jre([^-]+)-/); 70 | return { 71 | version: m[3], 72 | type: m[2] || "client", 73 | url: a.href 74 | }; 75 | }); 76 | 77 | return index; 78 | }).filter(function(v) { 79 | return v && 80 | v.version.match(filter.version) && 81 | v.type.match(filter.type); 82 | }); 83 | } 84 | 85 | function getVersionsFromPage(page) { 86 | return page.evaluate(function() { 87 | // Patch since PhantomJS does not implement click() on HTMLElement. 88 | if (!HTMLElement.prototype.click) { 89 | HTMLElement.prototype.click = function() { 90 | var ev = document.createEvent("MouseEvent"); 91 | ev.initMouseEvent( 92 | "click", 93 | true, // bubble 94 | true, // cancelable 95 | window, 96 | null, 97 | 0, 0, 0, 0, // coordinates 98 | false, false, false, false, // modifier keys 99 | 0, // button=left 100 | null 101 | ); 102 | this.dispatchEvent(ev); 103 | }; 104 | } 105 | 106 | var $ = function(selector) { 107 | return document.querySelector(selector); 108 | }; 109 | 110 | var $$ = function(selector) { 111 | return Array.prototype.slice.call(document.querySelectorAll(selector), 0); 112 | }; 113 | 114 | // accept the agreement so it reveals the href 115 | $("input[onclick*='acceptAgreement']").click(); 116 | 117 | return $$("a[onclick*='youMustAgree']").map(function(a) { 118 | // TODO parse os, arch, type, version from url. 119 | return { 120 | name: a.innerText.trim(), 121 | url: a.href 122 | }; 123 | }); 124 | }); 125 | } 126 | 127 | function toCookieJar(cookies) { 128 | // See https://github.com/bagder/curl/blob/master/lib/cookie.c 129 | // See https://github.com/bagder/curl/blob/master/lib/parsedate.c 130 | 131 | // example cookie: 132 | // 133 | // { 134 | // "domain": ".oracle.com", 135 | // "expires": "qui, 28 jul 2016 16:56:35 GMT", 136 | // "expiry": 1469724995, 137 | // "httponly": false, 138 | // "name": "s_cc", 139 | // "path": "/", 140 | // "secure": false, 141 | // "value": "true" 142 | // } 143 | // 144 | // is returned as: 145 | // 146 | // Set-cookie: s_cc=true; domain=.oracle.com; path=/; expires=Tue, 28 Jul 2014 16:56:35 GMT 147 | 148 | return cookies.map(function(c) { 149 | return "Set-cookie: " + 150 | c.name + "=" + c.value + 151 | ";domain=" + c.domain + 152 | ";path=" + c.path + 153 | ((c.expires && ";expires=" + (new Date(c.expiry * 1000)).toUTCString()) || "") + 154 | ((c.httponly && ";HttpOnly") || "") + 155 | ((c.secure && ";secure") || "") 156 | ; 157 | }).join("\n") + "\n"; 158 | } 159 | 160 | function getLatestVersions(filter, cb) { 161 | open("http://www.oracle.com/technetwork/java/javase/downloads/index.html", function(page, status) { 162 | if (status !== "success") { 163 | console.log("ERROR: Unable to access network:", status); 164 | phantom.exit(1); 165 | return; 166 | } 167 | 168 | var index = rw(getIndexFromPage(page, filter)); 169 | 170 | page.close(); 171 | 172 | // 173 | // go into all download pages and grab the available versions. 174 | 175 | var versions = []; 176 | 177 | function process(i, cb) { 178 | open(i.url, function(page, status) { 179 | if (status !== "success") { 180 | console.log("ERROR: Unable to access network:", status); 181 | phantom.exit(1); 182 | return; 183 | } 184 | 185 | var cookies = rw(phantom.cookies); 186 | var cookieJar = toCookieJar(phantom.cookies); 187 | 188 | var pageVersions = getVersionsFromPage(page) 189 | .filter(function(v) { 190 | return v.url.match(filter.url); 191 | }) 192 | .map(function(v) { 193 | v.cookies = cookies; 194 | v.cookieJar = cookieJar; 195 | return v; 196 | }); 197 | 198 | versions.push.apply(versions, pageVersions); 199 | 200 | page.close(); 201 | 202 | cb(); 203 | }); 204 | } 205 | 206 | function next() { 207 | if (index.length == 0) { 208 | cb(versions); 209 | phantom.exit(0); 210 | return; 211 | } 212 | 213 | process(index.shift(), next); 214 | } 215 | 216 | next(); 217 | }); 218 | } 219 | 220 | function main() { 221 | // TODO accept the filter from command line. 222 | var filter = { 223 | // accept only version 8. 224 | version: /^8/, 225 | 226 | // type: server|client. 227 | type: /.+/, 228 | 229 | // accept only windows tar balls versions. 230 | // e.g. http://.../server-jre-8u11-windows-x64.tar.gz 231 | url: /-windows-.+\.tar\.gz$/ 232 | }; 233 | 234 | getLatestVersions(filter, function(versions) { 235 | var seen = []; 236 | 237 | versions.forEach(function(version) { 238 | if (!version.name.match(/^[0-9a-z\.\-]+$/)) 239 | throw "invalid name " + version.name; 240 | 241 | var bits = version.name.indexOf("x64") > 0 ? 64 : 32; 242 | 243 | // we just want the latest version of each bits. this works because the 244 | // server returns the versions in the preferable order. 245 | if (seen.indexOf(bits) >= 0) 246 | return; 247 | seen.push(bits); 248 | 249 | var vendorPath = "vendor/jre-" + bits; 250 | var tarballPath = vendorPath + "/" + version.name; 251 | var cookie = "oraclelicense=accept-securebackup-cookie"; 252 | 253 | if (false) { 254 | // this is here just in case they change the way the license is accepted. 255 | // here we can store all the cookies. 256 | var fs = require("fs"); 257 | 258 | var cookiesFilename = version.name + ".cookies.txt"; 259 | 260 | fs.write(cookiesFilename, version.cookieJar, "w"); 261 | 262 | cookie = cookiesFilename; 263 | } 264 | 265 | // TODO if vendor/$(version.name) does not exists, download it, and extract 266 | // into vendor/jre-32 or vendor/jre-64. 267 | 268 | var commandLine = "rm -rf " + vendorPath + " && mkdir " + vendorPath 269 | + " && curl --insecure -b " + cookie + " -L -o " + tarballPath + " " + version.url 270 | // NB we do not extract the tarball ourself because on windows tar is fubar with warnings like: 271 | // tar: Archive value 127667 is out of uid_t range 0..65535 272 | // and 7z does not directly support extracting a tarball... well, 273 | // maybe another day I'll fix this to download things automatically... 274 | + " && echo now extract " + tarballPath + " into " + vendorPath + " and move the jre sub-directory within to " + vendorPath 275 | //+ " && tar xf " + tarballPath + " -C " + vendorPath 276 | ; 277 | 278 | console.log(commandLine); 279 | }); 280 | }); 281 | } 282 | 283 | main(); 284 | -------------------------------------------------------------------------------- /elasticsearch.iss: -------------------------------------------------------------------------------- 1 | ; elasticsearch for Windows Setup Script created by Rui Lopes (ruilopes.com). 2 | ; 3 | ; TODO do not override existing configuration files. 4 | ; TODO after uninstall, setup-helper.dll is left behind... figure out why its 5 | ; not being automatically deleted. 6 | ; TODO sign the setup? 7 | ; NB: Unizeto Certum has free certificates to open-source authors. 8 | ; See http://www.certum.eu/certum/cert,offer_software_publisher.xml 9 | ; See https://developer.mozilla.org/en/Signing_a_XPI 10 | 11 | #define ServiceAccountName "elasticsearch" 12 | #define ServiceName "elasticsearch" 13 | #define JreVersion "8u181" 14 | #define ESPath "vendor\elasticsearch-" + AppVersion 15 | #ifdef _WIN64 16 | #define Bits "64" 17 | #define ArchitecturesInstallIn64BitMode "x64" 18 | #define ArchitecturesAllowed "x64" 19 | #else 20 | #define Bits "32" 21 | #define ArchitecturesInstallIn64BitMode 22 | #define ArchitecturesAllowed "x86 x64" 23 | #endif 24 | 25 | [Setup] 26 | ArchitecturesInstallIn64BitMode={#ArchitecturesInstallIn64BitMode} 27 | ArchitecturesAllowed={#ArchitecturesAllowed} 28 | AppID={{BBFE3D83-0850-4E17-8BCC-860945E4F485} 29 | AppName=Elasticsearch 30 | AppVersion={#AppVersion} 31 | VersionInfoVersion={#VersionInfoVersion} 32 | AppPublisher=rgl 33 | AppPublisherURL=https://github.com/rgl/elasticsearch-setup 34 | AppSupportURL=https://github.com/rgl/elasticsearch-setup 35 | AppUpdatesURL=https://github.com/rgl/elasticsearch-setup 36 | DefaultDirName={pf}\Elasticsearch 37 | DefaultGroupName=Elasticsearch 38 | OutputDir=. 39 | OutputBaseFilename=elasticsearch-{#AppVersion}-jre-{#JreVersion}-setup-{#Bits}-bit 40 | SetupIconFile=elasticsearch.ico 41 | Compression=lzma2/max 42 | SolidCompression=yes 43 | WizardImageFile=wizard.bmp 44 | WizardImageStretch=no 45 | WizardSmallImageFile=wizard-small.bmp 46 | 47 | [Languages] 48 | Name: "english"; MessagesFile: "compiler:Default.isl" 49 | 50 | [Dirs] 51 | Name: "{app}\bin" 52 | Name: "{app}\config" 53 | Name: "{app}\config\scripts" 54 | Name: "{app}\data" 55 | Name: "{app}\logs" 56 | Name: "{app}\plugins" 57 | 58 | [Files] 59 | Source: "setup-helper.dll"; DestDir: "{app}" 60 | Source: "vendor\SetACL-2.2.0\SetACL.exe"; DestDir: "{tmp}"; Flags: deleteafterinstall ignoreversion 61 | Source: "{#ESPath}\bin\elasticsearchw-{#Bits}.exe"; DestDir: "{app}\bin"; DestName: "elasticsearchw.exe" 62 | Source: "{#ESPath}\bin\elasticsearch-env.bat"; DestDir: "{app}\bin" 63 | Source: "{#ESPath}\bin\elasticsearch-keystore.bat"; DestDir: "{app}\bin" 64 | Source: "{#ESPath}\bin\elasticsearch-plugin.bat"; DestDir: "{app}\bin" 65 | Source: "{#ESPath}\bin\elasticsearch-translog.bat"; DestDir: "{app}\bin" 66 | Source: "{#ESPath}\lib\elasticsearch-cmd.cmd"; DestDir: "{app}\lib" 67 | Source: "{#ESPath}\lib\elasticsearchw-update-{#Bits}.cmd"; DestDir: "{app}\lib"; DestName: "elasticsearchw-update.cmd" 68 | Source: "{#ESPath}\lib\*.jar"; DestDir: "{app}\lib" 69 | Source: "{#ESPath}\modules\*"; DestDir: "{app}\modules"; Flags: recursesubdirs createallsubdirs 70 | Source: "{#ESPath}\config\elasticsearch.yml"; DestDir: "{app}\config" 71 | Source: "{#ESPath}\config\log4j2.properties"; DestDir: "{app}\config" 72 | Source: "{#ESPath}\README.textile"; DestDir: "{app}"; DestName: "README.txt"; Flags: isreadme 73 | Source: "{#ESPath}\NOTICE.txt"; DestDir: "{app}" 74 | Source: "{#ESPath}\LICENSE.txt"; DestDir: "{app}" 75 | Source: "elasticsearchw-uninstall.cmd"; DestDir: "{app}\lib" 76 | Source: "Elasticsearch Home.url"; DestDir: "{app}" 77 | Source: "Elasticsearch Setup Home.url"; DestDir: "{app}" 78 | Source: "Elasticsearch Guide.url"; DestDir: "{app}" 79 | Source: "vendor\jre-{#Bits}\jre\*"; DestDir: "{app}\jre"; Flags: recursesubdirs createallsubdirs 80 | 81 | [Icons] 82 | Name: "{group}\Elasticsearch Home"; Filename: "{app}\Elasticsearch Home.url" 83 | Name: "{group}\Elasticsearch Setup Home"; Filename: "{app}\Elasticsearch Setup Home.url" 84 | Name: "{group}\Elasticsearch Guide"; Filename: "{app}\Elasticsearch Guide.url" 85 | Name: "{group}\Elasticsearch Read Me"; Filename: "{app}\README.txt" 86 | Name: "{group}\Elasticsearch License"; Filename: "{app}\LICENSE.txt" 87 | Name: "{group}\Uninstall Elasticsearch"; Filename: "{uninstallexe}" 88 | 89 | [Run] 90 | Filename: "{tmp}\SetACL.exe"; Parameters: "-on config -ot file -actn setprot -op ""dacl:p_nc;sacl:p_nc"" -actn ace -ace ""n:Administrators;p:full"" -ace ""n:{#ServiceAccountName};p:read"""; WorkingDir: "{app}"; Flags: runhidden; 91 | Filename: "{tmp}\SetACL.exe"; Parameters: "-on data -ot file -actn setprot -op ""dacl:p_nc;sacl:p_nc"" -actn ace -ace ""n:Administrators;p:full"" -ace ""n:{#ServiceAccountName};p:full"""; WorkingDir: "{app}"; Flags: runhidden; 92 | Filename: "{tmp}\SetACL.exe"; Parameters: "-on logs -ot file -actn setprot -op ""dacl:p_nc;sacl:p_nc"" -actn ace -ace ""n:Administrators;p:full"" -ace ""n:{#ServiceAccountName};p:full"""; WorkingDir: "{app}"; Flags: runhidden; 93 | Filename: "{app}\bin\elasticsearch-keystore.bat"; Parameters: "create"; WorkingDir: "{app}"; Flags: runhidden shellexec waituntilterminated; 94 | Filename: "{tmp}\SetACL.exe"; Parameters: "-on config/elasticsearch.keystore -ot file -actn setprot -op ""dacl:p_nc;sacl:p_nc"" -actn ace -ace ""n:Administrators;p:full"" -ace ""n:{#ServiceAccountName};p:full"""; WorkingDir: "{app}"; Flags: runhidden; 95 | Filename: "{app}\lib\elasticsearchw-update.cmd"; WorkingDir: "{app}"; Flags: runhidden shellexec waituntilterminated; 96 | 97 | [UninstallRun] 98 | Filename: "{app}\lib\elasticsearchw-uninstall.cmd"; WorkingDir: "{app}"; Flags: runhidden shellexec waituntilterminated; 99 | 100 | [Code] 101 | #include "service.pas" 102 | #include "service-account.pas" 103 | #include "java.pas" 104 | #include "shortcut.pas" 105 | 106 | const 107 | SERVICE_ACCOUNT_NAME = '{#ServiceAccountName}'; 108 | SERVICE_ACCOUNT_DESCRIPTION = '{#ServiceName} Service'; 109 | SERVICE_NAME = '{#ServiceName}'; 110 | SERVICE_DISPLAY_NAME = '{#ServiceName}'; 111 | SERVICE_DESCRIPTION = 'Distributed Search Engine'; 112 | 113 | const 114 | LM20_PWLEN = 14; 115 | 116 | function GeneratePassword: string; 117 | var 118 | N: integer; 119 | begin 120 | for N := 1 to LM20_PWLEN do 121 | begin 122 | Result := Result + Chr(33 + Random(255 - 33)); 123 | end; 124 | end; 125 | 126 | function InitializeSetup(): boolean; 127 | begin 128 | //NB we now bundle JRE; so no need to check for this. 129 | //Result := RequireJava('1.6'); 130 | //if not Result then 131 | // Exit; 132 | 133 | if IsServiceRunning(SERVICE_NAME) then 134 | begin 135 | MsgBox('Please stop the ' + SERVICE_NAME + ' service before running this install', mbError, MB_OK); 136 | Result := false; 137 | end 138 | else 139 | Result := true 140 | end; 141 | 142 | function InitializeUninstall(): boolean; 143 | begin 144 | if IsServiceRunning(SERVICE_NAME) then 145 | begin 146 | MsgBox('Please stop the ' + SERVICE_NAME + ' service before running this uninstall', mbError, MB_OK); 147 | Result := false; 148 | end 149 | else 150 | Result := true; 151 | end; 152 | 153 | procedure CurStepChanged(CurStep: TSetupStep); 154 | var 155 | ServicePath: string; 156 | Password: string; 157 | Status: integer; 158 | CmdPath: string; 159 | IconPath: string; 160 | WorkingDirectoryPath: string; 161 | begin 162 | case CurStep of 163 | ssInstall: 164 | begin 165 | if ServiceAccountExists(SERVICE_ACCOUNT_NAME) <> 0 then 166 | begin 167 | Password := GeneratePassword; 168 | 169 | Status := CreateServiceAccount(SERVICE_ACCOUNT_NAME, Password, SERVICE_ACCOUNT_DESCRIPTION); 170 | 171 | if Status <> 0 then 172 | begin 173 | MsgBox('Failed to create service account for ' + SERVICE_ACCOUNT_NAME + ' (#' + IntToStr(Status) + ')' #13#13 'You need to create it manually.', mbError, MB_OK); 174 | end; 175 | end; 176 | 177 | if IsServiceInstalled(SERVICE_NAME) then 178 | Exit; 179 | 180 | ServicePath := ExpandConstant('{app}\bin\elasticsearchw.exe //RS//' + SERVICE_NAME); 181 | 182 | if not InstallService(ServicePath, SERVICE_NAME, SERVICE_DISPLAY_NAME, SERVICE_DESCRIPTION, SERVICE_WIN32_OWN_PROCESS, SERVICE_AUTO_START, SERVICE_ACCOUNT_NAME, Password) then 183 | begin 184 | MsgBox('Failed to install the ' + SERVICE_NAME + ' service.' #13#13 'You need to install it manually.', mbError, MB_OK) 185 | end 186 | end; 187 | ssPostInstall: 188 | begin 189 | CmdPath := ExpandConstant('{app}\lib\elasticsearch-cmd.cmd'); 190 | IconPath := ExpandConstant('{uninstallexe}'); 191 | WorkingDirectoryPath := ExpandConstant('{app}'); 192 | CreateShortcut(ExpandConstant('{app}\bin\Elasticsearch Command Prompt.lnk'), CmdPath, IconPath, WorkingDirectoryPath, True); 193 | CreateShortcut(ExpandConstant('{group}\Elasticsearch Command Prompt.lnk'), CmdPath, IconPath, WorkingDirectoryPath, True); 194 | end 195 | end 196 | end; 197 | 198 | procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep); 199 | var 200 | Status: integer; 201 | begin 202 | case CurUninstallStep of 203 | usPostUninstall: 204 | begin 205 | DeleteFile(ExpandConstant('{app}\bin\Elasticsearch Command Prompt.lnk')); 206 | DeleteFile(ExpandConstant('{group}\Elasticsearch Command Prompt.lnk')); 207 | 208 | // NB the service should already be uinstalled (by elasticsearchw-uninstall.cmd) 209 | 210 | Status := DestroyServiceAccount(SERVICE_ACCOUNT_NAME); 211 | 212 | if Status <> 0 then 213 | begin 214 | MsgBox('Failed to delete the service account for ' + SERVICE_ACCOUNT_NAME + ' (#' + IntToStr(Status) + ')' #13#13 'You need to delete it manually.', mbError, MB_OK); 215 | end; 216 | end 217 | end 218 | end; 219 | -------------------------------------------------------------------------------- /Vagrantfile-provision.ps1: -------------------------------------------------------------------------------- 1 | Set-StrictMode -Version Latest 2 | $ProgressPreference = 'SilentlyContinue' 3 | $ErrorActionPreference = 'Stop' 4 | trap { 5 | Write-Output "ERROR: $_" 6 | Write-Output (($_.ScriptStackTrace -split '\r?\n') -replace '^(.*)$','ERROR: $1') 7 | Write-Output (($_.Exception.ToString() -split '\r?\n') -replace '^(.*)$','ERROR EXCEPTION: $1') 8 | Exit 1 9 | } 10 | 11 | # wrap the choco command (to make sure this script aborts when it fails). 12 | function Start-Choco([string[]]$Arguments, [int[]]$SuccessExitCodes=@(0)) { 13 | $command, $commandArguments = $Arguments 14 | if ($command -eq 'install') { 15 | $Arguments = @($command, '--no-progress') + $commandArguments 16 | } 17 | for ($n = 0; $n -lt 10; ++$n) { 18 | if ($n) { 19 | # NB sometimes choco fails with "The package was not found with the source(s) listed." 20 | # but normally its just really a transient "network" error. 21 | Write-Host "Retrying choco install..." 22 | Start-Sleep -Seconds 3 23 | } 24 | &C:\ProgramData\chocolatey\bin\choco.exe @Arguments 25 | if ($SuccessExitCodes -Contains $LASTEXITCODE) { 26 | return 27 | } 28 | } 29 | throw "$(@('choco')+$Arguments | ConvertTo-Json -Compress) failed with exit code $LASTEXITCODE" 30 | } 31 | function choco { 32 | Start-Choco $Args 33 | } 34 | 35 | # install classic shell. 36 | New-Item -Path HKCU:Software\IvoSoft\ClassicStartMenu -Force ` 37 | | New-ItemProperty -Name ShowedStyle2 -Value 1 -PropertyType DWORD ` 38 | | Out-Null 39 | New-Item -Path HKCU:Software\IvoSoft\ClassicStartMenu\Settings -Force ` 40 | | New-ItemProperty -Name EnableStartButton -Value 1 -PropertyType DWORD ` 41 | | New-ItemProperty -Name SkipMetro -Value 1 -PropertyType DWORD ` 42 | | Out-Null 43 | choco install -y classic-shell -installArgs ADDLOCAL=ClassicStartMenu 44 | 45 | # install Google Chrome. 46 | # see https://www.chromium.org/administrators/configuring-other-preferences 47 | choco install -y googlechrome 48 | $chromeLocation = 'C:\Program Files (x86)\Google\Chrome\Application' 49 | cp -Force c:/vagrant/Vagrantfile-GoogleChrome-external_extensions.json (Get-Item "$chromeLocation\*\default_apps\external_extensions.json").FullName 50 | cp -Force c:/vagrant/Vagrantfile-GoogleChrome-master_preferences.json "$chromeLocation\master_preferences" 51 | cp -Force c:/vagrant/Vagrantfile-GoogleChrome-master_bookmarks.html "$chromeLocation\master_bookmarks.html" 52 | 53 | # install other useful applications and dependencies. 54 | choco install -y notepad2 55 | choco install -y baretail 56 | choco install -y --allow-empty-checksums dependencywalker 57 | choco install -y procexp 58 | choco install -y phantomjs 59 | choco install -y innosetup 60 | # for building the setup-helper.dll we need the 32-bit version 61 | # of the win32 libraries, for having them we have to force the 62 | # installation of the 32-bit mingw package. 63 | $env:chocolateyForceX86 = 'true' 64 | choco install -y mingw -params '/threads:win32' 65 | del env:chocolateyForceX86 66 | # for testing whether we have correcly installed the Java 67 | # Cryptography Extension (JCE) Unlimited Strength Jurisdiction 68 | # Policy Files we need the jdk to compile a test program. 69 | choco install -y jdk8 70 | choco install -y git --params '/GitOnlyOnPath /NoAutoCrlf' 71 | choco install -y gitextensions 72 | choco install -y meld 73 | 74 | # update $env:PATH with the recently installed Chocolatey packages. 75 | Import-Module C:\ProgramData\chocolatey\helpers\chocolateyInstaller.psm1 76 | Update-SessionEnvironment 77 | 78 | # configure git. 79 | # see http://stackoverflow.com/a/12492094/477532 80 | git config --global user.name 'Rui Lopes' 81 | git config --global user.email 'rgl@ruilopes.com' 82 | git config --global push.default simple 83 | git config --global diff.guitool meld 84 | git config --global difftool.meld.path 'C:/Program Files (x86)/Meld/Meld.exe' 85 | git config --global difftool.meld.cmd '\"C:/Program Files (x86)/Meld/Meld.exe\" \"$LOCAL\" \"$REMOTE\"' 86 | git config --global merge.tool meld 87 | git config --global mergetool.meld.path 'C:/Program Files (x86)/Meld/Meld.exe' 88 | git config --global mergetool.meld.cmd '\"C:/Program Files (x86)/Meld/Meld.exe\" --diff \"$LOCAL\" \"$BASE\" \"$REMOTE\" --output \"$MERGED\"' 89 | #git config --list --show-origin 90 | 91 | # install msys2. 92 | # NB we have to manually build the msys2 package from source because the 93 | # current chocolatey package is somewhat brittle to install. 94 | Push-Location $env:TEMP 95 | $p = Start-Process git clone,https://github.com/rgl/choco-packages -PassThru -Wait 96 | if ($p.ExitCode) { 97 | throw "git failed with exit code $($p.ExitCode)" 98 | } 99 | cd choco-packages/msys2 100 | choco pack 101 | choco install -y msys2 -Source $PWD 102 | Pop-Location 103 | 104 | # configure the msys2 launcher to let the shell inherith the PATH. 105 | $msys2BasePath = 'C:\tools\msys64' 106 | $msys2ConfigPath = "$msys2BasePath\msys2.ini" 107 | [IO.File]::WriteAllText( 108 | $msys2ConfigPath, 109 | ([IO.File]::ReadAllText($msys2ConfigPath) ` 110 | -replace '#?(MSYS2_PATH_TYPE=).+','$1inherit') 111 | ) 112 | 113 | # define a function for easying the execution of bash scripts. 114 | $bashPath = "$msys2BasePath\usr\bin\bash.exe" 115 | function Bash($script) { 116 | $eap = $ErrorActionPreference 117 | $ErrorActionPreference = 'Continue' 118 | try { 119 | # we also redirect the stderr to stdout because PowerShell 120 | # oddly interleaves them. 121 | # see https://www.gnu.org/software/bash/manual/bash.html#The-Set-Builtin 122 | echo 'exec 2>&1;set -eu;export PATH="/usr/bin:$PATH";export HOME=/c/Users/vagrant;' $script | &$bashPath 123 | if ($LASTEXITCODE) { 124 | throw "bash execution failed with exit code $LASTEXITCODE" 125 | } 126 | } finally { 127 | $ErrorActionPreference = $eap 128 | } 129 | } 130 | 131 | # install the remaining dependencies. 132 | Bash 'pacman --noconfirm -Sy make unzip tar dos2unix' 133 | 134 | # configure the shell. 135 | Bash @' 136 | pacman --noconfirm -Sy vim 137 | 138 | cat>~/.bash_history<<"EOF" 139 | cd /c/vagrant 140 | cd /c/vagrant && make clean all 141 | make clean all 142 | tail -f /c/Program\ Files/Elasticsearch/logs/elasticsearch.log 143 | net start elasticsearch 144 | curl localhost:9200/_cluster/state?pretty 145 | curl localhost:9200/_cluster/health?pretty 146 | curl localhost:9200/_cluster/pending_tasks?pretty 147 | curl localhost:9200/_cat/indices?v 148 | net stop elasticsearch 149 | EOF 150 | 151 | cat>~/.bashrc<<"EOF" 152 | # If not running interactively, don't do anything 153 | [[ "$-" != *i* ]] && return 154 | 155 | export EDITOR=vim 156 | export PAGER=less 157 | 158 | alias l='ls -lF --color' 159 | alias ll='l -a' 160 | alias h='history 25' 161 | alias j='jobs -l' 162 | EOF 163 | 164 | cat>~/.inputrc<<"EOF" 165 | "\e[A": history-search-backward 166 | "\e[B": history-search-forward 167 | "\eOD": backward-word 168 | "\eOC": forward-word 169 | set show-all-if-ambiguous on 170 | set completion-ignore-case on 171 | EOF 172 | 173 | cat>~/.vimrc<<"EOF" 174 | syntax on 175 | set background=dark 176 | set esckeys 177 | set ruler 178 | set laststatus=2 179 | set nobackup 180 | 181 | autocmd BufNewFile,BufRead Vagrantfile set ft=ruby 182 | autocmd BufNewFile,BufRead *.config set ft=xml 183 | 184 | " Usefull setting for working with Ruby files. 185 | autocmd FileType ruby set tabstop=2 shiftwidth=2 smarttab expandtab softtabstop=2 autoindent 186 | autocmd FileType ruby set smartindent cinwords=if,elsif,else,for,while,try,rescue,ensure,def,class,module 187 | 188 | " Usefull setting for working with Python files. 189 | autocmd FileType python set tabstop=4 shiftwidth=4 smarttab expandtab softtabstop=4 autoindent 190 | " Automatically indent a line that starts with the following words (after we press ENTER). 191 | autocmd FileType python set smartindent cinwords=if,elif,else,for,while,try,except,finally,def,class 192 | 193 | " Usefull setting for working with Go files. 194 | autocmd FileType go set tabstop=4 shiftwidth=4 smarttab expandtab softtabstop=4 autoindent 195 | " Automatically indent a line that starts with the following words (after we press ENTER). 196 | autocmd FileType go set smartindent cinwords=if,else,switch,for,func 197 | EOF 198 | '@ 199 | 200 | # install ConEmu 201 | choco install -y conemu 202 | cp C:\vagrant\Vagrantfile-ConEmu.xml $env:APPDATA\ConEmu.xml 203 | reg import C:\vagrant\Vagrantfile-ConEmu.reg 204 | 205 | # install vscode. 206 | choco install -y visualstudiocode -params '/NoDesktopIcon /NoQuicklaunchIcon' 207 | 208 | # build the setup. 209 | Bash 'cd /c/vagrant && make clean all' 210 | 211 | # install elasticsearch. 212 | Write-Output 'Installing Elasticsearch...' 213 | Start-Process ` 214 | (dir C:\vagrant\elasticsearch-*-setup*.exe).FullName ` 215 | '/VERYSILENT','/SUPPRESSMSGBOXES' ` 216 | -Wait 217 | # install plugins. 218 | function Install-ElasticsearchPlugin($name) { 219 | Write-Output "Installing the $name Elasticsearch plugin..." 220 | cmd /C "call ""C:\Program Files\Elasticsearch\bin\elasticsearch-plugin.bat"" install --batch $name" 221 | if ($LASTEXITCODE) { 222 | throw "failed to install Elasticsearch plugin $name with exit code $LASTEXITCODE" 223 | } 224 | } 225 | Install-ElasticsearchPlugin 'ingest-attachment' 226 | # start it. 227 | Write-Output 'Starting Elasticsearch...' 228 | Start-Service elasticsearch 229 | 230 | # remove the default desktop shortcuts. 231 | del C:\Users\Public\Desktop\*.lnk 232 | 233 | # add MSYS2 shortcut to the Desktop and Start Menu. 234 | Install-ChocolateyShortcut ` 235 | -ShortcutFilePath "$env:USERPROFILE\Desktop\MSYS2 Bash.lnk" ` 236 | -TargetPath 'C:\Program Files\ConEmu\ConEmu64.exe' ` 237 | -Arguments '-run {MSYS2} -icon C:\tools\msys64\msys2.ico' ` 238 | -IconLocation C:\tools\msys64\msys2.ico ` 239 | -WorkingDirectory $env:USERPROFILE 240 | Install-ChocolateyShortcut ` 241 | -ShortcutFilePath "C:\Users\All Users\Microsoft\Windows\Start Menu\Programs\MSYS2 Bash.lnk" ` 242 | -TargetPath 'C:\Program Files\ConEmu\ConEmu64.exe' ` 243 | -Arguments '-run {MSYS2} -icon C:\tools\msys64\msys2.ico' ` 244 | -IconLocation C:\tools\msys64\msys2.ico ` 245 | -WorkingDirectory $env:USERPROFILE 246 | 247 | # add Services shortcut to the Desktop. 248 | Install-ChocolateyShortcut ` 249 | -ShortcutFilePath "$env:USERPROFILE\Desktop\Services.lnk" ` 250 | -TargetPath "$env:windir\system32\services.msc" ` 251 | -Description 'Windows Services' 252 | 253 | # add Elasticsearch shortcut to the Desktop. 254 | Install-ChocolateyShortcut ` 255 | -ShortcutFilePath "$env:USERPROFILE\Desktop\Elasticsearch.lnk" ` 256 | -TargetPath 'C:\Program Files\Elasticsearch' ` 257 | -Description 'Elasticsearch installation directory' 258 | 259 | # add Local Elasticsearch HTTP endpoint shortcut to the Desktop. 260 | Install-ChocolateyShortcut ` 261 | -ShortcutFilePath "$env:USERPROFILE\Desktop\Elasticsearch Endpoint.lnk" ` 262 | -TargetPath 'http://localhost:9200' ` 263 | -IconLocation 'C:\vagrant\elasticsearch.ico' ` 264 | -Description 'Local Elasticsearch HTTP endpoint' 265 | 266 | # add Elasticsearch Logs shortcut to the Desktop. 267 | Install-ChocolateyShortcut ` 268 | -ShortcutFilePath "$env:USERPROFILE\Desktop\Elasticsearch Logs.lnk" ` 269 | -TargetPath 'C:\ProgramData\chocolatey\lib\baretail\tools\baretail.exe' ` 270 | -Arguments '"C:\Program Files\Elasticsearch\logs\elasticsearch.log"' ` 271 | -Description 'Local Elasticsearch HTTP endpoint' 272 | 273 | # enable show window content while dragging. 274 | Set-ItemProperty -Path 'HKCU:Control Panel\Desktop' -Name DragFullWindows -Value 1 275 | 276 | # show hidden files. 277 | Set-ItemProperty -Path HKCU:Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name Hidden -Value 1 278 | 279 | # show protected operating system files. 280 | Set-ItemProperty -Path HKCU:Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name ShowSuperHidden -Value 1 281 | 282 | # show file extensions. 283 | Set-ItemProperty -Path HKCU:Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name HideFileExt -Value 0 284 | 285 | # display full path in the title bar. 286 | New-Item -Path HKCU:Software\Microsoft\Windows\CurrentVersion\Explorer\CabinetState -Force ` 287 | | New-ItemProperty -Name FullPath -Value 1 -PropertyType DWORD ` 288 | | Out-Null 289 | 290 | # never combine the taskbar buttons. 291 | # 292 | # possibe values: 293 | # 0: always combine and hide labels (default) 294 | # 1: combine when taskbar is full 295 | # 2: never combine 296 | Set-ItemProperty -Path HKCU:Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name TaskbarGlomLevel -Value 2 297 | -------------------------------------------------------------------------------- /vendor/verpatch-1.0.10/verpatch-ReadMe.txt: -------------------------------------------------------------------------------- 1 | 2 | Verpatch - a tool to patch win32 version resources on .exe or .dll files, 3 | 4 | Version: 1.0.10 (02-Sep-2012) 5 | 6 | Verpatch is a command line tool for adding and editing the version information 7 | of Windows executable files (applications, DLLs, kernel drivers) 8 | without rebuilding the executable. 9 | 10 | It can also add or replace Win32 (native) resources, and do some other 11 | modifications of executable files. 12 | 13 | Verpatch sets ERRORLEVEL 0 on success, otherwise errorlevel is non-zero. 14 | Verpatch modifies files in place, so please make copies of precious files. 15 | 16 | 17 | Command line syntax 18 | =================== 19 | 20 | verpatch filename [version] [/options] 21 | 22 | Where 23 | - filename : any Windows PE file (exe, dll, sys, ocx...) that can have version resource 24 | - version : one to four decimal numbers, separated by dots, ex.: 1.2.3.4 25 | Additional text can follow the numbers; see examples below. Ex.: "1.2.3.4 extra text" 26 | 27 | Common Options: 28 | 29 | /va - creates a version resource. Use when the file has no version resource at all, 30 | or existing version resource should be replaced. 31 | If this option not specified, verpatch will read version resourse from the file. 32 | /s name "value" - add a version resource string attribute 33 | The name can be either a full attribute name or alias; see below. 34 | /sc "comment" - add or replace Comments string (shortcut for /s Comments "comment") 35 | /pv - specify Product version 36 | where arg has same form as the file version (1.2.3.4 or "1.2.3.4 text") 37 | /high - when less than 4 version numbers, these are higher numbers. 38 | 39 | 40 | Other options: 41 | 42 | /fn - preserves Original filename, Internal name in the existing version resource of the file. 43 | /langid - language id for new version resource. 44 | Use with /va. Default is Language Neutral. 45 | is combination of primary and sublanguage IDs. ENU is 1033 or 0x409. 46 | /vo - outputs the version info in RC format to stdout. 47 | This can be used with /xi to dump a version resource without modification. 48 | Output of /vo can be pasted to a .rc file and compiled with rc. 49 | /xi- test mode. does all operations in memory but does not modify the file 50 | /xlb - test mode. Re-parses the version resource after modification. 51 | /rpdb - removes path to the .pdb file in debug information; leaves only file name. 52 | /rf #id file - add or replace a raw binary resource from file (see below) 53 | /noed - do not check for extra data appended to exe file 54 | /vft2 num - specify driver subtype (VFT2_xxx value, see winver.h) 55 | The application type (VFT_xxx) is retained from the existing version resource of the file, 56 | or filled automatically, based on the filename extension (.exe->app, .sys->driver, anything else->dll) 57 | 58 | 59 | Examples 60 | ======== 61 | 62 | verpatch d:\foo.dll 1.2.33.44 63 | - sets the file version to 1.2.33.44 64 | The Original file name and Internal name strings are set to "foo.dll". 65 | File foo.dll should already have a version resource (since /va not specified) 66 | 67 | verpatch d:\foo.dll 1.2.33 /high 68 | - sets three higher 3 numbers of the file version. The 4th number not changed 69 | File foo.dll should already have a version resource. 70 | 71 | verpatch d:\foo.dll 33.44 /s comment "a comment" 72 | - replaces only two last numbers of the file version and adds a comment. 73 | File foo.dll should already have a version resource. 74 | 75 | verpatch d:\foo.dll "33.44 special release" /pv 1.2.3.4 76 | - same as previous, with additional text in the version argument. 77 | - Product version is also specified 78 | 79 | verpatch d:\foo.dll "1.2.33.44" /va /s description "foo.dll" 80 | /s company "My Company" /s copyright "(c) 2009" 81 | - creates or replaces version resource to foo.dll, with several string values. 82 | ( all options should be one line) 83 | 84 | verpatch d:\foo.dll /vo /xi 85 | - dumps the version resource in RC format, does not update the file. 86 | 87 | 88 | 89 | Remarks 90 | ======= 91 | 92 | In "patch" mode (no /va option), verpatch replaces the version number in existing file 93 | version info resource with the values given on the command line. 94 | The version resource in the file is parsed, then parameters specified on the command line are applied. 95 | 96 | If the file has no version resource, or you want to discard the existing resource, use /va switch. 97 | 98 | Quotes surrounding arguments are needed for the command shell (cmd.exe), 99 | for any argument that contains spaces. 100 | Also other characters should be escaped (ex. &, |, and ^ for cmd.exe). 101 | Null values can be specified as empty string (""). 102 | 103 | The command line can become very long, so you may want to use a batch file or script. 104 | See the example batch files. 105 | 106 | Verpatch can be run on same PE file any number of times. 107 | 108 | The Version argument can be specified as 1 to 4 dot separated decimal numbers. 109 | Additional suffix can follow the version numbers, separated by a dash (-) or space. 110 | If the separator is space, the whole version argument must be enclosed in quotes. 111 | 112 | If the switch /high not specified and less than 4 numbers are given, 113 | they are considered as minor numbers. 114 | The higher version parts are retained from existing version resource. 115 | For example, if the existing version info block has version number 1.2.3.4 116 | and 55.66 specified on the command line, the result will be 1.2.55.66. 117 | 118 | If the switch /high is specified and less than 4 numbers are given, 119 | they are considered as higher numbers. 120 | For example, if the existing version info has version number 1.2.3.4 121 | and 55.66 /high specified on the command line, the result will be 55.66.3.4. 122 | 123 | The /high switch has been added to support the "Semantic Versioning" syntax 124 | as described here: http://semver.org 125 | The "Semantic versioning", however, specifies only 3 parts for the version number, 126 | while Windows version numbers have 4 parts. 127 | Switch /high allows 3-part version numbers with optional "tail" separated by '-' or '+' 128 | but the text representation will not be displayed by Windows Explorer in Vista or newer. 129 | The file version displayed will always have 4 parts. 130 | 131 | 132 | Verpatch ensures that the version numbers in the binary part 133 | of the version structure and in the string part (as text) are same, 134 | or the text string begins with the same numbers as in the binary part. 135 | 136 | By default, Original File Name and Internal File Name are replaced to the actual filename. 137 | Use /fn to preserve existing values in the version resource. 138 | 139 | String attribute names for option /s must be language-neutral, 140 | not translations (example: PrivateBuild, not "Private Build Description"). 141 | See below for the list of known attrbute names and their aliases. 142 | The examples above use the aliases. 143 | 144 | String arguments for File version and Product version parameters are handled 145 | in a special way, the /s switch should not be used to set these: 146 | - The File version can be specified as the 2nd positional argument only 147 | - The Product version can be specified using /pv switch 148 | 149 | 150 | Misc. functions 151 | ================ 152 | 153 | The /rf switch adds a resource from a file, or replaces a resource with same type and id. 154 | 155 | The argument "#id" is a 32-bit hex number, prefixed with #. 156 | Low 16 bits of this value are resource id; can not be 0. 157 | Next 8 bits are resource type: one of RT_xxx symbols in winuser.h, or user defined. 158 | If the type value is 0, RT_RCDATA (10) is assumed. 159 | High 8 bits of the #id arg are reserved0. 160 | The language code of resources added by this switch is 0 (Neutral). 161 | Named resource types and ids are not implemented. 162 | The file is added as opaque binary chunk; the resource size is rounded up to 4 bytes 163 | and padded with zero bytes. 164 | 165 | The program detects extra data appended to executable files, saves it and appends 166 | again after modifying resources. 167 | Command switch /noed disables checking for extra data. 168 | 169 | Such extra data is used by some installers, self-extracting archives and other applications. 170 | However, the way we restore the data may be not compatible with these applications. 171 | Please, verify that executable files that contain extra data work correctly after modification. 172 | Make backup of valuable files before modification. 173 | 174 | 175 | ==================================================================== 176 | Known string keys in VS_VERSION_INFO resource 177 | ==================================================================== 178 | 179 | The aliases in the right column can be used with /s switch, 180 | in place of language-neutral (LN) attribute names. 181 | Attribute names are not case sensitive. 182 | 183 | -------------------+----+-------------------------------+------------ 184 | Lang.Neutral name |note| English translation | Aliases 185 | -------------------+----+-------------------------------+------------ 186 | Comments Comments comment 187 | CompanyName E Company company 188 | FileDescription E Description description, desc 189 | FileVersion *1 File Version 190 | InternalName Internal Name title 191 | *2 Language 192 | LegalCopyright E Copyright copyright, (c) 193 | LegalTrademarks E Legal Trademarks tm, (tm) 194 | OriginalFilename Original File Name 195 | ProductName Product Name product 196 | ProductVersion *1 Product Version pv, productversion, productver, prodver 197 | PrivateBuild Private Build Description pb, private 198 | SpecialBuild Special Build Description sb, build 199 | OleSelfRegister A - 200 | AssemblyVersion N 201 | 202 | Notes 203 | *1: FileVersion, ProductVersion should not be specified with /s switch. 204 | See the command line parameters above. 205 | The string values normally begin with same 1.2.3.4 version number as in the binary header, 206 | but can be any text. Explorer of WinXP also displays File Version text in the strings box. 207 | In Win7 or newer, Explorer displays the version numbers from the binary header only. 208 | 209 | *2: The "Language" value is the name of the language code specified in the header of the 210 | string block of VS_VERSION_INFO resource (or taken from VarFileInfo block?) 211 | It is displayed by Windows XP Explorer. 212 | 213 | E: Displayed by Windows Explorer in Vista+ 214 | A: Intended for some API (OleSelfRegister is used in COM object registration) 215 | N: Added by some .NET compilers. This version number is not contained in the 216 | binary part of the version struct and can differ from the file version. 217 | To change it, use switch /s AssemblyVersion [value]. Note: this will not 218 | change the actual .NET assembly version. 219 | ==================================================================== 220 | 221 | 222 | 223 | Known issues and TO DO's: 224 | ========================= 225 | 226 | - Does not work on old PE files that have link version 5.x (before VC6?) 227 | No known workaround; this seems to be limitation of Windows UpdateResource API. 228 | 229 | - Import of version resource does not work if encoded not in UTF-16. 230 | 231 | - Does not work on files signed with digital certificates (TO DO: warn and remove certificate) 232 | 233 | - A second version resource may be added to a file that already has a version resource 234 | in other language. Switch /va won't help. 235 | TO DO: ensure that a file has only one version resource! 236 | 237 | - When verpatch is invoked from command prompt, or batch file, the string 238 | arguments can contain only ANSI characters, because cmd.exe batch files cannot be 239 | in Unicode format. If you need to include characters not in current locale, 240 | use other shell languages that fully support Unicode (Powershell, vbs, js). 241 | 242 | - TO DO: In RC source output (/vo), special characters in strings are not quoted; 243 | so /vo may produce invalid RC input. 244 | 245 | - The parser of binary version resources handles only the most common type of structure. 246 | If the parser breaks because of unhandled structure format, try /va switch to 247 | skip reading existing version resource and re-create it from scratch. 248 | Consider using WINE or other open source implementations? 249 | 250 | - option to add extra 0 after version strings : "string\0" 251 | (tentative, requested by a reader for some old VB code) 252 | 253 | - For files with extra data appended, checksum is not re-calculated. 254 | Such files usually implement their own integrity check. 255 | 256 | - Switch /va does not prevent import of existing version resource. Revise. 257 | 258 | - When existing version string contains "tail" but the command line parameter does not, 259 | the tail is removed. In previous versions the tail was preserved. 260 | 261 | - Running verpatch on certain executables (esp. built with GNU) produce corrupt file 262 | when run on WinXP SP3, but same binaries give good result when run on Win7 or 2008R2. 263 | (Improvement of UpdateResource API?) 264 | 265 | 266 | Source code 267 | ============ 268 | The source is provided as a Visual C++ 2005 project, it can be compiled with VC 2005, 2008, 2010 Express. 269 | It demonstrates use of the UpdateResource and imagehlp.dll API. 270 | It does not demonstrate good use of C++, coding style or anything else. 271 | Dependencies on VC features available only in paid versions have been removed. 272 | 273 | Verpatch does not require elevation, and may not work correctly if elevated. 274 | Because VC 2005 does not know about requestedExecutionLevel manifest element yet, 275 | we add this element manually from the file "manif.txt". 276 | Without this fix, Windows 7 may decide (erroneously) that verpatch should run elevated. 277 | Ignore VC 2005 warning about the unknown manifest element. 278 | After upgrade to VC 2008 or later, this fix can be removed, instead just specify AsInvoker in the project settings. 279 | 280 | 281 | LICENSE TERMS: CPOL (CodeProject Open License) 282 | http://www.codeproject.com/info/licenses.aspx 283 | 284 | ~~ 285 | -------------------------------------------------------------------------------- /Vagrantfile-ConEmu.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | 434 | 435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 | 454 | 455 | 456 | 457 | 458 | 459 | 460 | 461 | 462 | 463 | 464 | 465 | 466 | 467 | 468 | 469 | 470 | 471 | 472 | 473 | 474 | 475 | 476 | 477 | 478 | 479 | 480 | 481 | 482 | 483 | 484 | 485 | 486 | 487 | 488 | 489 | 490 | 491 | 492 | 493 | 494 | 495 | 496 | 497 | 498 | 499 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 509 | 510 | 511 | 512 | 513 | 514 | 515 | 516 | 517 | 518 | 519 | 520 | 521 | 522 | 523 | 524 | 525 | 526 | 527 | 528 | 529 | 530 | 531 | 532 | 533 | 534 | 535 | 536 | 537 | 538 | 539 | 540 | 541 | 542 | 543 | 544 | 545 | 546 | 547 | 548 | 549 | 550 | 551 | 552 | 553 | 554 | 555 | 556 | 557 | 558 | 559 | 560 | 561 | 562 | 563 | 564 | 565 | 566 | 567 | 568 | 569 | 570 | 571 | 572 | 573 | 574 | 575 | 576 | 577 | 578 | 579 | 580 | 581 | 582 | 583 | 584 | 585 | 586 | 587 | 588 | 589 | 590 | 591 | 592 | 593 | 594 | 595 | 596 | 597 | 598 | 599 | 600 | 601 | 602 | 603 | 604 | 605 | 606 | 607 | 608 | 609 | 610 | 611 | 612 | 613 | 614 | 615 | 616 | 617 | 618 | 619 | 620 | 621 | 622 | 623 | 624 | 625 | 626 | 627 | 628 | 629 | 630 | 631 | 632 | 633 | 634 | 635 | 636 | 637 | 638 | 639 | 640 | 641 | 642 | 643 | 644 | 645 | 646 | 647 | 648 | 649 | 650 | 651 | 652 | 653 | 654 | 655 | 656 | 657 | 658 | 659 | 660 | 661 | 662 | 663 | 664 | 665 | 666 | 667 | 668 | 669 | 670 | 671 | 672 | 673 | 674 | 675 | 676 | 677 | 678 | 679 | 680 | 681 | 682 | 683 | 684 | 685 | 686 | 687 | 688 | 689 | 690 | 691 | --------------------------------------------------------------------------------