summaryrefslogtreecommitdiff
path: root/deps/acore/mysql-tools/shared-def
blob: 7404393d2ba950d855dbfd461f7f19ea90721095 (plain)
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
#!/bin/bash
#
# * Copyright (C) 2007 - 2015 Hyperweb2 All rights reserved.
# * GNU General Public License version 3; see www.hyperweb2.com/terms/

MYSQL="mysql"
MYSQLIMPORT="mysqlimport"
MYSQLDUMP="mysqldump"
DUMPPARSER=$MT_DIR"/bin/dump-parser"

if [[ $(uname -s) == "Darwin" ]]; then
    DUMPPARSER=$MT_DIR"/bin/dump-parser-mac"
fi;

#empty for bash commands
WIN_BIN=0
command -v mysql >/dev/null 2>&1 || { WIN_BIN=1; }
command -v mysqlimport >/dev/null 2>&1 || { WIN_BIN=1; }
command -v mysqldump >/dev/null 2>&1 || { WIN_BIN=1; }

WIN_BIN=1
if [[ $(uname -s) == "Linux" ]] || [[ $(uname -s) == "Darwin" ]]; then
   WIN_BIN=0
else
   WIN_BIN=1 
fi;

if (($WIN_BIN != 0)); then
	MYSQL=$MT_DIR"/bin/$MYSQL"
	MYSQLIMPORT=$MT_DIR"/bin/$MYSQLIMPORT"
	MYSQLDUMP=$MT_DIR"/bin/$MYSQLDUMP"
fi;

OPTS=
[ ! -z "$MYSQL_USER" ] && OPTS+=" -u $MYSQL_USER"
[ ! -z "$MYSQL_PASS" ] && OPTS+=" -p$MYSQL_PASS"
[ ! -z "$MYSQL_HOST" ] && OPTS+=" -h $MYSQL_HOST"
[ ! -z "$MYSQL_SOCK" ] && OPTS+=" -S $MYSQL_SOCK"