n25/scripts/instalL_asciinema.sh
jon brookes 09f36dff16 added gcloud intro
- Created a new script `instalL_asciinema.sh` to automate the installation of asciinema.
- The script detects the operating system and architecture to download the appropriate binary.
- Supports Linux (both musl and GNU) and macOS (Darwin).
- Sets executable permissions for the downloaded binary and verifies the installation by displaying the version.
2025-10-16 10:05:51 +01:00

46 lines
No EOL
1.5 KiB
Bash
Executable file

#!/usr/bin/env bash
## available versions as of Tue 7 Oct 18:34:05 BST 2025
# https://github.com/asciinema/asciinema/releases/download/v3.0.0/asciinema-aarch64-apple-darwin
# https://github.com/asciinema/asciinema/releases/download/v3.0.0/asciinema-aarch64-unknown-linux-gnu
# https://github.com/asciinema/asciinema/releases/download/v3.0.0/asciinema-x86_64-apple-darwin
# https://github.com/asciinema/asciinema/releases/download/v3.0.0/asciinema-x86_64-unknown-linux-gnu
# https://github.com/asciinema/asciinema/releases/download/v3.0.0/asciinema-x86_64-unknown-linux-musl
VERSION="3.0.0"
LINK="https://github.com/asciinema/asciinema/releases/download/v${VERSION}/asciinema-"
unameOut="$(uname -s)"
archOut="$(uname -m)"
case "${unameOut}" in
Linux)
if ldd --version 2>&1 | grep -q musl; then
platform="x86_64-unknown-linux-musl"
else
platform="x86_64-unknown-linux-gnu"
fi
if [[ "${archOut}" == "aarch64" ]]; then
platform="aarch64-unknown-linux-gnu"
fi
;;
Darwin)
if [[ "${archOut}" == "arm64" ]]; then
platform="aarch64-apple-darwin"
else
platform="x86_64-apple-darwin"
fi
;;
*)
echo "Unsupported platform: ${unameOut} ${archOut}"
exit 1
;;
esac
echo "Detected platform: $platform"
echo "installing asciinema version ${VERSION} for ${platform}"
sudo curl -sL "${LINK}${platform}" -o /usr/local/bin/asciinema
sudo chmod +x /usr/local/bin/asciinema
asciinema --version