Skip to content

Commit

Permalink
fix(cr): polished install-okctl script
Browse files Browse the repository at this point in the history
  • Loading branch information
powerfooI committed Dec 24, 2024
1 parent 19ff0a9 commit 2b12be2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 4 additions & 5 deletions scripts/install-okctl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -58,8 +58,7 @@ while [[ $# -gt 0 ]]; do
exit 0
;;
-p|--proxy)
PROXY="$2"
shift
USE_PROXY=true
shift
;;
*)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 2b12be2

Please sign in to comment.