From 2b12be2794e71e585bdf9832e609b9482d4a0bb8 Mon Sep 17 00:00:00 2001 From: yuyi Date: Tue, 24 Dec 2024 17:39:27 +0800 Subject: [PATCH] fix(cr): polished install-okctl script --- README-CN.md | 2 +- .../zh-Hans/docusaurus-plugin-content-pages/index.md | 2 +- scripts/install-okctl.sh | 9 ++++----- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/README-CN.md b/README-CN.md index 8033a9c3..00e7759d 100644 --- a/README-CN.md +++ b/README-CN.md @@ -82,7 +82,7 @@ terraform apply ```shell # 使用代理 -curl -sL https://gh.wewell.org/https://github.com/oceanbase/ob-operator/blob/master/scripts/install-okctl.sh | bash -s -- --proxy CN +curl -sL https://gh.wewell.org/https://github.com/oceanbase/ob-operator/blob/master/scripts/install-okctl.sh | bash -s -- --proxy # 不使用代理 curl -sL https://raw.githubusercontent.com/oceanbase/ob-operator/master/scripts/install-okctl.sh | bash diff --git a/docsite/i18n/zh-Hans/docusaurus-plugin-content-pages/index.md b/docsite/i18n/zh-Hans/docusaurus-plugin-content-pages/index.md index 71652bb4..55f41db3 100644 --- a/docsite/i18n/zh-Hans/docusaurus-plugin-content-pages/index.md +++ b/docsite/i18n/zh-Hans/docusaurus-plugin-content-pages/index.md @@ -85,7 +85,7 @@ terraform apply ```shell # 使用代理 -curl -sL https://gh.wewell.org/https://github.com/oceanbase/ob-operator/blob/master/scripts/install-okctl.sh | bash -s -- --proxy CN +curl -sL https://gh.wewell.org/https://github.com/oceanbase/ob-operator/blob/master/scripts/install-okctl.sh | bash -s -- --proxy # 不使用代理 curl -sL https://raw.githubusercontent.com/oceanbase/ob-operator/master/scripts/install-okctl.sh | bash diff --git a/scripts/install-okctl.sh b/scripts/install-okctl.sh index af913f24..d9185878 100644 --- a/scripts/install-okctl.sh +++ b/scripts/install-okctl.sh @@ -11,7 +11,7 @@ VERSION="0.1.0" OS=$(uname -s | tr '[:upper:]' '[:lower:]') ARCH=$(uname -m) BINARY_NAME="okctl" -PROXY= +USE_PROXY=false # Map architecture names case ${ARCH} in @@ -58,8 +58,7 @@ while [[ $# -gt 0 ]]; do exit 0 ;; -p|--proxy) - PROXY="$2" - shift + USE_PROXY=true shift ;; *) @@ -92,12 +91,12 @@ check_requirements() { install_binary() { local version=$1 local BINARY_NAME="okctl" - if [ "$PROXY" == "CN" ]; then + if [ $USE_PROXY = true ]; then GITHUB_HOST="https://gh.wewell.org/https://github.com" fi local download_url="${GITHUB_HOST}/${GITHUB_REPO}/releases/download/cli-${version}/${BINARY_NAME}_${version}_${OS}_${ARCH}.tar.gz" - echo "Downloading ${BINARY_NAME} ${version}..." + echo "Downloading ${BINARY_NAME} ${version} from ${download_url} ..." if ! curl -L -o "${BINARY_NAME}_${version}.tar.gz" "${download_url}"; then echo "Error: Failed to download ${download_url}" exit 1