mirror of
https://github.com/cmderdev/cmder.git
synced 2025-07-08 06:39:02 +08:00
Merge branch 'development-dax' into vagrant+packer
This commit is contained in:
@ -55,6 +55,9 @@ Param(
|
||||
|
||||
# Using this option will skip all downloads, if you only need to build launcher
|
||||
[switch]$noVendor,
|
||||
|
||||
# Using this option will specify the emulator to use [none, all, conemu-maximus5, or windows-terminal]
|
||||
[string]$terminal = 'all',
|
||||
|
||||
# Build launcher if you have MSBuild tools installed
|
||||
[switch]$Compile
|
||||
@ -79,7 +82,7 @@ if ($Compile) {
|
||||
|
||||
Write-Verbose "Building the launcher..."
|
||||
|
||||
# Referene: https://docs.microsoft.com/visualstudio/msbuild/msbuild-command-line-reference
|
||||
# Reference: https://docs.microsoft.com/visualstudio/msbuild/msbuild-command-line-reference
|
||||
msbuild CmderLauncher.vcxproj /t:Clean,Build /p:configuration=Release /m
|
||||
|
||||
if ($LastExitCode -ne 0) {
|
||||
@ -113,6 +116,18 @@ if (-not $noVendor) {
|
||||
}
|
||||
else { $ConEmuXml = "" }
|
||||
|
||||
# Preserve modified (by user) Windows Terminal setting file
|
||||
if ($config -ne "") {
|
||||
$WinTermSettingsJson = Join-Path $saveTo "windows-terminal\settings\settings.json"
|
||||
if (Test-Path $WinTermSettingsJson -pathType leaf) {
|
||||
$WinTermSettingsJsonSave = Join-Path $config "windows_terminal_settings.json"
|
||||
Write-Verbose "Backup '$WinTermSettingsJson' to '$WinTermSettingsJsonSave'"
|
||||
Copy-Item $WinTermSettingsJson $WinTermSettingsJsonSave
|
||||
}
|
||||
else { $WinTermSettingsJson = "" }
|
||||
}
|
||||
else { $WinTermSettingsJson = "" }
|
||||
|
||||
# Kill ssh-agent.exe if it is running from the $env:cmder_root we are building
|
||||
foreach ($ssh_agent in $(Get-Process ssh-agent -ErrorAction SilentlyContinue)) {
|
||||
if ([string]$($ssh_agent.path) -Match [string]$cmder_root.replace('\', '\\')) {
|
||||
@ -122,6 +137,14 @@ if (-not $noVendor) {
|
||||
}
|
||||
|
||||
foreach ($s in $sources) {
|
||||
if ($terminal -eq "none") {
|
||||
return
|
||||
} elseif ($s.name -eq "conemu-maximus5" -and $terminal -eq "windows-terminal") {
|
||||
return
|
||||
} elseif ($s.name -eq "windows-terminal" -and $terminal -eq "conemu-maximus5") {
|
||||
return
|
||||
}
|
||||
|
||||
Write-Verbose "Getting vendored $($s.name) $($s.version)..."
|
||||
|
||||
# We do not care about the extensions/type of archive
|
||||
@ -132,6 +155,16 @@ if (-not $noVendor) {
|
||||
Download-File -Url $s.url -File $vend\$tempArchive -ErrorAction Stop
|
||||
Extract-Archive $tempArchive $s.name
|
||||
|
||||
# Make Embedded Windows Terminal Portable
|
||||
if ($s.name -eq "windows-terminal") {
|
||||
$windowTerminalFiles = resolve-path ($saveTo + "\" + $s.name + "\terminal*")
|
||||
move-item -ErrorAction SilentlyContinue $windowTerminalFiles\* $s.name >$null
|
||||
remove-item -ErrorAction SilentlyContinue $windowTerminalFiles >$null
|
||||
write-verbose "Making Windows Terminal Portable..."
|
||||
New-Item -Type Directory -Path (Join-Path $saveTo "/windows-terminal/settings") -ErrorAction SilentlyContinue >$null
|
||||
New-Item -Type File -Path (Join-Path $saveTo "/windows-terminal/.portable") -ErrorAction SilentlyContinue >$null
|
||||
}
|
||||
|
||||
if ((Get-ChildItem $s.name).Count -eq 1) {
|
||||
Flatten-Directory($s.name)
|
||||
}
|
||||
@ -146,6 +179,12 @@ if (-not $noVendor) {
|
||||
Copy-Item $ConEmuXmlSave $ConEmuXml
|
||||
}
|
||||
|
||||
# Restore Windows Terminal user configuration
|
||||
if ($WinTermSettingsJson -ne "") {
|
||||
Write-Verbose "Restore '$WinTermSettingsJsonSave' to '$WinTermSettingsJson'"
|
||||
Copy-Item $WinTermSettingsJsonSave $WinTermSettingsJson
|
||||
}
|
||||
|
||||
# Put vendor\cmder.sh in /etc/profile.d so it runs when we start bash or mintty
|
||||
if ( (Test-Path $($saveTo + "git-for-windows/etc/profile.d") ) ) {
|
||||
Write-Verbose "Adding cmder.sh /etc/profile.d"
|
||||
|
@ -31,6 +31,9 @@ Param(
|
||||
# Path to the vendor configuration source file
|
||||
[string]$cmderRoot = "$PSScriptRoot\..",
|
||||
|
||||
# Using this option will pack artifacts for a specific included terminal emulator [none, all, conemu-maximus5, or windows-terminal]
|
||||
[string]$terminal = 'all',
|
||||
|
||||
# Vendor folder locaton
|
||||
[string]$saveTo = "$PSScriptRoot\..\build"
|
||||
)
|
||||
@ -41,10 +44,36 @@ $cmderRoot = Resolve-Path $cmderRoot
|
||||
$ErrorActionPreference = "Stop"
|
||||
Ensure-Executable "7z"
|
||||
|
||||
$targets = @{
|
||||
"cmder.7z" = "-t7z -m0=lzma2 -mx=9 -mfb=64 -md=32m -ms=on -myx=7 -mqs=on";
|
||||
"cmder.zip" = "-mm=Deflate -mfb=128 -mpass=3";
|
||||
"cmder_mini.zip" = "-xr!`"vendor\git-for-windows`"";
|
||||
if ($terminal -eq "none") {
|
||||
$targets = @{
|
||||
"cmder_win.7z" = "-t7z -m0=lzma2 -mx=9 -mfb=64 -md=32m -ms=on -myx=7 -mqs=on -xr!`"vendor\conemu-maximus5`" -xr!`"vendor\windows-terminal`"";
|
||||
"cmder_win.zip" = "-mm=Deflate -mfb=128 -mpass=3 -xr!`"vendor\conemu-maximus5`" -xr!`"vendor\windows-terminal`"";
|
||||
"cmder_win.mini.zip" = "-xr!`"vendor\git-for-windows`" -xr!`"vendor\conemu-maximus5`" -xr!`"vendor\windows-terminal`"";
|
||||
}
|
||||
} elseif ($terminal -eq "windows-terminal") {
|
||||
$targets = @{
|
||||
"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`"";
|
||||
}
|
||||
} elseif ($terminal -eq "windows-terminal") {
|
||||
$targets = @{
|
||||
"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`"";
|
||||
}
|
||||
} else {
|
||||
$targets = @{
|
||||
"cmder_win.7z" = "-t7z -m0=lzma2 -mx=9 -mfb=64 -md=32m -ms=on -myx=7 -mqs=on -xr!`"vendor\conemu-maximus5`" -xr!`"vendor\windows-terminal`"";
|
||||
"cmder_win.zip" = "-mm=Deflate -mfb=128 -mpass=3 -xr!`"vendor\conemu-maximus5`" -xr!`"vendor\windows-terminal`"";
|
||||
"cmder_win_mini.zip" = "-xr!`"vendor\git-for-windows`" -xr!`"vendor\conemu-maximus5`" -xr!`"vendor\windows-terminal`"";
|
||||
"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`"";
|
||||
"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`"";
|
||||
}
|
||||
}
|
||||
|
||||
Push-Location -Path $cmderRoot
|
||||
|
Reference in New Issue
Block a user