mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-04-28 11:30:15 +00:00
fix: fall back to Pulse server when GitHub download fails for pulse-sensor-proxy
The install-sensor-proxy.sh script now tries GitHub releases first, then falls back to downloading from the Pulse server if GitHub fails or doesn't have the binary (common when building from main). The LXC installer sets PULSE_SENSOR_PROXY_FALLBACK_URL to point to the Pulse server running inside the newly created LXC, ensuring the proxy binary can be downloaded from /api/install/pulse-sensor-proxy. This fixes the issue where installing with --main would fail to install pulse-sensor-proxy on the host because GitHub releases don't include it yet.
This commit is contained in:
parent
97c895dbb1
commit
f81d77bb98
2 changed files with 31 additions and 24 deletions
|
|
@ -191,34 +191,39 @@ else
|
|||
esac
|
||||
|
||||
# If fallback URL is provided (e.g., from Pulse setup script), use it directly
|
||||
if [[ -n "$FALLBACK_BASE" ]]; then
|
||||
# Try GitHub first for releases
|
||||
GITHUB_REPO="rcourtman/Pulse"
|
||||
DOWNLOAD_SUCCESS=false
|
||||
|
||||
if [[ "$VERSION" == "latest" ]]; then
|
||||
RELEASE_URL="https://api.github.com/repos/$GITHUB_REPO/releases/latest"
|
||||
print_info "Fetching latest release info..."
|
||||
RELEASE_DATA=$(curl -fsSL "$RELEASE_URL" 2>/dev/null)
|
||||
VERSION=$(echo "$RELEASE_DATA" | grep -o '"tag_name": "[^"]*"' | cut -d'"' -f4)
|
||||
|
||||
if [[ -n "$VERSION" ]]; then
|
||||
print_info "Latest version: $VERSION"
|
||||
DOWNLOAD_URL="https://github.com/$GITHUB_REPO/releases/download/$VERSION/$BINARY_NAME"
|
||||
print_info "Downloading $BINARY_NAME from GitHub..."
|
||||
if curl -fsSL "$DOWNLOAD_URL" -o "$BINARY_PATH.tmp" 2>/dev/null; then
|
||||
DOWNLOAD_SUCCESS=true
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# Fall back to Pulse server if GitHub failed or fallback is provided
|
||||
if [[ "$DOWNLOAD_SUCCESS" != true ]] && [[ -n "$FALLBACK_BASE" ]]; then
|
||||
FALLBACK_URL="${FALLBACK_BASE%/}?arch=${ARCH_LABEL}"
|
||||
print_info "Downloading $BINARY_NAME from Pulse server..."
|
||||
if ! curl -fsSL "$FALLBACK_URL" -o "$BINARY_PATH.tmp"; then
|
||||
print_error "Failed to download proxy binary from $FALLBACK_URL"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
# Fallback not provided, download from GitHub release
|
||||
GITHUB_REPO="rcourtman/Pulse"
|
||||
if [[ "$VERSION" == "latest" ]]; then
|
||||
RELEASE_URL="https://api.github.com/repos/$GITHUB_REPO/releases/latest"
|
||||
print_info "Fetching latest release info..."
|
||||
RELEASE_DATA=$(curl -fsSL "$RELEASE_URL")
|
||||
VERSION=$(echo "$RELEASE_DATA" | grep -o '"tag_name": "[^"]*"' | cut -d'"' -f4)
|
||||
if [[ -z "$VERSION" ]]; then
|
||||
print_error "Failed to determine latest version"
|
||||
exit 1
|
||||
fi
|
||||
print_info "Latest version: $VERSION"
|
||||
if curl -fsSL "$FALLBACK_URL" -o "$BINARY_PATH.tmp" 2>/dev/null; then
|
||||
DOWNLOAD_SUCCESS=true
|
||||
fi
|
||||
fi
|
||||
|
||||
DOWNLOAD_URL="https://github.com/$GITHUB_REPO/releases/download/$VERSION/$BINARY_NAME"
|
||||
print_info "Downloading $BINARY_NAME from GitHub..."
|
||||
if ! curl -fsSL "$DOWNLOAD_URL" -o "$BINARY_PATH.tmp"; then
|
||||
print_error "Failed to download binary from $DOWNLOAD_URL"
|
||||
exit 1
|
||||
fi
|
||||
# Exit if both methods failed
|
||||
if [[ "$DOWNLOAD_SUCCESS" != true ]]; then
|
||||
print_error "Failed to download binary from GitHub or Pulse server"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Make executable and move to final location
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue