Write Windows installer config without BOM
ci / test (push) Canceled after 0s
ci / fuzz-smoke (push) Canceled after 0s
ci / macos-client (macos-aarch64, macos-14) (push) Canceled after 0s
ci / macos-client (macos-x86_64, macos-13) (push) Canceled after 0s
ci / windows-client (push) Canceled after 0s
ci / package-release (linux-x86_64, ubuntu-latest, , , ) (push) Canceled after 0s
ci / package-release (macos-aarch64, macos-14, , , ) (push) Canceled after 0s
ci / package-release (macos-x86_64, macos-13, , , ) (push) Canceled after 0s
ci / package-release (windows-aarch64, windows-latest, aarch64, windows, aarch64-pc-windows-msvc) (push) Canceled after 0s
ci / package-release (windows-x86_64, windows-latest, , , ) (push) Canceled after 0s
ci / remote-bench (push) Canceled after 0s
ci / publish-gitea-release (push) Canceled after 0s
ci / test (push) Canceled after 0s
ci / fuzz-smoke (push) Canceled after 0s
ci / macos-client (macos-aarch64, macos-14) (push) Canceled after 0s
ci / macos-client (macos-x86_64, macos-13) (push) Canceled after 0s
ci / windows-client (push) Canceled after 0s
ci / package-release (linux-x86_64, ubuntu-latest, , , ) (push) Canceled after 0s
ci / package-release (macos-aarch64, macos-14, , , ) (push) Canceled after 0s
ci / package-release (macos-x86_64, macos-13, , , ) (push) Canceled after 0s
ci / package-release (windows-aarch64, windows-latest, aarch64, windows, aarch64-pc-windows-msvc) (push) Canceled after 0s
ci / package-release (windows-x86_64, windows-latest, , , ) (push) Canceled after 0s
ci / remote-bench (push) Canceled after 0s
ci / publish-gitea-release (push) Canceled after 0s
This commit is contained in:
+11
-4
@@ -345,6 +345,11 @@ function Add-UserPath($PathToAdd) {
|
|||||||
[Environment]::SetEnvironmentVariable("Path", $next, "User")
|
[Environment]::SetEnvironmentVariable("Path", $next, "User")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function Write-Utf8NoBom($Path, $Content) {
|
||||||
|
$encoding = New-Object System.Text.UTF8Encoding -ArgumentList $false
|
||||||
|
[System.IO.File]::WriteAllText($Path, $Content, $encoding)
|
||||||
|
}
|
||||||
|
|
||||||
$bindir = Join-Path $Prefix "bin"
|
$bindir = Join-Path $Prefix "bin"
|
||||||
$configDir = Join-Path $HOME ".config\dosh"
|
$configDir = Join-Path $HOME ".config\dosh"
|
||||||
New-Item -ItemType Directory -Force -Path $bindir, $configDir | Out-Null
|
New-Item -ItemType Directory -Force -Path $bindir, $configDir | Out-Null
|
||||||
@@ -446,7 +451,7 @@ if ($ForceConfig -or -not (Test-Path $clientConfig)) {
|
|||||||
$defaultServer = if ($Server) { $Server } else { "user@example.com" }
|
$defaultServer = if ($Server) { $Server } else { "user@example.com" }
|
||||||
$updateRepo = if ($Repo) { $Repo } else { "https://git.palav.dev/Palav/dosh.git" }
|
$updateRepo = if ($Repo) { $Repo } else { "https://git.palav.dev/Palav/dosh.git" }
|
||||||
$doshHostLine = if ($DoshHost) { "dosh_host = `"$DoshHost`"" } else { "# dosh_host = `"public.example.com`"" }
|
$doshHostLine = if ($DoshHost) { "dosh_host = `"$DoshHost`"" } else { "# dosh_host = `"public.example.com`"" }
|
||||||
@"
|
$clientToml = @"
|
||||||
update_repo = "$updateRepo"
|
update_repo = "$updateRepo"
|
||||||
update_port = $Port
|
update_port = $Port
|
||||||
server = "$defaultServer"
|
server = "$defaultServer"
|
||||||
@@ -469,14 +474,15 @@ identity_files = ["~/.ssh/id_ed25519"]
|
|||||||
use_ssh_agent = true
|
use_ssh_agent = true
|
||||||
forward_agent = false
|
forward_agent = false
|
||||||
escape_key = "^]"
|
escape_key = "^]"
|
||||||
"@ | Set-Content -NoNewline -Encoding utf8 $clientConfig
|
"@
|
||||||
|
Write-Utf8NoBom $clientConfig $clientToml
|
||||||
}
|
}
|
||||||
|
|
||||||
$hostsConfig = Join-Path $configDir "hosts.toml"
|
$hostsConfig = Join-Path $configDir "hosts.toml"
|
||||||
if ($ForceConfig -or -not (Test-Path $hostsConfig)) {
|
if ($ForceConfig -or -not (Test-Path $hostsConfig)) {
|
||||||
$defaultServer = if ($Server) { $Server } else { "user@example.com" }
|
$defaultServer = if ($Server) { $Server } else { "user@example.com" }
|
||||||
$hostUdpLine = if ($DoshHost) { "dosh_host = `"$DoshHost`"" } else { "# dosh_host = `"server.example.com`"" }
|
$hostUdpLine = if ($DoshHost) { "dosh_host = `"$DoshHost`"" } else { "# dosh_host = `"server.example.com`"" }
|
||||||
@"
|
$hostsToml = @"
|
||||||
# Example:
|
# Example:
|
||||||
# [server]
|
# [server]
|
||||||
# ssh = "server"
|
# ssh = "server"
|
||||||
@@ -490,7 +496,8 @@ ssh = "$defaultServer"
|
|||||||
$hostUdpLine
|
$hostUdpLine
|
||||||
port = $Port
|
port = $Port
|
||||||
predict = true
|
predict = true
|
||||||
"@ | Set-Content -NoNewline -Encoding utf8 $hostsConfig
|
"@
|
||||||
|
Write-Utf8NoBom $hostsConfig $hostsToml
|
||||||
}
|
}
|
||||||
|
|
||||||
Add-UserPath $bindir
|
Add-UserPath $bindir
|
||||||
|
|||||||
Reference in New Issue
Block a user