mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Merged PR 3079: Resolve Linux SxS conflicts and issues
Fix man page conflict between stable and preview Linux package - rename preview man page pwsh-preview Fix /etc/shell entries not being created correctly for preview packages
This commit is contained in:
+1
-1
@@ -2094,7 +2094,7 @@ function script:Start-NativeExecution
|
||||
try {
|
||||
if($VerboseOutputOnError.IsPresent)
|
||||
{
|
||||
$output = & $sb
|
||||
$output = & $sb 2>&1
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -652,15 +652,17 @@ function New-UnixPackage {
|
||||
|
||||
if($pscmdlet.ShouldProcess("Create package file system"))
|
||||
{
|
||||
# refers to executable, does not vary by channel
|
||||
New-Item -Force -ItemType SymbolicLink -Path $linkSource -Target "$Destination/pwsh" >$null
|
||||
|
||||
# Generate After Install and After Remove scripts
|
||||
$AfterScriptInfo = New-AfterScripts
|
||||
$AfterScriptInfo = New-AfterScripts -Link $Link
|
||||
|
||||
# there is a weird bug in fpm
|
||||
# if the target of the powershell symlink exists, `fpm` aborts
|
||||
# with a `utime` error on macOS.
|
||||
# so we move it to make symlink broken
|
||||
# refers to executable, does not vary by channel
|
||||
$symlink_dest = "$Destination/pwsh"
|
||||
$hack_dest = "./_fpm_symlink_hack_powershell"
|
||||
if ($Environment.IsMacOS) {
|
||||
@@ -671,14 +673,15 @@ function New-UnixPackage {
|
||||
}
|
||||
|
||||
# Generate gzip of man file
|
||||
$ManGzipInfo = New-ManGzip
|
||||
$ManGzipInfo = New-ManGzip -IsPreview:$IsPreview
|
||||
|
||||
# Change permissions for packaging
|
||||
Start-NativeExecution {
|
||||
find $Staging -type d | xargs chmod 755
|
||||
find $Staging -type f | xargs chmod 644
|
||||
chmod 644 $ManGzipInfo.GzipFile
|
||||
chmod 755 "$Staging/pwsh" # only the executable should be executable
|
||||
# refers to executable, does not vary by channel
|
||||
chmod 755 "$Staging/pwsh" #only the executable file should be granted the execution permission
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1055,6 +1058,12 @@ function Test-Dependencies
|
||||
|
||||
function New-AfterScripts
|
||||
{
|
||||
param(
|
||||
[Parameter(Mandatory)]
|
||||
[string]
|
||||
$Link
|
||||
)
|
||||
|
||||
if ($Environment.IsRedHatFamily) {
|
||||
# add two symbolic links to system shared libraries that libmi.so is dependent on to handle
|
||||
# platform specific changes. This is the only set of platforms needed for this currently
|
||||
@@ -1065,14 +1074,14 @@ function New-AfterScripts
|
||||
|
||||
$AfterInstallScript = [io.path]::GetTempFileName()
|
||||
$AfterRemoveScript = [io.path]::GetTempFileName()
|
||||
$packagingStrings.RedHatAfterInstallScript -f "$Link/pwsh" | Out-File -FilePath $AfterInstallScript -Encoding ascii
|
||||
$packagingStrings.RedHatAfterRemoveScript -f "$Link/pwsh" | Out-File -FilePath $AfterRemoveScript -Encoding ascii
|
||||
$packagingStrings.RedHatAfterInstallScript -f "$Link" | Out-File -FilePath $AfterInstallScript -Encoding ascii
|
||||
$packagingStrings.RedHatAfterRemoveScript -f "$Link" | Out-File -FilePath $AfterRemoveScript -Encoding ascii
|
||||
}
|
||||
elseif ($Environment.IsUbuntu -or $Environment.IsDebian -or $Environment.IsSUSEFamily) {
|
||||
$AfterInstallScript = [io.path]::GetTempFileName()
|
||||
$AfterRemoveScript = [io.path]::GetTempFileName()
|
||||
$packagingStrings.UbuntuAfterInstallScript -f "$Link/pwsh" | Out-File -FilePath $AfterInstallScript -Encoding ascii
|
||||
$packagingStrings.UbuntuAfterRemoveScript -f "$Link/pwsh" | Out-File -FilePath $AfterRemoveScript -Encoding ascii
|
||||
$packagingStrings.UbuntuAfterInstallScript -f "$Link" | Out-File -FilePath $AfterInstallScript -Encoding ascii
|
||||
$packagingStrings.UbuntuAfterRemoveScript -f "$Link" | Out-File -FilePath $AfterRemoveScript -Encoding ascii
|
||||
}
|
||||
|
||||
return [PSCustomObject] @{
|
||||
@@ -1083,16 +1092,33 @@ function New-AfterScripts
|
||||
|
||||
function New-ManGzip
|
||||
{
|
||||
param(
|
||||
[switch]
|
||||
$IsPreview
|
||||
)
|
||||
|
||||
# run ronn to convert man page to roff
|
||||
$RonnFile = Join-Path $PSScriptRoot "/../../assets/pwsh.1.ronn"
|
||||
if($IsPreview.IsPresent)
|
||||
{
|
||||
$newRonnFile = $RonnFile -replace 'pwsh', 'pwsh-preview'
|
||||
Copy-Item -Path $RonnFile -Destination $newRonnFile -force
|
||||
$RonnFile = $newRonnFile
|
||||
}
|
||||
|
||||
$RoffFile = $RonnFile -replace "\.ronn$"
|
||||
|
||||
# Run ronn on assets file
|
||||
Start-NativeExecution { ronn --roff $RonnFile }
|
||||
Start-NativeExecution { ronn --roff $RonnFile } -VerboseOutputOnError
|
||||
|
||||
if($IsPreview.IsPresent)
|
||||
{
|
||||
Remove-item $RonnFile
|
||||
}
|
||||
|
||||
# gzip in assets directory
|
||||
$GzipFile = "$RoffFile.gz"
|
||||
Start-NativeExecution { gzip -f $RoffFile }
|
||||
Start-NativeExecution { gzip -f $RoffFile } -VerboseOutputOnError
|
||||
|
||||
$ManFile = Join-Path "/usr/local/share/man/man1" (Split-Path -Leaf $GzipFile)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user