Skip to content

Instantly share code, notes, and snippets.

@andikrueger
Last active December 20, 2017 13:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andikrueger/cbd49f9ef9905f6c26df6fbb7bcc7793 to your computer and use it in GitHub Desktop.
Save andikrueger/cbd49f9ef9905f6c26df6fbb7bcc7793 to your computer and use it in GitHub Desktop.
Package MySqlInstaller {
Path = "$($SourceFolder)\mysql-installer-community-5.7.20.0.msi"
ProductId = "{7999380B-7D4E-4E76-B61D-3AFCA710F24D}"
Name = "MySQL Installer - Community"
Arguments = ""
}
Package vcRedist2013 {
Path = "$($SourceFolder)\vcredist_x64.exe"
ProductId = "{ef6b00ec-13e1-4c25-9064-b2f383cb8412}"
Name = "Microsoft Visual C++ 2013 Redistributable (x64) - 12.0.40660"
Arguments = "/install /passive"
}
xMySqlServer MySqlInstance {
MySqlVersion = "5.7.20"
RootPassword = $MySqlRootPassword
Port = 3306
Ensure = "Present"
DependsOn = @("[Package]MySqlInstaller","[Package]vcRedist2013")
}
Script FixReadErrorinMySqlResource {
GetScript = {
return @{
Result = ""
}
}
SetScript = {
$filePath = "C:\Program Files\WindowsPowerShell\Modules\xMySql\2.1.0.0\MSFT_xMySqlUtilities.psm1"
$newLine = @"
if(`$line -match [RegEx]::Escape("mysql: [Warning] Using a password on the command"))
{
break
}
"@
$content = Get-Content $filePath
$content[241] = "{0}`r`n{1}" -f $newLine, $content[241]
$content | Set-Content $filePath
Import-Module $filePath
}
TestScript = {
$content = Get-Content "C:\Program Files\WindowsPowerShell\Modules\xMySql\2.1.0.0\MSFT_xMySqlUtilities.psm1"
if( $content.length -eq 319 -and
$content[241] -eq " if(`$line -match [RegEx]::Escape(`"mysql: [Warning] Using a password on the command`"))")
{
return $true
}
return $false
}
}
xMySqlServer MySqlInstance {
MySqlVersion = "5.7.20"
RootPassword = $MySqlRootPassword
Port = 3306
Ensure = "Present"
DependsOn = @("[Package]MySqlInstaller", "[Script]FixReadErrorinMySqlResource)
}
xMySqlDatabase MySqlPiwikDb {
MySqlVersion = "5.7.20"
DatabaseName = "Piwik"
RootCredential = $MySqlRootPassword
Ensure = "Present"
DependsOn = @("[xMySqlServer]MySqlInstance", "[Script]FixReadErrorinMySqlResource)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment