2014-04-10 18:41:19 +08:00
|
|
|
<#
|
|
|
|
.Synopsis
|
2022-10-15 03:46:54 +08:00
|
|
|
Pack Cmder
|
2014-04-10 18:41:19 +08:00
|
|
|
.DESCRIPTION
|
|
|
|
Use this script to pack cmder into release archives
|
|
|
|
|
|
|
|
You will need to make this script executable by setting your Powershell Execution Policy to Remote signed
|
|
|
|
Then unblock the script for execution with UnblockFile .\pack.ps1
|
|
|
|
.EXAMPLE
|
|
|
|
.\pack.ps1
|
|
|
|
|
|
|
|
Creates default archives for cmder
|
|
|
|
.EXAMPLE
|
2022-10-16 20:31:15 +08:00
|
|
|
.\pack.ps1 -verbose
|
2014-04-10 18:41:19 +08:00
|
|
|
|
|
|
|
Creates default archives for cmder with plenty of information
|
|
|
|
.NOTES
|
|
|
|
AUTHORS
|
2015-03-18 20:28:34 +08:00
|
|
|
Samuel Vasko, Jack Bennett, Martin Kemp
|
2014-04-10 18:41:19 +08:00
|
|
|
Part of the Cmder project.
|
|
|
|
.LINK
|
2015-10-15 13:52:05 +08:00
|
|
|
https://github.com/cmderdev/cmder - Project Home
|
2014-04-10 18:41:19 +08:00
|
|
|
#>
|
|
|
|
|
2022-11-04 23:17:16 +08:00
|
|
|
[CmdletBinding(SupportsShouldProcess = $true)]
|
2014-04-10 18:41:19 +08:00
|
|
|
Param(
|
|
|
|
# CmdletBinding will give us;
|
|
|
|
# -verbose switch to turn on logging and
|
|
|
|
# -whatif switch to not actually make changes
|
|
|
|
|
|
|
|
# Path to the vendor configuration source file
|
2022-10-15 02:58:50 +08:00
|
|
|
[string]$cmderRoot = "$PSScriptRoot\..",
|
2014-04-10 18:41:19 +08:00
|
|
|
|
2023-09-26 02:26:53 +08:00
|
|
|
# Using this option will pack artifacts for a specific included terminal emulator [conemu-maximus5, or windows-terminal]
|
|
|
|
[string]$emulator = 'conemu-maximus5',
|
|
|
|
|
2014-04-10 18:41:19 +08:00
|
|
|
# Vendor folder locaton
|
2022-10-15 02:58:50 +08:00
|
|
|
[string]$saveTo = "$PSScriptRoot\..\build"
|
2014-04-10 18:41:19 +08:00
|
|
|
)
|
|
|
|
|
2022-10-15 03:37:45 +08:00
|
|
|
$cmderRoot = Resolve-Path $cmderRoot
|
|
|
|
|
2014-04-10 18:41:19 +08:00
|
|
|
. "$PSScriptRoot\utils.ps1"
|
|
|
|
$ErrorActionPreference = "Stop"
|
2014-08-27 06:52:49 +08:00
|
|
|
Ensure-Executable "7z"
|
2014-04-10 18:41:19 +08:00
|
|
|
|
2023-09-26 02:26:53 +08:00
|
|
|
if ($emulator -eq "windows-terminal") {
|
|
|
|
$targets = @{
|
2023-09-26 03:59:10 +08:00
|
|
|
"cmder_wt.7z" = "-t7z -m0=lzma2 -mx=9 -mfb=64 -md=32m -ms=on -myx=7 -mqs=on -xr!`"vendor\conemu-maximus5`"";
|
|
|
|
"cmder_wt.zip" = "-mm=Deflate -mfb=128 -mpass=3 -xr!`"vendor\conemu-maximus5`"";
|
|
|
|
"cmder_wt_mini.zip" = "-xr!`"vendor\git-for-windows`" -xr!`"vendor\conemu-maximus5`"";
|
|
|
|
}
|
2023-09-26 02:26:53 +08:00
|
|
|
} else {
|
|
|
|
$targets = @{
|
2023-09-26 03:59:10 +08:00
|
|
|
"cmder.7z" = "-t7z -m0=lzma2 -mx=9 -mfb=64 -md=32m -ms=on -myx=7 -mqs=on -xr!`"vendor\windows-terminal`"";
|
|
|
|
"cmder.zip" = "-mm=Deflate -mfb=128 -mpass=3 -xr!`"vendor\windows-terminal`"";
|
|
|
|
"cmder_mini.zip" = "-xr!`"vendor\git-for-windows`" -xr!`"vendor\windows-terminal`"";
|
|
|
|
}
|
2014-04-10 18:41:19 +08:00
|
|
|
}
|
|
|
|
|
2022-10-15 08:14:15 +08:00
|
|
|
Push-Location -Path $cmderRoot
|
|
|
|
|
2022-10-15 06:14:21 +08:00
|
|
|
Delete-Existing "$cmderRoot\Version*"
|
|
|
|
Delete-Existing "$cmderRoot\build\*"
|
2014-04-10 19:11:41 +08:00
|
|
|
|
2022-10-16 20:43:26 +08:00
|
|
|
if (-not (Test-Path -PathType container $saveTo)) {
|
2022-10-15 04:12:02 +08:00
|
|
|
(New-Item -ItemType Directory -Path $saveTo) | Out-Null
|
2022-10-15 03:46:54 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
$saveTo = Resolve-Path $saveTo
|
|
|
|
|
2018-03-31 02:53:44 +08:00
|
|
|
$version = Get-VersionStr
|
2014-04-10 20:42:20 +08:00
|
|
|
(New-Item -ItemType file "$cmderRoot\Version $version") | Out-Null
|
2014-04-10 18:41:19 +08:00
|
|
|
|
2022-10-15 04:12:02 +08:00
|
|
|
if ($PSCmdlet.MyInvocation.BoundParameters["Verbose"].IsPresent) {
|
|
|
|
Write-Verbose "Packing Cmder $version in $saveTo..."
|
2022-11-04 23:17:16 +08:00
|
|
|
$excluded = (Get-Content -Path "$cmderRoot\packignore") -Split [System.Environment]::NewLine | Where-Object { $_ }
|
2022-10-15 04:57:27 +08:00
|
|
|
Get-ChildItem $cmderRoot -Force -Exclude $excluded
|
2022-10-15 04:12:02 +08:00
|
|
|
}
|
|
|
|
|
2014-04-10 18:41:19 +08:00
|
|
|
foreach ($t in $targets.GetEnumerator()) {
|
2022-10-15 08:25:44 +08:00
|
|
|
Create-Archive "$cmderRoot" "$saveTo\$($t.Name)" $t.Value
|
2017-04-07 12:57:16 +08:00
|
|
|
$hash = (Digest-Hash "$saveTo\$($t.Name)")
|
2017-04-07 13:45:28 +08:00
|
|
|
Add-Content -path "$saveTo\hashes.txt" -value ($t.Name + ' ' + $hash)
|
2022-10-15 02:58:50 +08:00
|
|
|
}
|
2022-10-15 08:14:15 +08:00
|
|
|
|
|
|
|
Pop-Location
|