forked from Percona-QA/package-testing
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_binary_tarball.sh
executable file
·93 lines (80 loc) · 3.08 KB
/
test_binary_tarball.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
93
#!/bin/bash
if [ "$#" -ne 1 ]; then
echo "This script requires the product parameter: pxb24, pxb80!"
echo "Usage: ./$0 <product>"
exit 1
fi
SCRIPT_PWD=$(cd `dirname $0` && pwd)
#SCRIPT_PWD="$HOME/package-testing"
log="/tmp/binary_check.log"
>${log}
source ${SCRIPT_PWD}/VERSIONS
if [ $1 = "pxb80" ]; then
product=pxb80
version=${PXB80_VER}
major_version=$(echo ${version}| cut -f1-2 -d.)
minor_version=$(echo ${version}|cut -f3 -d.)
if [ -f /etc/redhat-release ]; then
lib="libgcrypt145"
else
lib="libgcrypt20"
fi
echo "Downloading ${1} latest version..." >> "${log}"
wget https://www.percona.com/downloads/Percona-XtraBackup-LATEST/Percona-XtraBackup-${major_version}-${minor_version}/binary/tarball/percona-xtrabackup-${version}-Linux-x86_64.${lib}.tar.gz
tarball_dir="percona-xtrabackup-${version}-Linux-x86_64"
echo "Extracting binary" >> "${log}"
tar -xf percona-xtrabackup-${version}-Linux-x86_64.${lib}.tar.gz
mv ${tarball_dir} ${product}
tarball_dir=${product}
exec_files="xbcloud xbcrypt xbstream xtrabackup"
elif [ $1 = "pxb24" ]; then
product=pxb24
version=${PXB24_VER}
if [ -f /etc/redhat-release ]; then
lib="libgcrypt145"
else
lib="libgcrypt20"
fi
echo "Downloading ${1} latest version..." >> "${log}"
wget https://www.percona.com/downloads/Percona-XtraBackup-2.4/Percona-XtraBackup-${version}/binary/tarball/percona-xtrabackup-${version}-Linux-x86_64.${lib}.tar.gz
tarball_dir="percona-xtrabackup-${version}-Linux-x86_64"
echo "Extracting binary" >> "${log}"
tar -xf percona-xtrabackup-${version}-Linux-x86_64.${lib}.tar.gz
mv ${tarball_dir} ${product}
tarball_dir=${product}
exec_files="xbcloud xbcrypt xbstream xtrabackup innobackupex"
else
echo "Incorrect product selected!"
exit 1
fi
echo "Check symlinks for all executables" >> "${log}"
for binary in $exec_files; do
echo "Check ${tarball_dir}/bin/${binary}" >> "${log}"
ldd ${tarball_dir}/bin/${binary} | grep "not found"
if [ "$?" -eq 0 ]; then
echo "Err: Binary $binary in $tarball, version ${version} has an incorrect linked library"
exit 1
else
echo "Binary $binary check passed" >> "${log}"
fi
done
if [ ${product} = "pxb23" -o ${product} = "pxb24" -o ${product} = "pxb80" ]; then
version_check=$(${tarball_dir}/bin/xtrabackup --version 2>&1|grep -c ${version})
if [ ${version_check} -eq 0 ]; then
echo "${product} xtrabackup version is incorrect! Expected version: ${version}"
exit 1
else
echo "${product} xtrabackup version is correctly displayed as: ${version}" >> "${log}"
fi
if [ ${product} = "pxb80" ]; then
for i in xbstream xbcloud xbcrypt; do
version_check=$(${tarball_dir}/bin/$i --help | grep -c "${version}")
if [ "${version_check}" -eq 0 ]; then
echo "${i} version is incorrect! Expected version: ${version}"
exit 1
else
echo "${i} version is correctly displayed as: ${version}" >> "${log}"
fi
done
fi
fi