mirror of
https://github.com/henrygd/beszel.git
synced 2025-12-16 18:26:16 +01:00
update agent install script to use get.beszel.dev/latest-version (#1212)
This commit is contained in:
@@ -212,7 +212,6 @@ detect_mips_endianness() {
|
|||||||
PORT=45876
|
PORT=45876
|
||||||
UNINSTALL=false
|
UNINSTALL=false
|
||||||
GITHUB_URL="https://github.com"
|
GITHUB_URL="https://github.com"
|
||||||
GITHUB_API_URL="https://api.github.com" # not blocked in China currently
|
|
||||||
GITHUB_PROXY_URL=""
|
GITHUB_PROXY_URL=""
|
||||||
KEY=""
|
KEY=""
|
||||||
TOKEN=""
|
TOKEN=""
|
||||||
@@ -301,23 +300,19 @@ while [ $# -gt 0 ]; do
|
|||||||
if [ -n "$CUSTOM_PROXY" ]; then
|
if [ -n "$CUSTOM_PROXY" ]; then
|
||||||
GITHUB_PROXY_URL="$CUSTOM_PROXY"
|
GITHUB_PROXY_URL="$CUSTOM_PROXY"
|
||||||
GITHUB_URL="$(ensure_trailing_slash "$CUSTOM_PROXY")https://github.com"
|
GITHUB_URL="$(ensure_trailing_slash "$CUSTOM_PROXY")https://github.com"
|
||||||
GITHUB_API_URL="$(ensure_trailing_slash "$CUSTOM_PROXY")https://api.github.com"
|
|
||||||
else
|
else
|
||||||
GITHUB_PROXY_URL="https://gh.beszel.dev"
|
GITHUB_PROXY_URL="https://gh.beszel.dev"
|
||||||
GITHUB_URL="$GITHUB_PROXY_URL"
|
GITHUB_URL="$GITHUB_PROXY_URL"
|
||||||
GITHUB_API_URL="$GITHUB_PROXY_URL"
|
|
||||||
fi
|
fi
|
||||||
elif [ "$2" != "" ] && ! echo "$2" | grep -q '^-'; then
|
elif [ "$2" != "" ] && ! echo "$2" | grep -q '^-'; then
|
||||||
# use custom proxy URL provided as next argument
|
# use custom proxy URL provided as next argument
|
||||||
GITHUB_PROXY_URL="$2"
|
GITHUB_PROXY_URL="$2"
|
||||||
GITHUB_URL="$(ensure_trailing_slash "$2")https://github.com"
|
GITHUB_URL="$(ensure_trailing_slash "$2")https://github.com"
|
||||||
GITHUB_API_URL="$(ensure_trailing_slash "$2")https://api.github.com"
|
|
||||||
shift
|
shift
|
||||||
else
|
else
|
||||||
# No value specified, use default
|
# No value specified, use default
|
||||||
GITHUB_PROXY_URL="https://gh.beszel.dev"
|
GITHUB_PROXY_URL="https://gh.beszel.dev"
|
||||||
GITHUB_URL="$GITHUB_PROXY_URL"
|
GITHUB_URL="$GITHUB_PROXY_URL"
|
||||||
GITHUB_API_URL="$GITHUB_PROXY_URL"
|
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
--auto-update*)
|
--auto-update*)
|
||||||
@@ -600,12 +595,12 @@ FILE_NAME="beszel-agent_${OS}_${ARCH}.tar.gz"
|
|||||||
|
|
||||||
# Determine version to install
|
# Determine version to install
|
||||||
if [ "$VERSION" = "latest" ]; then
|
if [ "$VERSION" = "latest" ]; then
|
||||||
API_RELEASE_URL="$GITHUB_API_URL/repos/henrygd/beszel/releases/latest"
|
INSTALL_VERSION=$(curl -s "https://get.beszel.dev/latest-version")
|
||||||
# gh.beszel.dev mirror needs api=true for api.github.com
|
if [ -z "$INSTALL_VERSION" ]; then
|
||||||
if echo "$GITHUB_API_URL" | grep -qE "^https://gh\.beszel\.dev/?$"; then
|
# Fallback to GitHub API
|
||||||
API_RELEASE_URL="$API_RELEASE_URL?api=true"
|
API_RELEASE_URL="https://api.github.com/repos/henrygd/beszel/releases/latest"
|
||||||
|
INSTALL_VERSION=$(curl -s "$API_RELEASE_URL" | grep -o '"tag_name": "v[^"]*"' | cut -d'"' -f4 | tr -d 'v')
|
||||||
fi
|
fi
|
||||||
INSTALL_VERSION=$(curl -s "$API_RELEASE_URL" | grep -o '"tag_name"\s*:\s*"v[^"]*"' | cut -d'"' -f4 | tr -d 'v')
|
|
||||||
if [ -z "$INSTALL_VERSION" ]; then
|
if [ -z "$INSTALL_VERSION" ]; then
|
||||||
echo "Failed to get latest version"
|
echo "Failed to get latest version"
|
||||||
exit 1
|
exit 1
|
||||||
|
|||||||
Reference in New Issue
Block a user