@@ -6,8 +6,8 @@ $RepoRoot = (Resolve-Path -Path "$PSScriptRoot/../..").Path
66
77$packagingStrings = Import-PowerShellDataFile " $PSScriptRoot \packaging.strings.psd1"
88Import-Module " $PSScriptRoot \..\Xml" - ErrorAction Stop - Force
9- $DebianDistributions = @ (" ubuntu.16.04 " , " ubuntu.18.04 " , " ubuntu.20.04 " , " debian.9 " , " debian.10 " , " debian.11 " )
10- $RedhatDistributions = @ (" rhel.7 " , " centos.8 " )
9+ $DebianDistributions = @ (" deb " )
10+ $RedhatDistributions = @ (" rh " )
1111$script :netCoreRuntime = ' net6.0'
1212$script :iconFileName = " Powershell_black_64.png"
1313$script :iconPath = Join-Path - path $PSScriptRoot - ChildPath " ../../assets/$iconFileName " - Resolve
@@ -577,10 +577,6 @@ function New-TarballPackage {
577577 $Staging = " $PSScriptRoot /staging"
578578 New-StagingFolder - StagingPath $Staging - PackageSourcePath $PackageSourcePath
579579
580- if (-not $ExcludeSymbolicLinks.IsPresent ) {
581- New-PSSymbolicLinks - Distribution ' ubuntu.16.04' - Staging $Staging
582- }
583-
584580 if (Get-Command - Name tar - CommandType Application - ErrorAction Ignore) {
585581 if ($Force -or $PSCmdlet.ShouldProcess (" Create tarball package" )) {
586582 $options = " -czf"
@@ -840,9 +836,6 @@ function New-UnixPackage {
840836 }
841837
842838 $packageVersion = Get-LinuxPackageSemanticVersion - Version $Version
843- if (! $Environment.IsRedHatFamily -and ! $Environment.IsSUSEFamily ) {
844- throw ($ErrorMessage -f " Redhat or SUSE Family" )
845- }
846839 }
847840 " osxpkg" {
848841 $packageVersion = $Version
@@ -904,8 +897,7 @@ function New-UnixPackage {
904897 if ($PSCmdlet.ShouldProcess (" Create package file system" ))
905898 {
906899 # Generate After Install and After Remove scripts
907- $AfterScriptInfo = New-AfterScripts - Link $Link - Distribution $DebDistro
908- New-PSSymbolicLinks - Distribution $DebDistro - Staging $Staging
900+ $AfterScriptInfo = New-AfterScripts - Link $Link - Distribution $DebDistro - Destination $Destination
909901
910902 # there is a weird bug in fpm
911903 # if the target of the powershell symlink exists, `fpm` aborts
@@ -1265,42 +1257,18 @@ function Get-FpmArguments
12651257 return $Arguments
12661258}
12671259
1268- function Test-Distribution
1269- {
1270- param (
1271- [String ]
1272- $Distribution
1273- )
1274-
1275- if ( $Environment.IsDebianFamily -and ! $Distribution )
1276- {
1277- throw " $Distribution is required for a Debian based distribution."
1278- }
1279-
1280- if ( $Environment.IsDebianFamily -and $Script :DebianDistributions -notcontains $Distribution )
1281- {
1282- throw " $Distribution should be one of the following: $Script :DebianDistributions "
1283- }
1284-
1285- if ( $Environment.IsRedHatFamily -and $Script :RedHatDistributions -notcontains $Distribution )
1286- {
1287- throw " $Distribution should be one of the following: $Script :RedHatDistributions "
1288- }
1289-
1290- return $true
1291- }
12921260function Get-PackageDependencies
12931261{
12941262 param (
12951263 [String ]
1296- [ValidateScript ({ Test-Distribution - Distribution $_ } )]
1264+ [ValidateSet ( ' rh ' , ' deb ' , ' macOS ' )]
12971265 $Distribution
12981266 )
12991267
13001268 End {
13011269 # These should match those in the Dockerfiles, but exclude tools like Git, which, and curl
13021270 $Dependencies = @ ()
1303- if ($Environment .IsDebianFamily ) {
1271+ if ($Distribution -eq ' deb ' ) {
13041272 $Dependencies = @ (
13051273 " libc6" ,
13061274 " libgcc1" ,
@@ -1311,16 +1279,11 @@ function Get-PackageDependencies
13111279 " libssl1.1|libssl1.0.2|libssl1.0.0"
13121280 )
13131281
1314- } elseif ($Environment .IsRedHatFamily ) {
1282+ } elseif ($Distribution -eq ' rh ' ) {
13151283 $Dependencies = @ (
13161284 " openssl-libs" ,
13171285 " libicu"
13181286 )
1319- } elseif ($Environment.IsSUSEFamily ) {
1320- $Dependencies = @ (
1321- " libopenssl1_0_0" ,
1322- " libicu"
1323- )
13241287 }
13251288
13261289 return $Dependencies
@@ -1362,22 +1325,26 @@ function New-AfterScripts
13621325
13631326 [Parameter (Mandatory )]
13641327 [string ]
1365- $Distribution
1328+ $Distribution ,
1329+
1330+ [Parameter (Mandatory )]
1331+ [string ]
1332+ $Destination
13661333 )
13671334
13681335 Write-Verbose - Message " AfterScript Distribution: $Distribution " - Verbose
13691336
13701337 if ($Environment.IsRedHatFamily ) {
13711338 $AfterInstallScript = [io.path ]::GetTempFileName()
13721339 $AfterRemoveScript = [io.path ]::GetTempFileName()
1373- $packagingStrings.RedHatAfterInstallScript -f " $Link " | Out-File - FilePath $AfterInstallScript - Encoding ascii
1374- $packagingStrings.RedHatAfterRemoveScript -f " $Link " | Out-File - FilePath $AfterRemoveScript - Encoding ascii
1340+ $packagingStrings.RedHatAfterInstallScript -f " $Link " , $Destination | Out-File - FilePath $AfterInstallScript - Encoding ascii
1341+ $packagingStrings.RedHatAfterRemoveScript -f " $Link " , $Destination | Out-File - FilePath $AfterRemoveScript - Encoding ascii
13751342 }
13761343 elseif ($Environment.IsDebianFamily -or $Environment.IsSUSEFamily ) {
13771344 $AfterInstallScript = [io.path ]::GetTempFileName()
13781345 $AfterRemoveScript = [io.path ]::GetTempFileName()
1379- $packagingStrings.UbuntuAfterInstallScript -f " $Link " | Out-File - FilePath $AfterInstallScript - Encoding ascii
1380- $packagingStrings.UbuntuAfterRemoveScript -f " $Link " | Out-File - FilePath $AfterRemoveScript - Encoding ascii
1346+ $packagingStrings.UbuntuAfterInstallScript -f " $Link " , $Destination | Out-File - FilePath $AfterInstallScript - Encoding ascii
1347+ $packagingStrings.UbuntuAfterRemoveScript -f " $Link " , $Destination | Out-File - FilePath $AfterRemoveScript - Encoding ascii
13811348 }
13821349 elseif ($Environment.IsMacOS ) {
13831350 # NOTE: The macos pkgutil doesn't support uninstall actions so we did not implement it.
@@ -1392,60 +1359,6 @@ function New-AfterScripts
13921359 }
13931360}
13941361
1395- function New-PSSymbolicLinks
1396- {
1397- param (
1398- [Parameter (Mandatory )]
1399- [string ]
1400- $Distribution ,
1401-
1402- [Parameter (Mandatory )]
1403- [string ]
1404- $Staging
1405- )
1406-
1407- Write-Verbose - Message " PSSymLinks-Distribution: $Distribution " - Verbose
1408-
1409- if ($Environment.IsRedHatFamily ) {
1410- switch - regex ($Distribution )
1411- {
1412- # add two symbolic links to system shared libraries that libmi.so is dependent on to handle
1413- # platform specific changes. This is the only set of platforms needed for this currently
1414- # as Ubuntu has these specific library files in the platform and macOS builds for itself
1415- # against the correct versions.
1416- ' centos\.8' {
1417- New-Item - Force - ItemType SymbolicLink - Target " /lib64/libssl.so.1.1" - Path " $Staging /libssl.so.1.0.0" > $null
1418- New-Item - Force - ItemType SymbolicLink - Target " /lib64/libcrypto.so.1.1.1" - Path " $Staging /libcrypto.so.1.0.0" > $null
1419- }
1420- default {
1421- New-Item - Force - ItemType SymbolicLink - Target " /lib64/libssl.so.10" - Path " $Staging /libssl.so.1.0.0" > $null
1422- New-Item - Force - ItemType SymbolicLink - Target " /lib64/libcrypto.so.10" - Path " $Staging /libcrypto.so.1.0.0" > $null
1423- }
1424- }
1425- }
1426- elseif ($Environment.IsDebianFamily -or $Environment.IsSUSEFamily ) {
1427- switch - regex ($Distribution )
1428- {
1429- # add two symbolic links to system shared libraries that libmi.so is dependent on to handle
1430- # platform specific changes. This appears to be a change in Debian 9; Debian 8 did not need these
1431- # symlinks.
1432- ' debian\.9' {
1433- New-Item - Force - ItemType SymbolicLink - Target " /usr/lib/x86_64-linux-gnu/libssl.so.1.0.2" - Path " $Staging /libssl.so.1.0.0" > $null
1434- New-Item - Force - ItemType SymbolicLink - Target " /usr/lib/x86_64-linux-gnu/libcrypto.so.1.0.2" - Path " $Staging /libcrypto.so.1.0.0" > $null
1435- }
1436- ' debian\.(10|11)' {
1437- New-Item - Force - ItemType SymbolicLink - Target " /usr/lib/x86_64-linux-gnu/libssl.so.1.1" - Path " $Staging /libssl.so.1.0.0" > $null
1438- New-Item - Force - ItemType SymbolicLink - Target " /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1" - Path " $Staging /libcrypto.so.1.0.0" > $null
1439- }
1440- default {
1441- # Default to old behavior before this change
1442- New-Item - Force - ItemType SymbolicLink - Target " /lib64/libssl.so.10" - Path " $Staging /libssl.so.1.0.0" > $null
1443- New-Item - Force - ItemType SymbolicLink - Target " /lib64/libcrypto.so.10" - Path " $Staging /libcrypto.so.1.0.0" > $null
1444- }
1445- }
1446- }
1447- }
1448-
14491362function New-ManGzip
14501363{
14511364 param (
0 commit comments