Skip to content

Commit

Permalink
Merge pull request #2 from carmigo/bug/windows-version8-fix
Browse files Browse the repository at this point in the history
fix windows error running version 8.x
  • Loading branch information
oryan-block authored Sep 22, 2022
2 parents 4558f2f + 31fc6af commit 0f37734
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public class Setup {
new FilePermissionsInitializer(),
new Mysql57Initializer(),
new NixBefore57Initializer(),
new NixBefore8Initializer(),
new Mysql8Initializer());


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ public FileSet emit() {
.addEntry(Library, "bin/mysql.exe")
.addEntry(Library, "bin/mysqladmin.exe")
.addEntry(Library, "share/english/errmsg.sys")
.addEntry(Library, "bin/libeay32.dll")
.addEntry(Library, "bin/ssleay32.dll")
// .addEntry(Library, "share/fill_help_tables.sql")
// .addEntry(Library, "share/mysql_sys_schema.sql")
// .addEntry(Library, "share/mysql_system_tables.sql")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package com.wix.mysql.distribution.setup;

import com.wix.mysql.config.MysqldConfig;
import com.wix.mysql.distribution.Version;
import de.flapdoodle.embed.process.config.IRuntimeConfig;
import de.flapdoodle.embed.process.distribution.Platform;
import de.flapdoodle.embed.process.extract.IExtractedFileSet;
import org.apache.commons.io.filefilter.RegexFileFilter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.File;
import java.io.FileFilter;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;

public class NixBefore8Initializer implements Initializer {

private final static Logger logger = LoggerFactory.getLogger(NixBefore8Initializer.class);
private static final String SEP = File.separator;

@Override
public boolean matches(Version version) {
return Platform.detect().isUnixLike() &&
version.getMajorVersion().equals("8.0");
}

@Override
public void apply(IExtractedFileSet files, IRuntimeConfig runtimeConfig, MysqldConfig config) throws IOException {
File baseDir = files.baseDir();
File libDir = new File(baseDir + SEP + "lib");
FileFilter filter = new RegexFileFilter("^[a-z]+\\.so(\\.[0-9]+)+");
File[] soFiles = libDir.listFiles(filter);
for (File file : soFiles) {
Files.createSymbolicLink(Paths.get(baseDir + SEP + "bin" + SEP + file.getName()), Paths.get(file.getPath()));
logger.debug("Symlink " + file.getName());
}
}
}

0 comments on commit 0f37734

Please sign in to comment.