release: bump version to 0.75.2
This commit is contained in:
1 parent
003b316d42
commit
a2025dbfe0
11 files changed
+105
-12
No files matched your search
@@ -114,7 +114,10 @@ function Install-PlanetDesktopLauncher {
|
||||
'@echo off', 'setlocal EnableExtensions DisableDelayedExpansion', $marker,
|
||||
'set "PLANET_LAUNCHER_INSTALL_ONLY="',
|
||||
'if /i "%~1"=="--install-only" set "PLANET_LAUNCHER_INSTALL_ONLY=1"',
|
||||
"powershell.exe -NoLogo -NoProfile -ExecutionPolicy Bypass -EncodedCommand $encoded",
|
||||
'set "PLANET_POWERSHELL=powershell.exe"',
|
||||
'where.exe pwsh.exe >nul 2>&1',
|
||||
'if not errorlevel 1 set "PLANET_POWERSHELL=pwsh.exe"',
|
||||
"%PLANET_POWERSHELL% -NoLogo -NoProfile -ExecutionPolicy Bypass -EncodedCommand $encoded",
|
||||
'set "planet_launcher_exit=%errorlevel%"',
|
||||
'if not "%planet_launcher_exit%"=="0" pause',
|
||||
'exit /b %planet_launcher_exit%'
|
||||
@@ -129,18 +132,39 @@ function Test-PlanetAdministrator {
|
||||
return $principal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
|
||||
}
|
||||
|
||||
function Get-PlanetTerminalLaunch {
|
||||
param([string]$EncodedCommand)
|
||||
$shell = Get-Command pwsh.exe -CommandType Application -ErrorAction SilentlyContinue |
|
||||
Select-Object -First 1
|
||||
if (-not $shell) {
|
||||
$shell = Get-Command powershell.exe -CommandType Application -ErrorAction Stop |
|
||||
Select-Object -First 1
|
||||
}
|
||||
$shellArguments = "-NoLogo -NoProfile -NoExit -ExecutionPolicy Bypass -EncodedCommand $EncodedCommand"
|
||||
$launch = @{ FilePath = $shell.Source; ArgumentList = $shellArguments; WindowStyle = 'Normal' }
|
||||
$terminal = Get-Command wt.exe -CommandType Application -ErrorAction SilentlyContinue |
|
||||
Select-Object -First 1
|
||||
if ($terminal) {
|
||||
$launch.FilePath = $terminal.Source
|
||||
# Start-Process joins arguments: quote the executable path explicitly.
|
||||
$launch.ArgumentList = '-w new new-tab --title Planet "' + $shell.Source + '" ' + $shellArguments
|
||||
}
|
||||
return $launch
|
||||
}
|
||||
|
||||
function Start-PlanetRestart {
|
||||
param([hashtable]$Target, [switch]$AlreadyElevated)
|
||||
$script:PlanetLauncherExitCode = 0
|
||||
if (-not (Test-PlanetAdministrator)) {
|
||||
if ($AlreadyElevated) { throw 'Administrator elevation was not granted.' }
|
||||
$isAdministrator = Test-PlanetAdministrator
|
||||
if (-not $AlreadyElevated) {
|
||||
$encoded = ConvertTo-PlanetEncodedCommand (Get-PlanetBootstrap $Target -RunElevated)
|
||||
$launch = Get-PlanetTerminalLaunch $encoded
|
||||
if (-not $isAdministrator) { $launch.Verb = 'RunAs' }
|
||||
# An interactive terminal is intentional: startup logs and the WSL shell stay visible.
|
||||
Start-Process powershell.exe -Verb RunAs -WindowStyle Normal -ArgumentList @(
|
||||
'-NoLogo', '-NoProfile', '-NoExit', '-ExecutionPolicy', 'Bypass', '-EncodedCommand', $encoded
|
||||
) | Out-Null
|
||||
Start-Process @launch | Out-Null
|
||||
return
|
||||
}
|
||||
if (-not $isAdministrator) { throw 'Administrator elevation was not granted.' }
|
||||
Write-Host "Restarting Planet in $($Target.Distro):$($Target.LinuxProjectRoot)"
|
||||
& wsl.exe -d $Target.Distro --cd $Target.LinuxProjectRoot --exec zsh -l -i ($Target.LinuxProjectRoot + '/scripts/windows/restart.zsh')
|
||||
$script:PlanetLauncherExitCode = $LASTEXITCODE
|
||||
|
||||
Reference in new issue
Block a user