Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Fedora 33 and backup of libs during install #16

Merged
merged 2 commits into from
Nov 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
This is the changelog for this fork of OMI.
It documents the changes in each of the tagged releases

## 2.0.1 - TBD

+ Added `fedora33` distribution
+ Make a backup of the original library files in the PowerShell dir before installing the forked copies

## 2.0.0 - 2020-10-17

### Breaking Changes
Expand Down
6 changes: 6 additions & 0 deletions PSWSMan/PSWSMan.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,12 @@ Function Install-WSMan {

if ($change) {
Write-Verbose -Message "Installing $($_.Name) to '$pwshDir'"

if (Test-Path -LiteralPath $destPath) {
Write-Verbose -Message "Creating backup of $($_.Name) to $($_.Name).bak"
Copy-Item -LiteralPath $destPath -Destination "$($destPath).bak" -Force
}

Copy-Item -LiteralPath $_.Fullname -Destination $destPath
$notify = $true
}
Expand Down
2 changes: 2 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ stages:
distribution: fedora31
Fedora32:
distribution: fedora32
Fedora33:
distribution: fedora33
Ubuntu16.04:
distribution: ubuntu16.04
Ubuntu18.04:
Expand Down
30 changes: 30 additions & 0 deletions distribution_meta/fedora33.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"container_image": "fedora:33",
"package_manager": "dnf",
"microsoft_repo": "https://packages.microsoft.com/config/rhel/7/prod.repo",
"build_deps": [
"cmake",
"bind-utils",
"gcc",
"gcc-c++",
"git",
"krb5-devel",
"make",
"openssl",
"openssl-devel",
"pam-devel",
"redhat-lsb-core",
"rpm-build",
"rpm-devel",
"which"
],
"test_deps": [
"gssntlmssp",
"krb5-devel",
"krb5-workstation",
"powershell",
"which"
],
"cert_staging_dir": "/etc/pki/ca-trust/source/anchors",
"cert_staging_cmd": "update-ca-trust extract"
}
12 changes: 11 additions & 1 deletion libmi.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,23 @@ Describe "PSWSMan tests" {
$ev.Count | Should -Be 1
$ev[0].Exception.Message | Should -BeLike "Unsupported distribution 'invalid'. Supported distributions: *"
}

It "Created backups of <Name> after installation" -TestCases @(
@{ Name = 'libmi' },
@{ Name = 'libpsrpclient' }
) {
$pwshDir = Split-Path -Path ([PSObject].Assembly.Location) -Parent
$libExtension = if ($Global:Distribution -eq 'macOS') { 'dylib' } else { 'so' }
$libName = "$($Name).$($libExtension).bak"

Test-Path -LiteralPath (Join-Path -Path $pwshDir -ChildPath $libName) -PathType Leaf | Should -Be $true
}
}

Describe "Checking the compiled library's integrity" {
It "Exposes the custom public version function" {
$versions = Get-WSManVersion


foreach ($key in $versions.PSObject.Properties.Name) {
# All versions we produce should have a major version that's 1 or more
# The minor versions can be anything so we can't really check those
Expand Down