forked from Percona-QA/package-testing
-
Notifications
You must be signed in to change notification settings - Fork 0
/
client_check.sh
executable file
·93 lines (83 loc) · 2.49 KB
/
client_check.sh
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
#!/bin/bash
set -e
if [ "$#" -ne 1 ]; then
echo "This script requires product parameter: ps55, ps56, ps57, ps80, pxc56, or pxc57 !"
echo "Usage: ./client_check.sh <prod>"
exit 1
fi
SCRIPT_PWD=$(cd "$(dirname "$0")" && pwd)
source "${SCRIPT_PWD}"/VERSIONS
if [ "$1" = "ps55" ]; then
deb_version="-5.5"
rpm_version="-55"
elif [ "$1" = "ps56" ]; then
deb_version="-5.6"
rpm_version="-56"
elif [ "$1" = "ps57" ]; then
deb_version="-5.7"
rpm_version="-57"
elif [ "$1" = "ps80" ]; then
deb_version=""
rpm_version=""
version=${PS80_VER}
elif [ "$1" = "pxc56" ]; then
deb_version="-5.6"
rpm_version="-56"
elif [ "$1" = "pxc57" ]; then
deb_version="-5.7"
rpm_version="-57"
else
echo "Invalid product selected"
exit 1
fi
product=$1
log="/tmp/${product}_client_check.log"
echo -n > "${log}"
if [ -f /etc/redhat-release ] || [ -f /etc/system-release ]; then
if [ "${product}" = "ps55" ] || [ "${product}" = "ps56" ] || [ "${product}" = "ps57" ]; then
yum install -y Percona-Server-client${rpm_version}
elif [ "${product}" = "ps80" ]; then
yum install -y percona-server-client percona-mysql-router percona-mysql-shell
elif [ "${product}" = "pxc56" ] || [ "${product}" = "pxc57" ]; then
yum install -y Percona-XtraDB-Cluster-client-${rpm_version}
else
echo "client version is incorrect"
exit 1
fi
else
if [ "${product}" = "ps55" ] || [ "${product}" = "ps56" ] || [ "${product}" = "ps57" ]; then
apt-get install -y percona-server-client${deb_version}
elif [ "${product}" = "ps80" ]; then
apt-get install -y percona-server-client percona-mysql-router percona-mysql-shell
elif [ "${product}" = "pxc56" ] || [ "${product}" = "pxc57" ]; then
apt-get install -y percona-xtradb-cluster-client${deb_version}
else
echo "client version is incorrect"
exit 1
fi
fi
if [ "${product}" = "ps80" ]; then
echo "checking client version"
if [ "$(mysql --version | grep -c "$version")" == 1 ]; then
echo "mysql client version is correct"
else
echo "ERROR: mysql-client version is incorrect "
exit 1
fi
echo "checking shell version"
if [ "$(mysqlsh --version | grep -c "$version")" == 1 ]; then
echo "mysql shell version is correct"
else
echo "ERROR: mysql-shell version is incorrect "
exit 1
fi
echo "checking router version"
if [ "$(mysqlrouter --version | grep -c "$version")" == 1 ]; then
echo "mysql router version is correct"
else
echo "ERROR: mysqlrouter version is incorrect "
exit 1
fi
fi
mysql --help
echo $?