Prefer direct Gitea release assets
ci / test (push) Has been cancelled
ci / fuzz-smoke (push) Has been cancelled
ci / windows-client (push) Has been cancelled
ci / package-release (linux-x86_64, ubuntu-latest) (push) Has been cancelled
ci / package-release (macos-aarch64, macos-14) (push) Has been cancelled
ci / package-release (macos-x86_64, macos-13) (push) Has been cancelled
ci / package-release (windows-x86_64, windows-latest) (push) Has been cancelled
ci / remote-bench (push) Has been cancelled
ci / test (push) Has been cancelled
ci / fuzz-smoke (push) Has been cancelled
ci / windows-client (push) Has been cancelled
ci / package-release (linux-x86_64, ubuntu-latest) (push) Has been cancelled
ci / package-release (macos-aarch64, macos-14) (push) Has been cancelled
ci / package-release (macos-x86_64, macos-13) (push) Has been cancelled
ci / package-release (windows-x86_64, windows-latest) (push) Has been cancelled
ci / remote-bench (push) Has been cancelled
This commit is contained in:
+33
@@ -70,6 +70,36 @@ function Release-DownloadUrl {
|
|||||||
"$web/releases/download/$BinaryVersion/$name"
|
"$web/releases/download/$BinaryVersion/$name"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function Release-LatestTagDownloadUrl {
|
||||||
|
if ($BinaryUrl -or $BinaryBase -or $BinaryVersion -ne "latest") {
|
||||||
|
return $null
|
||||||
|
}
|
||||||
|
$web = Repo-WebBase $Repo
|
||||||
|
if (-not $web) {
|
||||||
|
return $null
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
$response = Invoke-WebRequest -UseBasicParsing -Uri "$web/releases/latest" -MaximumRedirection 5
|
||||||
|
$effective = $null
|
||||||
|
if ($response.BaseResponse.ResponseUri) {
|
||||||
|
$effective = $response.BaseResponse.ResponseUri.AbsoluteUri
|
||||||
|
} elseif ($response.BaseResponse.RequestMessage -and $response.BaseResponse.RequestMessage.RequestUri) {
|
||||||
|
$effective = $response.BaseResponse.RequestMessage.RequestUri.AbsoluteUri
|
||||||
|
}
|
||||||
|
$prefix = "$web/releases/tag/"
|
||||||
|
if ($effective -and $effective.StartsWith($prefix)) {
|
||||||
|
$tag = $effective.Substring($prefix.Length)
|
||||||
|
if ($tag) {
|
||||||
|
return "$web/releases/download/$tag/$(Release-ArtifactName)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
return $null
|
||||||
|
}
|
||||||
|
return $null
|
||||||
|
}
|
||||||
|
|
||||||
function Verify-ArchiveChecksum($Url, $Archive) {
|
function Verify-ArchiveChecksum($Url, $Archive) {
|
||||||
$checksumPath = "$Archive.sha256"
|
$checksumPath = "$Archive.sha256"
|
||||||
try {
|
try {
|
||||||
@@ -91,7 +121,10 @@ $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
|
||||||
|
|
||||||
function Install-Prebuilt {
|
function Install-Prebuilt {
|
||||||
|
$url = Release-LatestTagDownloadUrl
|
||||||
|
if (-not $url) {
|
||||||
$url = Release-DownloadUrl
|
$url = Release-DownloadUrl
|
||||||
|
}
|
||||||
if (-not $url) {
|
if (-not $url) {
|
||||||
return $false
|
return $false
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -265,7 +265,7 @@ verify_archive_checksum() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try_install_prebuilt() {
|
try_install_prebuilt() {
|
||||||
download_url="$(release_download_url)" || return 1
|
download_url="$(release_latest_tag_download_url || release_download_url)" || return 1
|
||||||
tmpdir="$(mktemp -d)"
|
tmpdir="$(mktemp -d)"
|
||||||
archive="$tmpdir/$(release_artifact_name)"
|
archive="$tmpdir/$(release_artifact_name)"
|
||||||
checksum_file="$archive.sha256"
|
checksum_file="$archive.sha256"
|
||||||
@@ -273,7 +273,7 @@ try_install_prebuilt() {
|
|||||||
need curl
|
need curl
|
||||||
need tar
|
need tar
|
||||||
if ! curl -fsL "$download_url" -o "$archive" 2>/dev/null; then
|
if ! curl -fsL "$download_url" -o "$archive" 2>/dev/null; then
|
||||||
alt_download_url="$(release_latest_tag_download_url || true)"
|
alt_download_url="$(release_download_url || true)"
|
||||||
if [ -z "$alt_download_url" ] || ! curl -fsL "$alt_download_url" -o "$archive"; then
|
if [ -z "$alt_download_url" ] || ! curl -fsL "$alt_download_url" -o "$archive"; then
|
||||||
echo "prebuilt unavailable: $download_url" >&2
|
echo "prebuilt unavailable: $download_url" >&2
|
||||||
[ -z "$alt_download_url" ] || echo "prebuilt unavailable: $alt_download_url" >&2
|
[ -z "$alt_download_url" ] || echo "prebuilt unavailable: $alt_download_url" >&2
|
||||||
|
|||||||
@@ -1431,13 +1431,13 @@ fn run_update(config: &dosh::config::ClientConfig, check_only: bool) -> Result<(
|
|||||||
if let Some(latest_url) = latest_release_download_url(&repo, artifact) {
|
if let Some(latest_url) = latest_release_download_url(&repo, artifact) {
|
||||||
let mut status = "missing";
|
let mut status = "missing";
|
||||||
let mut display_url = latest_url.clone();
|
let mut display_url = latest_url.clone();
|
||||||
if url_reachable(&latest_url)? {
|
if let Some(tag_url) = latest_release_tag_download_url(&repo, artifact)?
|
||||||
status = "available";
|
|
||||||
} else if let Some(tag_url) = latest_release_tag_download_url(&repo, artifact)?
|
|
||||||
&& url_reachable(&tag_url)?
|
&& url_reachable(&tag_url)?
|
||||||
{
|
{
|
||||||
status = "available";
|
status = "available";
|
||||||
display_url = tag_url;
|
display_url = tag_url;
|
||||||
|
} else if url_reachable(&latest_url)? {
|
||||||
|
status = "available";
|
||||||
}
|
}
|
||||||
println!("prebuilt: {status} ({artifact})");
|
println!("prebuilt: {status} ({artifact})");
|
||||||
println!("prebuilt_url: {display_url}");
|
println!("prebuilt_url: {display_url}");
|
||||||
@@ -4848,17 +4848,15 @@ impl DisconnectStatus {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Paint `text` on the terminal's bottom row using save/restore cursor so the
|
/// Paint `text` on the terminal's top row using save/restore cursor so the
|
||||||
/// app's cursor is untouched. Sequence: save cursor (ESC 7), move to the last
|
/// app's cursor is untouched.
|
||||||
/// row col 1, clear that row, set reverse-video cyan, write text, reset
|
|
||||||
/// attributes, restore cursor (ESC 8).
|
|
||||||
fn emit(&self, text: &str) -> Result<()> {
|
fn emit(&self, text: &str) -> Result<()> {
|
||||||
let (_, rows) = terminal_size();
|
let (_, rows) = terminal_size();
|
||||||
let bytes = render_status_overlay(text, rows);
|
let bytes = render_status_overlay(text, rows);
|
||||||
emit_status(&bytes)
|
emit_status(&bytes)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Erase the bottom-row status line, again with save/restore cursor.
|
/// Erase the top-row status bar, again with save/restore cursor.
|
||||||
fn emit_clear(&self) -> Result<()> {
|
fn emit_clear(&self) -> Result<()> {
|
||||||
let (_, rows) = terminal_size();
|
let (_, rows) = terminal_size();
|
||||||
emit_status(&render_status_clear(rows))
|
emit_status(&render_status_clear(rows))
|
||||||
|
|||||||
Reference in New Issue
Block a user