Skip to content

Commit

Permalink
[Release] 4.0.5
Browse files Browse the repository at this point in the history
  • Loading branch information
Akkadius committed May 14, 2024
1 parent b05fb02 commit 721c526
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 15 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## [4.0.5] 5/13/2024

**Installer** Minor fix to using existing MySQL server installs

## [4.0.4] 5/12/2024

### Spire Admin Launcher Fixes
Expand All @@ -18,7 +22,7 @@ Occulus has been ported natively to Spire. All remaining features have been port

### Changes

* **Console Logging** Console logging has been improved to be more verbose and informative. The entire logging system has been overhauled to provide more information to the user and be more useful for debugging for development.
* **Console Logging** has been improved to be more verbose and informative. The entire logging system has been overhauled to provide more information to the user and be more useful for debugging for development.
* **Banner** Spire now renders the image banner on bootup in the console.

#### Spire Admin
Expand Down
40 changes: 30 additions & 10 deletions internal/eqemuserver/installer.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ func (a *Installer) Install() error {
for _, t := range []func() error{
a.installLinuxOsPackages,
a.initLinuxMysql,
a.initDb,
} {
err := t()
if err != nil {
Expand All @@ -142,6 +143,7 @@ func (a *Installer) Install() error {
a.initWindowsCommandPrompt,
a.initWindowsPerl,
a.initWindowsMysql,
a.initDb,
} {
err := t()
if err != nil {
Expand Down Expand Up @@ -689,6 +691,8 @@ func (a *Installer) Exec(c ExecConfig) (string, error) {
output += scanner.Text() + "\n"
}

output = strings.ReplaceAll(output, "mysql: [Warning] Using a password on the command line interface can be insecure.", "")

return output, nil
}

Expand Down Expand Up @@ -818,6 +822,10 @@ func (a *Installer) sourcePeqDatabase() error {
return err
}

if strings.Contains(tables, "ERROR") {
return fmt.Errorf("could not get tables: %v", tables)
}

// get the table count
// subtract 1 because it is the output header
tableCount := len(strings.Split(tables, "\n")) - 1
Expand Down Expand Up @@ -1653,7 +1661,7 @@ func (a *Installer) initWindowsMysql() error {

// check if mysql is alive
if strings.Contains(res, "mysqld is alive") {
fmt.Printf("MySQL already installed, skipping")
fmt.Printf("MySQL already installed, skipping\n")
return nil
}
}
Expand Down Expand Up @@ -1694,6 +1702,16 @@ func (a *Installer) initWindowsMysql() error {
return err
}

err = a.setWindowsMysqlPath()
if err != nil {
return err
}

a.DoneBanner("Downloading MariaDB")
return nil
}

func (a *Installer) initDb() error {
c := MysqlConfig{
DatabaseName: a.installConfig.MysqlDatabaseName,
DatabaseUser: a.installConfig.MysqlUsername,
Expand All @@ -1702,9 +1720,8 @@ func (a *Installer) initWindowsMysql() error {

// create a new database
var sql string

fmt.Printf("Creating database [%v]\n", c.DatabaseName)
err = a.DbExec(DbExecConfig{statement: fmt.Sprintf("CREATE DATABASE IF NOT EXISTS %v", c.DatabaseName)})
err := a.DbExec(DbExecConfig{statement: fmt.Sprintf("CREATE DATABASE IF NOT EXISTS %v", c.DatabaseName)})
if err != nil {
return err
}
Expand All @@ -1724,12 +1741,6 @@ func (a *Installer) initWindowsMysql() error {
return err
}

err = a.setWindowsMysqlPath()
if err != nil {
return err
}

a.DoneBanner("Downloading MariaDB")
return nil
}

Expand Down Expand Up @@ -1809,10 +1820,19 @@ func (a *Installer) getWindowsProgramFilesPath() string {

// getWindowsMysqlPath returns the path to the mysql installation
func (a *Installer) getWindowsMysqlPath() string {
mysqlPath, err := exec.LookPath("mysql")
if err != nil {
a.logger.Debug().Err(err).Msg("could not find mysql")
}

if mysqlPath != "" {
return filepath.Dir(mysqlPath)
}

// get folders in folder using go
entries, err := os.ReadDir(filepath.Join(a.getWindowsProgramFilesPath()))
if err != nil {
a.logger.Fatal().Err(err).Msg("could not read directory")
a.logger.Debug().Err(err).Msg("could not read directory")
}

// first look for mariadb
Expand Down
6 changes: 3 additions & 3 deletions internal/eqemuserver/installer_config_prompts.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ func (a *Installer) checkInstallConfig() error {

// prompt: mysql username
useExistingMysqlInstallPrompt, _ := (&promptui.Prompt{
Label: "Use an existing MySQL server",
Label: "Use an existing MySQL server (Requires root to be password-less)",
Default: "N",
IsConfirm: true,
AllowEdit: true,
Expand Down Expand Up @@ -165,7 +165,7 @@ func (a *Installer) checkInstallConfig() error {
}

// validate the mysql connection
fmt.Printf("Validating MySQL connection...")
fmt.Printf("Validating MySQL connection...\n")
err = a.validateMysqlConnection(
mysqlHost,
mysqlPort,
Expand Down Expand Up @@ -437,7 +437,7 @@ func (a *Installer) validateMysqlConnection(host string, port string, name strin
if err != nil {
return fmt.Errorf("could not connect to mysql: %v", err)
}
if len(res) > 0 {
if len(strings.TrimSpace(res)) > 0 {
return fmt.Errorf("database already exists: %v", res)
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "spire",
"version": "4.0.4",
"version": "4.0.5",
"repository": {
"type": "git",
"url": "https://github.com/Akkadius/spire.git"
Expand Down

0 comments on commit 721c526

Please sign in to comment.