mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Based on standard practices, we need to have a copyright and license notice at the top of each source file. Removed existing copyrights and updated/added copyright notices for .h, .cpp, .cs, .ps1, and .psm1 files. Updated module manifests for consistency to have Author = "PowerShell" and Company = "Microsoft Corporation". Removed multiple line breaks. Separate PR coming to update contribution document for new source files: #6140 Manually reviewed each change. Fix #6073
61 lines
1.7 KiB
PowerShell
61 lines
1.7 KiB
PowerShell
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
# Licensed under the MIT License.
|
|
|
|
# PowerShell Script to build and package PowerShell from specified form and branch
|
|
# Script is intented to use in Docker containers
|
|
# Ensure PowerShell is available in the provided image
|
|
|
|
param (
|
|
[string] $location = "/powershell",
|
|
|
|
# Destination location of the package on docker host
|
|
[string] $destination = '/mnt',
|
|
|
|
[ValidatePattern("^v\d+\.\d+\.\d+(-\w+(\.\d+)?)?$")]
|
|
[ValidateNotNullOrEmpty()]
|
|
[string]$ReleaseTag,
|
|
|
|
[switch]$AppImage,
|
|
[switch]$TarX64,
|
|
[switch]$TarArm
|
|
)
|
|
|
|
$releaseTagParam = @{}
|
|
if ($ReleaseTag)
|
|
{
|
|
$releaseTagParam = @{ 'ReleaseTag' = $ReleaseTag }
|
|
}
|
|
|
|
Push-Location
|
|
try {
|
|
Set-Location $location
|
|
Import-Module "$location/build.psm1"
|
|
Import-Module "$location/tools/packaging"
|
|
|
|
Start-PSBootstrap -Package -NoSudo
|
|
Start-PSBuild -Crossgen -PSModuleRestore @releaseTagParam
|
|
|
|
Start-PSPackage @releaseTagParam
|
|
if ($AppImage) { Start-PSPackage -Type AppImage @releaseTagParam }
|
|
if ($TarX64) { Start-PSPackage -Type tar @releaseTagParam }
|
|
|
|
if ($TarArm) {
|
|
## Build 'linux-arm' and create 'tar.gz' package for it.
|
|
## Note that 'linux-arm' can only be built on Ubuntu environment.
|
|
Start-PSBuild -Runtime linux-arm -PSModuleRestore @releaseTagParam
|
|
Start-PSPackage -Type tar-arm @releaseTagParam
|
|
}
|
|
}
|
|
finally
|
|
{
|
|
Pop-Location
|
|
}
|
|
|
|
$linuxPackages = Get-ChildItem "$location/powershell*" -Include *.deb,*.rpm,*.AppImage,*.tar.gz
|
|
foreach ($linuxPackage in $linuxPackages)
|
|
{
|
|
$filePath = $linuxPackage.FullName
|
|
Write-Verbose "Copying $filePath to $destination" -Verbose
|
|
Copy-Item -Path $filePath -Destination $destination -force
|
|
}
|