From bd46a03bfc9987d4f04d5aca8f3a8cc6930c0848 Mon Sep 17 00:00:00 2001 From: gumi Date: Fri, 21 Sep 2018 11:31:58 -0400 Subject: add an auto-setup script for mariadb on windows --- tools/install_mariadb.bat | 7 ++++ tools/setup_mariadb.ps1 | 90 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 97 insertions(+) create mode 100644 tools/install_mariadb.bat create mode 100644 tools/setup_mariadb.ps1 (limited to 'tools') diff --git a/tools/install_mariadb.bat b/tools/install_mariadb.bat new file mode 100644 index 000000000..cfe2ce3b7 --- /dev/null +++ b/tools/install_mariadb.bat @@ -0,0 +1,7 @@ +@echo off + +:: this file installs the mariadb service + +if not "%1"=="am_admin" (powershell start -verb runas '%0' am_admin & exit /b) +mysqld.exe --install "MySQL" +net start MySQL diff --git a/tools/setup_mariadb.ps1 b/tools/setup_mariadb.ps1 new file mode 100644 index 000000000..709a5cf93 --- /dev/null +++ b/tools/setup_mariadb.ps1 @@ -0,0 +1,90 @@ +#Requires -Version 5.1 + +function Ask-Continue { Write-Output ""; pause; Write-Output "" } + +Write-Output "This script will automatically install MariaDB and configure it for you." +Write-Output "You may interrupt the installation by pressing CTRL+C or closing this window." +Ask-Continue + +if (-Not (Select-String -Quiet -SimpleMatch -Pattern "db_password: ""ragnarok""" -LiteralPath "$PSScriptRoot\..\conf\global\sql_connection.conf")) { + Write-Output "WARNING: It seems you already configured the sql connection for your server." + Write-Output "If you decide to continue, your settings will be overwritten." + Ask-Continue +} + +# step 1: install scoop +if (-Not (Get-Command scoop -errorAction SilentlyContinue)) { + Set-ExecutionPolicy RemoteSigned -scope Process -Force # <= this will trigger a yes/no prompt if not already authorized + Invoke-Expression (new-object net.webclient).downloadstring('https://get.scoop.sh') + scoop update +} + +# step 2: install mariadb +if (Test-Path $env:USERPROFILE\scoop\apps\mariadb) { + # usually we'd want to capture the output of "scoop list mariadb", but it uses + # Write-Host, so we can't, hence why we check manually for the folder + Write-Output "WARNING: MariaDB is already installed!" + Write-Output "If you decide to continue, your hercules user password will be overwritten." + Ask-Continue +} elseif (Get-Command mysqld -errorAction SilentlyContinue) { + Write-Output "ERROR: You already have a MySQL provider installed. To avoid conflict, MariaDB will not be installed." + Write-Output "If you wish to continue you will have to uninstall your current MySQL provider." + exit 1 +} else { + scoop install mariadb +} + +# step 3: add the herc user, set up the new database +$userpw = -join ((48..57) + (97..122) | Get-Random -Count 32 | % {[char]$_}) +$rootpw = -join ((48..57) + (97..122) | Get-Random -Count 32 | % {[char]$_}) +$maria_job = Start-Process -NoNewWindow -FilePath "mysqld.exe" -ArgumentList "--console" -PassThru -RedirectStandardError "$PSScriptRoot\maria.out" + +while (-Not $maria_job.HasExited) { + if ($lt -Lt 1 -And (Select-String -Quiet -SimpleMatch -Pattern "ready for connections" -LiteralPath "$PSScriptRoot\maria.out")) { +@" +CREATE DATABASE IF NOT EXISTS hercules; +DROP USER IF EXISTS 'hercules'@'localhost'; +DROP USER IF EXISTS 'hercules'@'127.0.0.1'; +CREATE USER 'hercules'@'localhost' IDENTIFIED BY '$userpw'; +CREATE USER 'hercules'@'127.0.0.1' IDENTIFIED BY '$userpw'; +-- ALTER USER 'root'@'localhost' IDENTIFIED BY '$rootpw'; +GRANT ALTER,CREATE,SELECT,INSERT,UPDATE,DELETE,DROP,INDEX ON `hercules`.* TO 'hercules'@'localhost'; +GRANT ALTER,CREATE,SELECT,INSERT,UPDATE,DELETE,DROP,INDEX ON `hercules`.* TO 'hercules'@'127.0.0.1'; +FLUSH PRIVILEGES; +USE `hercules`; +\. $PSScriptRoot\..\sql-files\main.sql +\. $PSScriptRoot\..\sql-files\logs.sql +shutdown; +\q +"@ | mysql.exe -u root + $lt++ + } + Start-Sleep 1 +} + +if ($lt -Lt 1) { + Write-Output "ERROR: MariaDB could not execute the query." + Write-Output "This might happen if your root user already has a password, or if the MySQL service is currently running." + $maria_job.close() + exit 1 +} + +# step 4: finish up +@" +sql_connection: { + db_username: "hercules" + db_password: "$userpw" + db_database: "hercules" +} +"@ | Out-File -Encoding UTF8 -LiteralPath "$PSScriptRoot\..\conf\global\sql_connection.conf" +Remove-Item -Force -errorAction SilentlyContinue "$PSScriptRoot\maria.out" +& "$PSScriptRoot\install_mariadb.bat" # <= we need admin permissions, so we use an external script +Write-Output "========= ALL DONE =========" +Write-Output "" +Write-Output "Your hercules installation is now configured to use MariaDB." +Write-Output "You can find the password in conf\global\sql_connection.conf." +Write-Output "" +Write-Output "If you want to start MariaDB on boot, use services.msc and set ""MySQL"" to Automatic." +Write-Output "" +Write-Output "Make sure you set a password for the root user. You can do this from the command line or from HeidiSQL." +Write-Output "You can obtain HeidiSQL at https://www.microsoft.com/store/productId/9NXPRT2T0ZJF" -- cgit v1.2.3-70-g09d2 From ab72d50b10b382d1256ccef6c945df0e1562b4a8 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 25 Feb 2019 00:40:12 +0300 Subject: Show crash dump in travis --- .travis.yml | 11 +++++++++++ tools/ci/travis.sh | 8 +++++++- 2 files changed, 18 insertions(+), 1 deletion(-) (limited to 'tools') diff --git a/.travis.yml b/.travis.yml index a9bea834d..f5f11e19b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,6 +11,7 @@ install: before_script: - uname -a + - ulimit -c unlimited -S - ./tools/ci/travis.sh createdb ragnarok root - ./tools/ci/travis.sh importdb ragnarok root - ./tools/ci/travis.sh adduser ragnarok travis travis root @@ -44,6 +45,7 @@ matrix: sources: - ubuntu-toolchain-r-test packages: + - gdb - gcc-6 - doxygen - libxml-simple-perl @@ -57,6 +59,7 @@ matrix: - llvm-toolchain-trusty-5.0 - ubuntu-toolchain-r-test packages: + - gdb - clang-5.0 - compiler: clang env: CONFIGURE_FLAGS="--enable-debug CC=clang-5.0 --disable-renewal --enable-Werror --enable-buildbot" @@ -66,6 +69,7 @@ matrix: - llvm-toolchain-trusty-5.0 - ubuntu-toolchain-r-test packages: + - gdb - clang-5.0 - compiler: clang env: CONFIGURE_FLAGS="--enable-debug CC=clang-4.0 --enable-Werror --enable-packetver=20190123 --enable-packetver-re --enable-buildbot" @@ -75,6 +79,7 @@ matrix: - llvm-toolchain-trusty-4.0 - ubuntu-toolchain-r-test packages: + - gdb - clang-4.0 - compiler: clang env: CONFIGURE_FLAGS="--enable-debug CC=clang-4.0 --enable-Werror --enable-packetver=20130724 --enable-packetver-re --enable-buildbot" @@ -84,6 +89,7 @@ matrix: - llvm-toolchain-trusty-4.0 - ubuntu-toolchain-r-test packages: + - gdb - clang-4.0 - compiler: clang env: CONFIGURE_FLAGS="--enable-debug CC=clang-4.0 --disable-renewal --enable-Werror --enable-buildbot" @@ -93,6 +99,7 @@ matrix: - llvm-toolchain-trusty-4.0 - ubuntu-toolchain-r-test packages: + - gdb - clang-4.0 - compiler: clang env: CONFIGURE_FLAGS="--enable-debug --enable-Werror --enable-buildbot" @@ -109,6 +116,7 @@ matrix: sources: - ubuntu-toolchain-r-test packages: + - gdb - gcc-5 - compiler: gcc env: LDFLAGS="-fuse-ld=gold" CONFIGURE_FLAGS="--enable-debug --enable-sanitize=full CC=gcc-5 --disable-manager --disable-renewal --enable-Werror --enable-buildbot" @@ -117,6 +125,7 @@ matrix: sources: - ubuntu-toolchain-r-test packages: + - gdb - gcc-5 - compiler: gcc env: LDFLAGS="-fuse-ld=gold" CONFIGURE_FLAGS="--enable-debug --enable-sanitize=full CC=gcc-6 --disable-manager --enable-Werror --enable-packetver=20190123 --enable-packetver-re --enable-buildbot" @@ -125,6 +134,7 @@ matrix: sources: - ubuntu-toolchain-r-test packages: + - gdb - gcc-6 - compiler: gcc env: LDFLAGS="-fuse-ld=gold" CONFIGURE_FLAGS="--enable-debug --enable-sanitize=full CC=gcc-6 --disable-manager --disable-renewal --enable-Werror --enable-buildbot" @@ -133,6 +143,7 @@ matrix: sources: - ubuntu-toolchain-r-test packages: + - gdb - gcc-6 notifications: diff --git a/tools/ci/travis.sh b/tools/ci/travis.sh index fa7d5be93..22f523bdf 100755 --- a/tools/ci/travis.sh +++ b/tools/ci/travis.sh @@ -47,7 +47,8 @@ function aborterror { function run_server { echo "Running: $1 --run-once $2" - $1 --run-once $2 2>runlog.txt + rm -rf core* || true + CRASH_PLEASE=1 $1 --run-once $2 2>runlog.txt export errcode=$? export teststr=$(head -c 10000 runlog.txt) if [[ -n "${teststr}" ]]; then @@ -59,12 +60,17 @@ function run_server { fi if [ ${errcode} -ne 0 ]; then echo "server $1 terminated with exit code ${errcode}" + COREFILE=$(find . -maxdepth 1 -name "core*" | head -n 1) + if [[ -f "$COREFILE" ]]; then + gdb -c "$COREFILE" $1 -ex "thread apply all bt" -ex "set pagination 0" -batch + fi aborterror "Test failed" fi } function run_test { echo "Running: test_$1" + sysctl -w kernel.core_pattern=core || true ./test_$1 2>runlog.txt export errcode=$? export teststr=$(head -c 10000 runlog.txt) -- cgit v1.2.3-70-g09d2 From c9abf7108f3bd2bde0a7fa2a54eaec6898710195 Mon Sep 17 00:00:00 2001 From: Phong Truong Date: Tue, 16 Apr 2019 08:34:18 +0700 Subject: Fixed issue with Perl v5.26.1 Issue: - Unescaped left brace in regex is illegal here in regex; --- tools/itemdbconverter.pl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tools') diff --git a/tools/itemdbconverter.pl b/tools/itemdbconverter.pl index 58cb08bc1..fe30ce24e 100755 --- a/tools/itemdbconverter.pl +++ b/tools/itemdbconverter.pl @@ -109,9 +109,9 @@ sub parsedb (@) { (?[0-9]*)[^,:]*(?:[\s\t]*(?[0-9]*))?[^,]*,[\s\t]* (?[0-9]*)[^,]*,[\s\t]* (?[0-9]*)[^,]*,[\s\t]* - {(?