Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 578355c919 | |||
| 471d00f697 | |||
| 1762e02a8d |
20
README.md
20
README.md
@@ -1,3 +1,19 @@
|
||||
# releases-test
|
||||
# Agent Hub
|
||||
|
||||
A test feed for checks of Agent Hub's release publishing; nothing here is for installing.
|
||||
Install Agent Hub with one line, no login. Running it again updates Agent Hub.
|
||||
|
||||
**Windows**, in PowerShell:
|
||||
|
||||
```powershell
|
||||
irm https://git.bengles.se/agent-hub/releases-test/raw/branch/main/install.ps1 | iex
|
||||
```
|
||||
|
||||
**Linux** (x86_64), in a terminal:
|
||||
|
||||
```sh
|
||||
curl -fsSL https://git.bengles.se/agent-hub/releases-test/raw/branch/main/install.sh | sh
|
||||
```
|
||||
|
||||
Or download the newest setup file and run it: [agent-hub-setup.exe](https://git.bengles.se/agent-hub/releases-test/releases/download/latest/agent-hub-setup.exe) (Windows) or [agent-hub-setup-linux](https://git.bengles.se/agent-hub/releases-test/releases/download/latest/agent-hub-setup-linux) (Linux).
|
||||
|
||||
Every build is a release here, the newest 3 of them; the `latest` release holds the newest build's files.
|
||||
|
||||
42
install.ps1
Normal file
42
install.ps1
Normal file
@@ -0,0 +1,42 @@
|
||||
# Agent Hub's install: installs the newest Agent Hub for this user and opens it; running it again updates (HUB-10).
|
||||
# Its line: irm https://git.bengles.se/agent-hub/releases-test/raw/branch/main/install.ps1 | iex
|
||||
# AGENT_HUB_SETUP_ARGS, when set, is added to the setup's arguments, e.g. --no-start.
|
||||
& {
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$ProgressPreference = 'SilentlyContinue'
|
||||
$v = $PSVersionTable.PSVersion
|
||||
if ($v.Major -lt 5 -or ($v.Major -eq 5 -and $v.Minor -lt 1) -or ($PSVersionTable.PSEdition -eq 'Core' -and -not $IsWindows)) {
|
||||
Write-Host 'This line installs Agent Hub on Windows, from PowerShell 5.1 or later. On Linux, run the page''s curl line.' -ForegroundColor Red
|
||||
return
|
||||
}
|
||||
if ($PSVersionTable.PSEdition -ne 'Core') {
|
||||
[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12
|
||||
}
|
||||
$exe = Join-Path $env:TEMP 'agent-hub-setup.exe'
|
||||
Write-Host 'Downloading Agent Hub...'
|
||||
try {
|
||||
Invoke-WebRequest -Uri 'https://git.bengles.se/agent-hub/releases-test/releases/download/latest/agent-hub-setup.exe' -OutFile $exe -UseBasicParsing
|
||||
} catch {
|
||||
$failure = $_
|
||||
$status = 0
|
||||
try { $status = [int]$failure.Exception.Response.StatusCode } catch {}
|
||||
if ($status -eq 0) {
|
||||
try { Invoke-WebRequest -Uri 'https://git.bengles.se/agent-hub/releases-test/releases/download/latest/agent-hub-setup.exe' -Method Head -UseBasicParsing | Out-Null }
|
||||
catch { try { $status = [int]$_.Exception.Response.StatusCode } catch {} }
|
||||
}
|
||||
if ($status -eq 404) { Write-Host 'Can''t download Agent Hub from git.bengles.se/agent-hub/releases-test: it has no release yet. Try again in a minute.' -ForegroundColor Red }
|
||||
else { Write-Host ('Can''t download Agent Hub from git.bengles.se/agent-hub/releases-test: ' + $failure.Exception.Message + ' ' + 'Try again in a minute.') -ForegroundColor Red }
|
||||
return
|
||||
}
|
||||
$saved = @{}
|
||||
$extra = @("$env:AGENT_HUB_SETUP_ARGS" -split '\s+' | Where-Object { $_ })
|
||||
Write-Host 'Installing Agent Hub...'
|
||||
try {
|
||||
& $exe @extra
|
||||
$code = $LASTEXITCODE
|
||||
} finally {
|
||||
foreach ($name in $saved.Keys) { [Environment]::SetEnvironmentVariable($name, $saved[$name]) }
|
||||
}
|
||||
Remove-Item $exe -ErrorAction SilentlyContinue
|
||||
if ($code -ne 0) { Write-Host 'Agent Hub''s setup stopped: see above.' -ForegroundColor Red }
|
||||
}
|
||||
28
install.sh
Normal file
28
install.sh
Normal file
@@ -0,0 +1,28 @@
|
||||
#!/bin/sh
|
||||
# Agent Hub's install: installs the newest Agent Hub for this user and opens it; running it again updates (HUB-10).
|
||||
# Its line: curl -fsSL https://git.bengles.se/agent-hub/releases-test/raw/branch/main/install.sh | sh
|
||||
# AGENT_HUB_SETUP_ARGS, when set, is added to the setup's arguments, e.g. --no-start.
|
||||
agent_hub_install() {
|
||||
if [ "$(uname -s)" != Linux ] || [ "$(uname -m)" != x86_64 ]; then
|
||||
echo 'This line installs Agent Hub on Linux (x86_64). On Windows, run the page'\''s PowerShell line.' >&2
|
||||
return 1
|
||||
fi
|
||||
command -v curl >/dev/null 2>&1 || { echo 'Installing Agent Hub needs curl.' >&2; return 1; }
|
||||
dir=$(mktemp -d) || return 1
|
||||
exe="$dir/agent-hub-setup-linux"
|
||||
echo 'Downloading Agent Hub...'
|
||||
status=$(curl -sSL -o "$exe" -w '%{http_code}' 'https://git.bengles.se/agent-hub/releases-test/releases/download/latest/agent-hub-setup-linux') || status=${status:-000}
|
||||
case "$status" in
|
||||
200) ;;
|
||||
404) echo 'Can'\''t download Agent Hub from git.bengles.se/agent-hub/releases-test: it has no release yet. Try again in a minute.' >&2; rm -rf "$dir"; return 1 ;;
|
||||
*) echo 'Can'\''t download Agent Hub from git.bengles.se/agent-hub/releases-test'" (HTTP $status). "'Try again in a minute.' >&2; rm -rf "$dir"; return 1 ;;
|
||||
esac
|
||||
chmod +x "$exe"
|
||||
echo 'Installing Agent Hub...'
|
||||
"$exe" ${AGENT_HUB_SETUP_ARGS:-} </dev/null
|
||||
code=$?
|
||||
rm -rf "$dir"
|
||||
[ "$code" -eq 0 ] || echo "Agent Hub's setup stopped: see above." >&2
|
||||
return "$code"
|
||||
}
|
||||
agent_hub_install
|
||||
Reference in New Issue
Block a user