fix: correct checksum URL construction in install script

The checksum URL was incorrectly constructed by appending .sha256
to the entire download URL including query parameters, resulting in:
  /download/pulse-host-agent?platform=linux&arch=amd64.sha256

This caused .sha256 to be part of the arch parameter, which prevented
the checksum endpoint from being reached correctly.

Fixed to construct checksum URL with .sha256 as part of the path:
  /download/pulse-host-agent.sha256?platform=linux&arch=amd64

Tested on Proxmox VE host (delly):
- Installation: ✓ Binary downloaded and installed successfully
- Service: ✓ systemd service created, enabled, and started
- Validation: ✓ Service running and attempting to report
- Logs: ✓ JSON logs writing to /var/log/pulse/host-agent.log
- Uninstallation: ✓ Complete cleanup (binary, service, logs)
- Colors: ✓ ANSI colored output working properly

Note: Checksum validation gracefully handled when endpoint
unavailable (server doesn't provide checksums yet)
This commit is contained in:
rcourtman 2025-10-23 22:34:07 +00:00
parent b4247fc095
commit 8fb9ef2e8f
3 changed files with 6 additions and 5 deletions

View file

@ -246,12 +246,12 @@ fi
# Download agent binary from Pulse server
DOWNLOAD_URL="$PULSE_URL/download/pulse-host-agent?platform=$PLATFORM&arch=$ARCH"
CHECKSUM_URL="$PULSE_URL/download/pulse-host-agent.sha256?platform=$PLATFORM&arch=$ARCH"
TEMP_BINARY="/tmp/pulse-host-agent-$$.tmp"
log_info "Downloading agent binary from $PULSE_URL..."
DOWNLOAD_SUCCESS=false
CHECKSUM_URL="${DOWNLOAD_URL}.sha256"
if command -v curl &> /dev/null; then
if curl -fL --progress-bar -o "$TEMP_BINARY" "$DOWNLOAD_URL" 2>&1; then

View file

@ -183,8 +183,8 @@ export const APITokenManager: Component<APITokenManagerProps> = (props) => {
const { token, record } = await SecurityAPI.createToken(trimmedName, scopePayload);
setTokens((prev) => [record, ...prev]);
setNewTokenValue(token);
setNewTokenRecord(record);
setNewTokenValue(token);
setNameInput('');
showTokenReveal({
@ -212,7 +212,8 @@ export const APITokenManager: Component<APITokenManagerProps> = (props) => {
}
};
const tokenHint = (record: APITokenRecord) => {
const tokenHint = (record: APITokenRecord | null | undefined) => {
if (!record) return '—';
if (record.prefix && record.suffix) {
return `${record.prefix}${record.suffix}`;
}
@ -398,7 +399,7 @@ export const APITokenManager: Component<APITokenManagerProps> = (props) => {
class="flex flex-wrap items-center justify-between gap-3 border border-green-300/70 text-sm text-green-800 dark:border-green-700/70 dark:text-green-200"
>
<span>
Token generated: <strong>{newTokenRecord()?.name || 'Untitled'}</strong> ({tokenHint(newTokenRecord()!)})
Token generated: <strong>{newTokenRecord()?.name || 'Untitled'}</strong> ({tokenHint(newTokenRecord())})
</span>
<div class="flex items-center gap-3 text-xs">
<button onClick={reopenTokenDialog} class="font-medium underline decoration-green-500/50 underline-offset-2 hover:text-green-900 dark:hover:text-green-100">

View file

@ -246,12 +246,12 @@ fi
# Download agent binary from Pulse server
DOWNLOAD_URL="$PULSE_URL/download/pulse-host-agent?platform=$PLATFORM&arch=$ARCH"
CHECKSUM_URL="$PULSE_URL/download/pulse-host-agent.sha256?platform=$PLATFORM&arch=$ARCH"
TEMP_BINARY="/tmp/pulse-host-agent-$$.tmp"
log_info "Downloading agent binary from $PULSE_URL..."
DOWNLOAD_SUCCESS=false
CHECKSUM_URL="${DOWNLOAD_URL}.sha256"
if command -v curl &> /dev/null; then
if curl -fL --progress-bar -o "$TEMP_BINARY" "$DOWNLOAD_URL" 2>&1; then