Created
February 18, 2025 15:15
-
-
Save tonidy/411f235c39b24a10e3c396cce9e803f6 to your computer and use it in GitHub Desktop.
k0s
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh set -e if [ -n "${DEBUG}" ]; then set -x fi _k0s_latest() { curl -sSLf "https://docs.k0sproject.io/stable.txt" } _detect_binary() { os="$(uname)" case "$os" in Linux) echo "k0s" ;; *) echo "Unsupported operating system: $os" 1>&2; return 1 ;; esac unset os } _detect_arch() { arch="$(uname -m)" case "$arch" in amd64|x86_64) echo "amd64" ;; arm64|aarch64) echo "arm64" ;; armv7l|armv8l|arm) echo "arm" ;; *) echo "Unsupported processor architecture: $arch" 1>&2; return 1 ;; esac unset arch } _download_url() { echo "https://github.com/k0sproject/k0s/releases/download/$K0S_VERSION/$k0sBinary-$K0S_VERSION-$k0sArch" } main() { if [ -z "${K0S_VERSION}" ]; then K0S_VERSION=$(_k0s_latest) fi k0sInstallPath=/usr/local/bin k0sBinary="$(_detect_binary)" k0sArch="$(_detect_arch)" k0sDownloadUrl="$(_download_url)" mkdir -p -- "$k0sInstallPath" echo "Downloading k0s from URL: $k0sDownloadUrl" curl -sSLf "$k0sDownloadUrl" >"$k0sInstallPath/$k0sBinary" chmod 755 -- "$k0sInstallPath/$k0sBinary" echo "k0s is now executable in $k0sInstallPath" echo "You can use it to complete the installation of k0s on this node, " echo "see https://docs.k0sproject.io/stable/install/ for more information." } main |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment