372
370
fs::path base_plugin_dir(PKGPLUGINDIR);
374
po::options_description config_options("Config File Options");
375
po::options_description long_options("Kernel Options");
376
po::options_description plugin_load_options("Plugin Loading Options");
377
po::options_description plugin_options("Plugin Options");
378
po::options_description initial_options("Config and Plugin Loading");
379
po::options_description full_options("Kernel and Plugin Loading and Plugin");
372
po::options_description config_options(_("Config File Options"));
373
po::options_description long_options(_("Kernel Options"));
374
po::options_description plugin_load_options(_("Plugin Loading Options"));
375
po::options_description plugin_options(_("Plugin Options"));
376
po::options_description initial_options(_("Config and Plugin Loading"));
377
po::options_description full_options(_("Kernel and Plugin Loading and Plugin"));
380
378
vector<string> unknown_options;
381
379
vector<string> defaults_file_list;
382
380
po::variables_map vm;
390
std::string &getGlobHostname()
392
static std::string glob_hostname("localhost");
393
return glob_hostname;
396
void setServerHostname(const std::string &hostname)
398
getGlobHostname()= hostname;
402
const std::string &getServerHostname()
404
return getGlobHostname();
390
407
/****************************************************************************
391
408
** Code to end drizzled
652
669
static void find_plugin_dir(string progname)
654
if (progname[0] != FN_LIBCHAR)
656
/* We have a relative path and need to find the absolute */
657
char working_dir[FN_REFLEN];
658
char *working_dir_ptr= working_dir;
659
working_dir_ptr= getcwd(working_dir_ptr, FN_REFLEN);
660
string new_path(working_dir);
661
if (*(new_path.end()-1) != '/')
662
new_path.push_back('/');
663
if (progname[0] == '.' && progname[1] == '/')
664
new_path.append(progname.substr(2));
666
new_path.append(progname);
667
progname.swap(new_path);
670
/* Now, trim off the exe name */
671
string progdir(progname.substr(0, progname.rfind(FN_LIBCHAR)+1));
672
if (progdir.rfind(".libs/") != string::npos)
674
progdir.assign(progdir.substr(0, progdir.rfind(".libs/")));
676
string testlofile(progdir);
677
testlofile.append("drizzled.lo");
678
string testofile(progdir);
679
testofile.append("drizzled.o");
680
struct stat testfile_stat;
681
if (not (stat(testlofile.c_str(), &testfile_stat) && stat(testofile.c_str(), &testfile_stat)))
671
fs::path full_progname(fs::system_complete(progname));
673
fs::path progdir(full_progname.parent_path());
674
if (progdir.filename() == ".libs")
676
progdir= progdir.parent_path();
679
if (fs::exists(progdir / "drizzled.lo") || fs::exists(progdir / "drizzled.o"))
683
681
/* We are in a source dir! Plugin dir is ../plugin/.libs */
684
size_t last_libchar_pos= progdir.rfind(FN_LIBCHAR,progdir.size()-2)+1;
685
base_plugin_dir= progdir.substr(0,last_libchar_pos);
682
base_plugin_dir= progdir.parent_path();
686
683
base_plugin_dir /= "plugin";
687
684
base_plugin_dir /= ".libs";
1107
1104
global_system_variables.time_zone= my_tz_SYSTEM;
1109
if (gethostname(glob_hostname,sizeof(glob_hostname)) < 0)
1106
char ret_hostname[FN_REFLEN];
1107
if (gethostname(ret_hostname,sizeof(ret_hostname)) < 0)
1111
strncpy(glob_hostname, STRING_WITH_LEN("localhost"));
1112
errmsg_printf(error::WARN, _("gethostname failed, using '%s' as hostname"),
1109
errmsg_printf(error::WARN,
1110
_("gethostname failed, using '%s' as hostname"),
1111
getServerHostname().c_str());
1114
1112
pid_file= "drizzle";
1118
pid_file= glob_hostname;
1116
setServerHostname(ret_hostname);
1117
pid_file= getServerHostname();
1120
1119
pid_file.replace_extension(".pid");