Skip to content

Commit dfbbbc6

Browse files
committed
On Linux when creating mysql.cfg file set file permissions, so mysql would not complain
On all platforms if mycql.cfg file existed - do not remove it allowing for customization
1 parent a456755 commit dfbbbc6

File tree

3 files changed

+34
-7
lines changed

3 files changed

+34
-7
lines changed

build-release.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ YELLOW=''
3535
readonly ALL_OFF BOLD BLUE GREEN RED YELLOW
3636
ARCH_INSTALLS="${ARCH_INSTALLS:-win32 win64 linux}"
3737

38+
if not command -v cmake >/dev/null 2>&1; then
39+
print_error "No cmake found - please, install"
40+
exit 1
41+
fi
42+
3843
for _mingw in ${ARCH_INSTALLS}; do
3944

4045
case ${_mingw} in
@@ -83,7 +88,7 @@ for _mingw in ${ARCH_INSTALLS}; do
8388

8489
(
8590
if [ -z ${_msystem} ]; then
86-
[ -f lib2inpx-${_arch}.xz ] && rm lib2inpx-${_arch}.xz
91+
[ -f lib2inpx-${_arch}-glibc_${_glibc}.tar.xz ] && rm lib2inpx-${_arch}-glibc_${_glibc}.tar.xz
8792

8893
tar --directory ${_dist} --create --xz --file lib2inpx-${_arch}-glibc_${_glibc}.tar.xz .
8994
else

get-maria.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
ver_major=10.1
44
ver_minor=24
55

6+
declare -A checkmap
7+
68
from_url="https://downloads.mariadb.org/interstitial"
79

810
ARCH_INSTALLS="${ARCH_INSTALLS:-win32 win64 linux}"
@@ -14,18 +16,21 @@ for _mingw in ${ARCH_INSTALLS}; do
1416
file=mariadb-${ver_major}.${ver_minor}-${arch}.zip
1517
prefix=i686
1618
packagedir=${arch}-packages
19+
checkmap[${arch}]="3f28aaece4cb00d57fb643873ca4a4b29546cf5852d956094517b36ba8eafba3"
1720
;;
1821
win64)
1922
arch=winx64
2023
file=mariadb-${ver_major}.${ver_minor}-${arch}.zip
2124
prefix=x86_64
2225
packagedir=${arch}-packages
26+
checkmap[${arch}]="cca8b38e640508cd8fa3ba28c872ccc79497d6a74164a1ae9cdd04aaef9ef6cd"
2327
;;
2428
linux)
2529
arch=$(uname -m)
2630
file=mariadb-${ver_major}.${ver_minor}-linux-glibc_214-${arch}.tar.gz
2731
prefix=
2832
packagedir=bintar-linux-glibc_214-${arch}
33+
checkmap[${arch}]="04491b686a83ba994122f5609adb9f86cb5af6275f87bfa4ee6010e2e28db465"
2934
;;
3035
*)
3136
echo "Unsupported environment!"
@@ -39,6 +44,11 @@ for _mingw in ${ARCH_INSTALLS}; do
3944
else
4045
echo "Have ${file} locally."
4146
fi
47+
sum=`sha256sum ${file} | awk '{ print $1; }'`
48+
if [ ${checkmap[${arch}]} != ${sum} ]; then
49+
echo "Bad checksum for ${file}: ${checkmap[${arch}]} != ${sum}"
50+
exit 1
51+
fi
4252

4353
if [ x"${_mingw}" == x"linux" ]; then
4454
[ -d mariadb-${ver_major}.${ver_minor}-linux-glibc_214-${arch} ] && rm -rf mariadb-${ver_major}.${ver_minor}-linux-glibc_214-${arch}
@@ -53,7 +63,7 @@ for _mingw in ${ARCH_INSTALLS}; do
5363
cd mariadb-${ver_major}.${ver_minor}-${arch}
5464
cd lib
5565
for dll in *.dll; do
56-
echo "Creating MINGW import library for ${dll}"
66+
echo "Creating Windows export library for ${dll}"
5767
gendef -a ${dll}
5868
dlltool -d ${dll%.*}.def -l ${dll}.a -k
5969
rm ${dll%.*}.def

lib2inpx/lib2inpx.cpp

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include <direct.h>
55
#else
66
#include <sys/io.h>
7+
#include <sys/stat.h>
78
#endif
89
#include <stdio.h>
910
#include <fcntl.h>
@@ -69,6 +70,8 @@ static bool g_ignore_dump_date = false;
6970
static bool g_clean_when_done = false;
7071
static bool g_verbose = false;
7172

73+
static bool g_mysql_cfg_created = false;
74+
7275
enum checking_type { eFileExt = 0, eFileType, eIgnore };
7376
static checking_type g_strict = eFileExt;
7477

@@ -131,10 +134,10 @@ static const char* dummy = "dummy:"
131134
"\r\n";
132135

133136
#ifdef MARIADB_BASE_VERSION
134-
static const char* options_pattern[] = {"%s", "--defaults-file=%sdata/mysql.ini", "--language=%s/language", "--datadir=%sdata", "--skip-grant-tables", "--innodb_data_home_dir=%sdata/dbtmp_%s",
137+
static const char* options_pattern[] = {"%s", "--defaults-file=%sdata/mysql.cfg", "--language=%s/language", "--datadir=%sdata", "--skip-grant-tables", "--innodb_data_home_dir=%sdata/dbtmp_%s",
135138
"--innodb_log_group_home_dir=%sdata/dbtmp_%s", "--innodb_tmpdir=%sdata/dbtmp_%s", "--log_warnings=2", NULL};
136139
#else
137-
static const char* options_pattern[] = {"%s", "--defaults-file=%sdata/mysql.ini", "--language=%s/language", "--datadir=%sdata", "--skip-grant-tables", "--innodb_data_home_dir=%s/data/dbtmp_%s",
140+
static const char* options_pattern[] = {"%s", "--defaults-file=%sdata/mysql.cfg", "--language=%s/language", "--datadir=%sdata", "--skip-grant-tables", "--innodb_data_home_dir=%s/data/dbtmp_%s",
138141
"--innodb_log_group_home_dir=%sdata/dbtmp_%s", "--innodb_tmpdir=%sdata/dbtmp_%s", "--log_syslog=0", NULL};
139142
#endif
140143

@@ -305,7 +308,7 @@ void prepare_mysql(const char* path, const string& dbname)
305308
fs::create_directories(config.c_str());
306309
}
307310

308-
config = string(path) + "/data/mysql.ini";
311+
config = string(path) + "/data/mysql.cfg";
309312
if (0 != access(config.c_str(), 6)) {
310313
ofstream out(config.c_str());
311314

@@ -316,7 +319,14 @@ void prepare_mysql(const char* path, const string& dbname)
316319
} else {
317320
throw runtime_error(tmp_str("Unable to open file \"%s\"", config.c_str()));
318321
}
322+
g_mysql_cfg_created = true;
323+
}
324+
325+
#ifndef _WIN32
326+
if (g_mysql_cfg_created) {
327+
chmod(config.c_str(), S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
319328
}
329+
#endif
320330

321331
config = string(path) + "/data/dbtmp_" + dbname;
322332
if (0 != access(config.c_str(), 6)) {
@@ -1699,8 +1709,10 @@ int main(int argc, char* argv[])
16991709
string file_to_del = data_dir + "/auto.cnf";
17001710
fs::remove(file_to_del);
17011711

1702-
file_to_del.assign(data_dir + "/mysql.ini");
1703-
fs::remove(file_to_del);
1712+
if (g_mysql_cfg_created) {
1713+
file_to_del.assign(data_dir + "/mysql.cfg");
1714+
fs::remove(file_to_del);
1715+
}
17041716

17051717
#ifdef MARIADB_BASE_VERSION
17061718
file_to_del.assign(data_dir + "/aria_log.00000001");

0 commit comments

Comments
 (0)