Skip to content

Commit fca1f2c

Browse files
committed
fix(install): install helm error
1 parent 742bb28 commit fca1f2c

1 file changed

Lines changed: 17 additions & 13 deletions

File tree

install.sh

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -63,19 +63,31 @@ urlencode() {
6363
}
6464

6565
function install_helm {
66+
echo -e "\\033[32m---> Start install helm\\033[0m"
6667
if [[ "${INSTALL_DRYCC_MIRROR}" == "cn" ]] ; then
67-
version=$(curl -Ls https://github.com/helm/helm/releases|grep /helm/helm/releases/tag/ | sed -E 's/.*\/helm\/helm\/releases\/tag\/(v[0-9\.]{1,}(-rc.[0-9]{1,})?)".*/\1/g' | head -1)
68+
version=$(curl -Ls https://github.com/helm/helm/releases \
69+
| grep -o 'href="/helm/helm/releases/tag/v[^"]*"' \
70+
| sed 's|href="/helm/helm/releases/tag/||; s/"$//' \
71+
| grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' \
72+
| sort -Vr \
73+
| head -1)
6874
tar_name="helm-${version}-linux-${ARCH}.tar.gz"
6975
helm_download_url="https://github.com/helm/${tar_name}"
7076
else
71-
version=$(curl -Ls https://github.com/helm/helm/releases|grep /helm/helm/releases/tag/ | sed -E 's/.*\/helm\/helm\/releases\/tag\/(v[0-9\.]{1,}(-rc.[0-9]{1,})?)".*/\1/g' | head -1)
77+
version=$(curl -Ls https://github.com/helm/helm/releases \
78+
| grep -o 'href="/helm/helm/releases/tag/v[^"]*"' \
79+
| sed 's|href="/helm/helm/releases/tag/||; s/"$//' \
80+
| grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' \
81+
| sort -Vr \
82+
| head -1)
7283
tar_name="helm-${version}-linux-${ARCH}.tar.gz"
7384
helm_download_url="https://get.helm.sh/${tar_name}"
7485
fi
7586
curl -fsSL -o "${tar_name}" "${helm_download_url}"
7687
tar -zxvf "${tar_name}"
7788
mv "linux-${ARCH}/helm" /usr/local/bin/helm
7889
rm -rf "${tar_name}" "linux-${ARCH}"
90+
echo -e "\\033[32m---> crun runtime install completed!\\033[0m"
7991
}
8092

8193
function configure_os {
@@ -140,11 +152,11 @@ function install_kata_runtime {
140152
fi
141153

142154
kata_version=$(curl -Ls ${kata_base_url}/kata-containers/releases|grep /kata-containers/kata-containers/releases/tag/ | sed -E 's/.*\/kata-containers\/kata-containers\/releases\/tag\/([0-9\.]{1,}(-rc.[0-9]{1,})?)".*/\1/g' | head -1)
143-
kata_package=kata-static-${kata_version}-${ARCH}.tar.xz
155+
kata_package=kata-static-${kata_version}-${ARCH}.tar.zst
144156
kata_download_url=${kata_base_url}/kata-containers/releases/download/${kata_version}/${kata_package}
145157

146-
curl -sfL "${kata_download_url}" -o ${kata_package}
147-
tar xvf ${kata_package} -C /
158+
curl -fL "${kata_download_url}" -o ${kata_package}
159+
tar -I zstd -xf ${kata_package} -C /
148160
ln -s /opt/kata/bin/containerd-shim-kata-v2 /usr/local/bin/containerd-shim-kata-v2
149161
ln -s /opt/kata/bin/kata-collect-data.sh /usr/local/bin/kata-collect-data.sh
150162
ln -s /opt/kata/bin/kata-runtime /usr/local/bin/kata-runtime
@@ -234,18 +246,10 @@ function configure_k3s_mirrors {
234246
if [[ "${INSTALL_DRYCC_MIRROR}" == "cn" ]] ; then
235247
INSTALL_K3S_MIRROR="${INSTALL_DRYCC_MIRROR}"
236248
k3s_install_url="https://github.com/get-k3s/"
237-
K3S_RELEASE_URL=https://github.com/k3s-io/k3s/releases
238249
export INSTALL_K3S_MIRROR
239250
else
240251
k3s_install_url="https://get.k3s.io"
241-
K3S_RELEASE_URL=github.com/k3s-io/k3s/releases
242-
fi
243-
if [ -z "${INSTALL_K3S_VERSION}" ]; then
244-
INSTALL_K3S_VERSION=$(curl -Ls "$K3S_RELEASE_URL" | grep /k3s-io/k3s/releases/tag/ | sed -E 's/.*\/k3s-io\/k3s\/releases\/tag\/(v[0-9\.]{1,}[rc0-9\-]{0,}%2Bk3s[0-9])".*/\1/g' | head -1)
245-
else
246-
INSTALL_K3S_VERSION=$(urlencode "$INSTALL_K3S_VERSION")
247252
fi
248-
export INSTALL_K3S_VERSION
249253
echo -e "\\033[32m---> Configuring k3s mirrors finish\\033[0m"
250254
}
251255

0 commit comments

Comments
 (0)