From c9eaeaee48f190dc1c52a8303962ab155a78fd4b Mon Sep 17 00:00:00 2001 From: rico666 Date: Mon, 9 Apr 2018 11:01:53 +0200 Subject: [PATCH] New Release: 2.0.4 - bugfixes in solo mining capability - async/sync repairs for frontend (due to new jQuery) - mariaDB/H2 bootstrap handling in burst.sh (Unix) - DB robustness (ensuring InnoDB) --- burst.sh | 74 ++++++++++++++++++++++++ html/ui/index.html | 2 +- html/ui/js/brs.contacts.js | 2 +- html/ui/js/brs.server.js | 16 ++++- html/ui/locales/fr.json | 4 +- init-mysql.sql | 6 -- pom.xml | 2 +- src/brs/BlockchainProcessorImpl.java | 1 + src/brs/Burst.java | 2 +- src/brs/db/mariadb/MariadbDbVersion.java | 48 +++++++-------- src/brs/db/sql/EntitySqlTable.java | 1 + 11 files changed, 119 insertions(+), 39 deletions(-) diff --git a/burst.sh b/burst.sh index 1cbf26b01..4a7645a4e 100755 --- a/burst.sh +++ b/burst.sh @@ -6,6 +6,8 @@ MY_SELF=$0 MY_CMD=$1 MY_ARG=$2 +MY_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) + function usage() { cat << EOF usage: $0 [command] [arguments] @@ -14,6 +16,7 @@ usage: $0 [command] [arguments] help shows the help you just read compile compile jar and create docs using maven upgrade upgrade the config files to BRS format + import [mariadb|h2] DELETE current DB, then gets a new mariadb or H2 EOF } @@ -132,6 +135,18 @@ function upgrade_conf () { fi } +function exists_or_get { + if [ -f $1 ]; then + echo "$1 already present - won't download" + else + if ! hash wget 2>/dev/null; then + echo "please install wget" + exit 99 + fi + wget https://download.cryptoguru.org/burst/wallet/$1 + fi +} + if [ -z `which java 2>/dev/null` ]; then echo "please install java from eg. https://java.com/download/" exit 1 @@ -176,6 +191,65 @@ if [[ $# -gt 0 ]] ; then upgrade_conf nxt-default.properties upgrade_conf nxt.properties ;; + "import") + if ! hash unzip 2>/dev/null; then + echo "please install unzip" + exit 99 + fi + read -p "Do you want to remove the current databases, download and import new one? " -n 1 -r + echo + if [[ $REPLY =~ ^[Yy]$ ]]; then + if [[ $2 == "mariadb" ]]; then + echo + echo "Please enter your connection details" + read -rp "Host (localhost) : " P_HOST + read -rp "Database (brs_master): " P_DATA + read -rp "Username (brs_user) : " P_USER + read -rsp "Password empty : " P_PASS + [ -z $P_HOST ] && P_HOST="localhost" + [ -z $P_USER ] && P_USER="brs_user" + [ -z $P_DATA ] && P_DATA="brs_master" + [ -z $P_PASS ] || P_PASS="-p$P_PASS" + echo + + if exists_or_get brs.mariadb.zip ; then + if unzip brs.mariadb.zip ; then + if mysql -u$P_USER $P_PASS -h$P_HOST -e "DROP DATABASE if EXISTS $P_DATA; CREATE DATABASE $P_DATA CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;"; then + if mysql -u$P_USER $P_PASS -h$P_HOST -D $P_DATA < "$MY_DIR/init-mysql.sql"; then + if mysql -u$P_USER $P_PASS -h$P_HOST -D $P_DATA < brs.mariadb.sql ; then + echo "import successful - please remove brs.mariadb.zip" + rm brs.mariadb.sql + exit + fi + fi + fi + else + echo "unpacking mariadb archive failed" + fi + else + echo "getting mariadb archive failed" + fi + elif [[ $2 == "h2" ]]; then + if exists_or_get brs.h2.zip ; then + mkdir -p "$MY_DIR/burst_db" + rm -f burst_db/burst.trace.db + if unzip brs.h2.zip ; then + if mv burst.mv.db "$MY_DIR/burst_db"; then + echo "import successful - please remove brs.h2.zip" + exit + fi + else + echo "unpacking H2 archive failed" + fi + else + echo "getting H2 archive failed" + fi + fi + echo "DB import did not succeed" + else + echo "cancelling DB import by user request" + fi + ;; "h2shell") java -cp burst.jar org.h2.tools.Shell ;; diff --git a/html/ui/index.html b/html/ui/index.html index 5bb01af67..83139c2cc 100644 --- a/html/ui/index.html +++ b/html/ui/index.html @@ -481,7 +481,7 @@