Skip to content

Commit 3dc6f04

Browse files
committed
MDEV-15693 Stop packaging data directory into ZIPs
Remove CMake INSTALL command for COMPONENT DataFiles. mysql_install_db.exe will calculate default datadir, so that it can be called without any parameters.
1 parent 2e6d8fc commit 3dc6f04

File tree

2 files changed

+23
-9
lines changed

2 files changed

+23
-9
lines changed

sql/CMakeLists.txt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -448,12 +448,6 @@ IF(WIN32 AND TARGET mysqld AND NOT CMAKE_CROSSCOMPILING)
448448
ALL
449449
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/initdb.dep
450450
)
451-
INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/data DESTINATION .
452-
COMPONENT DataFiles
453-
PATTERN "initdb.dep" EXCLUDE
454-
PATTERN "bootstrap.sql" EXCLUDE
455-
PATTERN "aria*" EXCLUDE
456-
)
457451
ELSE()
458452
# Not windows or cross compiling, just install an empty directory
459453
INSTALL(FILES ${DUMMY_FILE} DESTINATION data/mysql COMPONENT DataFiles)

sql/mysql_install_db.cc

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ struct IUnknown;
3939

4040
extern "C" const char* mysql_bootstrap_sql[];
4141

42-
char default_os_user[]= "NT AUTHORITY\\NetworkService";
42+
static char default_os_user[]= "NT AUTHORITY\\NetworkService";
43+
static char default_datadir[MAX_PATH];
4344
static int create_db_instance();
4445
static uint opt_silent;
4546
static char datadir_buffer[FN_REFLEN];
@@ -169,8 +170,27 @@ int main(int argc, char **argv)
169170
exit(error);
170171
if (!opt_datadir)
171172
{
172-
my_print_help(my_long_options);
173-
die("parameter --datadir=# is mandatory");
173+
/*
174+
Figure out default data directory. It "data" directory, next to "bin" directory, where
175+
mysql_install_db.exe resides.
176+
*/
177+
strcpy(default_datadir, self_name);
178+
p = strrchr(default_datadir, FN_LIBCHAR);
179+
if (p)
180+
{
181+
*p= 0;
182+
p= strrchr(default_datadir, FN_LIBCHAR);
183+
if (p)
184+
*p= 0;
185+
}
186+
if (!p)
187+
{
188+
die("--datadir option not provided, and default datadir not found");
189+
my_print_help(my_long_options);
190+
}
191+
strncat(default_datadir, "\\data", sizeof(default_datadir));
192+
opt_datadir= default_datadir;
193+
printf("Default data directory is %s\n",opt_datadir);
174194
}
175195

176196
/* Print some help on errors */

0 commit comments

Comments
 (0)