diff --git a/scripts/cloud/install.sh b/scripts/cloud/install.sh index 83daf4dc29a..eae8440cdce 100644 --- a/scripts/cloud/install.sh +++ b/scripts/cloud/install.sh @@ -91,6 +91,7 @@ Options: --cert-path # Certificate path --key-path # Private key path --single # Whether to install on a single node (y/n) + --proxy-prefix # Sealos binary installation address proxy prefix --zh # Chinese prompt --en # English prompt --help # Help information" @@ -151,6 +152,7 @@ Options: --cert-path # 证书路径 --key-path # 私钥路径 --single # 是否单节点安装 (y/n) + --proxy-prefix # sealos二进制安装地址代理前缀 --zh # 中文提示 --en # 英文提示 --help # 帮助信息" @@ -228,9 +230,10 @@ init() { if ! command -v sealos &> /dev/null; then get_prompt "install_sealos" read -p " " installChoice - if [[ $installChoice == "y" || $installChoice == "Y" ]]; then - curl -sfL https://raw.githubusercontent.com/labring/sealos/${SEALOS_VERSION}/scripts/install.sh | - sh -s ${SEALOS_VERSION} labring/sealos + if [[ "${installChoice,,}" == "y" ]]; then + local install_url="https://raw.githubusercontent.com/labring/sealos/${SEALOS_VERSION}/scripts/install.sh" + [ -z "$proxy_prefix" ] || install_url="${proxy_prefix%/}/$install_url" + PROXY_PREFIX=$proxy_prefix curl -sfL "$install_url" | sh -s "${SEALOS_VERSION}" labring/sealos else echo "Please install sealos CLI to proceed." exit 1 @@ -485,6 +488,7 @@ for i in "$@"; do --cert-path=*) cert_path="${i#*=}"; shift ;; --key-path=*) key_path="${i#*=}"; shift ;; --single) single="y"; shift ;; + --proxy-prefix=*) proxy_prefix="${i#*=}"; shift ;; --zh | zh ) LANGUAGE="CN"; shift ;; --en | en ) LANGUAGE="EN"; shift ;; --config=* | -c ) source ${i#*=} > /dev/null; shift ;; @@ -513,6 +517,7 @@ for i in "$@"; do --cloud-port | cloud-port | \ --cert-path | cert-path | \ --key-path | key-path | \ + --proxy-prefix | proxy-prefix | \ --config | config) echo "Please use '--${i#--}=' to assign value to option"; exit 1 ;; -*) echo "Unknown option $i"; exit 1 ;; *) ;; diff --git a/scripts/install.sh b/scripts/install.sh index ac8a653bcdc..d4341f42eaa 100644 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -94,6 +94,9 @@ verify_downloader() { DOWNLOADER=$1 # Set verified executable as our downloader program and return success DOWNLOADER_PREFIX=https://github.com/${OWN_REPO}/releases/download/ + if [ -n "$PROXY_PREFIX" ]; then + DOWNLOADER_PREFIX="${PROXY_PREFIX%/}/${DOWNLOADER_PREFIX}" + fi DOWNLOADER_URL=${DOWNLOADER_PREFIX}${VERSION}/${FILE_NAME}_${VERSION##v}_linux_${ARCH}.tar.gz return 0 }