Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
vaintroub committed Feb 19, 2019
1 parent 2e6d8fc commit 3dc6f04
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 9 deletions.
6 changes: 0 additions & 6 deletions sql/CMakeLists.txt
Expand Up @@ -448,12 +448,6 @@ IF(WIN32 AND TARGET mysqld AND NOT CMAKE_CROSSCOMPILING)
ALL
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/initdb.dep
)
INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/data DESTINATION .
COMPONENT DataFiles
PATTERN "initdb.dep" EXCLUDE
PATTERN "bootstrap.sql" EXCLUDE
PATTERN "aria*" EXCLUDE
)
ELSE()
# Not windows or cross compiling, just install an empty directory
INSTALL(FILES ${DUMMY_FILE} DESTINATION data/mysql COMPONENT DataFiles)
Expand Down
26 changes: 23 additions & 3 deletions sql/mysql_install_db.cc
Expand Up @@ -39,7 +39,8 @@ struct IUnknown;

extern "C" const char* mysql_bootstrap_sql[];

char default_os_user[]= "NT AUTHORITY\\NetworkService";
static char default_os_user[]= "NT AUTHORITY\\NetworkService";
static char default_datadir[MAX_PATH];
static int create_db_instance();
static uint opt_silent;
static char datadir_buffer[FN_REFLEN];
Expand Down Expand Up @@ -169,8 +170,27 @@ int main(int argc, char **argv)
exit(error);
if (!opt_datadir)
{
my_print_help(my_long_options);
die("parameter --datadir=# is mandatory");
/*
Figure out default data directory. It "data" directory, next to "bin" directory, where
mysql_install_db.exe resides.
*/
strcpy(default_datadir, self_name);
p = strrchr(default_datadir, FN_LIBCHAR);
if (p)
{
*p= 0;
p= strrchr(default_datadir, FN_LIBCHAR);
if (p)
*p= 0;
}
if (!p)
{
die("--datadir option not provided, and default datadir not found");
my_print_help(my_long_options);
}
strncat(default_datadir, "\\data", sizeof(default_datadir));
opt_datadir= default_datadir;
printf("Default data directory is %s\n",opt_datadir);
}

/* Print some help on errors */
Expand Down

0 comments on commit 3dc6f04

Please sign in to comment.