public ProcessStartInfo CreateProcessStart(ApplicationConfig application) { var installDirectory = application.Environment.InstallDirectoryOrDefault; return(CreateProcessStartInfo(installDirectory, "mysqld.exe", SystemProcess.EscapeArgument("--defaults-file=config/" + ConfigurationMysqld))); }
public async Task <string?> Configure(ApplicationConfig application) { var environment = application.Environment; var mariadb = application.Package.MariaDb; // Write configuration file var packageDirectory = GetInstallDirectory(environment.InstallDirectoryOrDefault); var context = Context.CreateCustom(new Dictionary <Value, Value> { ["dataDirectory"] = mariadb.DataDirectoryOrDefault, ["serverPort"] = mariadb.ServerPortOrDefault }); foreach (var name in new[] { ConfigurationMysqld }) { var destinationPath = Path.Combine(packageDirectory.AbsolutePath, "config", name); var success = await ResourceHelper.WriteToFile <PhpPackage>($"MariaDb.{name}", context, destinationPath); if (!success) { return($"configuration failure with '{name}'"); } } // Initialize data directory if (!File.Exists(Path.Join(packageDirectory.AbsolutePath, mariadb.DataDirectoryOrDefault, "my.ini"))) { var process = SystemProcess.Start(CreateProcessStartInfo(environment.InstallDirectoryOrDefault, "mysql_install_db.exe", SystemProcess.EscapeArgument("--datadir=" + mariadb.DataDirectoryOrDefault))); if (process == null || await process.Stop(TimeSpan.FromSeconds(15)) != 0) { return("could not initialize data directory"); } } return(null); }