diff options
author | Vladislav Vaintroub <wlad@montyprogram.com> | 2011-02-04 12:20:41 +0100 |
---|---|---|
committer | Vladislav Vaintroub <wlad@montyprogram.com> | 2011-02-04 12:20:41 +0100 |
commit | 614a6dfcd4320600762a9bf39587c4df08a3d9af (patch) | |
tree | 22795e1d2456f7e002448f5aadfba13c4acd21ff /sql/mysql_upgrade_service.cc | |
parent | edf9757cb846f494e75efe297b863a1a7613976d (diff) | |
download | mariadb-git-614a6dfcd4320600762a9bf39587c4df08a3d9af.tar.gz |
MWL#55: Handle cases where service was installed with
mysqld --install without any parameters.
In such case, service name is always MYSQL, as service
binary path is "path\to\mysqld.exe" "MySQL". Guess data
directory it is either from my.ini (which is assumed to
be in the installation root), or just data directory
under install root.
Diffstat (limited to 'sql/mysql_upgrade_service.cc')
-rw-r--r-- | sql/mysql_upgrade_service.cc | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/sql/mysql_upgrade_service.cc b/sql/mysql_upgrade_service.cc index 0a77608f710..fa5369346e2 100644 --- a/sql/mysql_upgrade_service.cc +++ b/sql/mysql_upgrade_service.cc @@ -36,8 +36,8 @@ #pragma comment(lib, "version") #define USAGETEXT \ -"mysql_upgrade_service.exe Ver 1.42 for Windows\n" \
-"This software comes with ABSOLUTELY NO WARRANTY. This is free software,\n" \
+"mysql_upgrade_service.exe Ver 1.42 for Windows\n" \ +"This software comes with ABSOLUTELY NO WARRANTY. This is free software,\n" \ "and you are welcome to modify and redistribute it under the GPL v2 license\n" \ "Usage: mysql_upgrade_service.exe [OPTIONS]\n" \ "OPTIONS:" @@ -371,6 +371,30 @@ static void change_service_config() my_major, my_minor); } + if(props.inifile[0] == 0) + { + /* + Weird case, no --defaults-file in service definition, need to create one. + */ + char buf[MAX_PATH]; + int i; + + sprintf_s(props.inifile, MAX_PATH, "%s\\my.ini", props.datadir); + + /* + Write datadir to my.ini, after converting backslashes to + unix style slashes. + */ + strcpy_s(buf, MAX_PATH, props.datadir); + for(i=0; buf[i]; i++) + { + if (buf[i] == '\\') + buf[i]= '/'; + } + + WritePrivateProfileString("mysqld", "datadir",buf, props.inifile); + } + /* Remove basedir from defaults file, otherwise the service wont come up in the new version, and will complain about mismatched message file. |