#!/usr/bin/env bashset -e# Ensure the ~/.local/bin directory exists so we can download things into it.LOCAL_BIN="$HOME/.local/bin"mkdir -p "$LOCAL_BIN"# Extract the short commit baked into the linuxdeploy AppImage.appimage_commit() { "$1" --version 2>&1 | grep -oE "git commit ID [0-9a-f]{7,40}" | cut -d' ' -f4}# A helper function to download an architecture-dependent AppImage and install# it in ~/.local/bin.## Usage:# download_appimage $BINARY_NAME $VERSION $COMMIT $REPO_URL## Args:# BINARY_NAME: The name of the AppImage-bundled binary we want to download,# e.g.: "linuxdeploy".# VERSION: The upstream release tag.# COMMIT: The (short) commit SHA the release tag points at; used to# verify the cached binary matches the pinned version.# REPO_URL: The URL of the GitHub repository hosting the release.download_appimage() { BINARY_NAME="$1" VERSION="$2" COMMIT="$3" REPO_URL="$4" APPIMAGE_NAME="$BINARY_NAME-$(uname -m).AppImage" APPIMAGE_PATH="$LOCAL_BIN/$APPIMAGE_NAME" if [ -x "$APPIMAGE_PATH" ] && [ "$(appimage_commit "$APPIMAGE_PATH")" = "$COMMIT" ]; then echo "✅ Found $APPIMAGE_NAME in $LOCAL_BIN." else APPIMAGE_RELEASE_URL="$REPO_URL/releases/download/$VERSION/$APPIMAGE_NAME" echo "⬇️ Downloading $APPIMAGE_RELEASE_URL..." curl -fL "$APPIMAGE_RELEASE_URL" --output "$APPIMAGE_PATH" chmod +x "$APPIMAGE_PATH" fi # Create a symlink so we can invoke it like a normal binary. ln -sf "$APPIMAGE_PATH" "$LOCAL_BIN/$BINARY_NAME"}# Install linuxdeploy, a helper for constructing an AppDir (and then invoking# appimagetool).download_appimage "linuxdeploy" "1-alpha-20251107-1" "cc7b864" \ "https://github.com/linuxdeploy/linuxdeploy"if [ ! -x "$(which linuxdeploy)" ]; then echo -e "⚠️ ${red}Please make sure that \"$LOCAL_BIN\" is on your PATH, otherwise some scripts may not work.${reset}"fi
#!/usr/bin/env bash
set -e
# Ensure the ~/.local/bin directory exists so we can download things into it.
LOCAL_BIN="$HOME/.local/bin"
mkdir -p "$LOCAL_BIN"
# Extract the short commit baked into the linuxdeploy AppImage.
appimage_commit() {
"$1" --version 2>&1 | grep -oE "git commit ID [0-9a-f]{7,40}" | cut -d' ' -f4
}
# A helper function to download an architecture-dependent AppImage and install
# it in ~/.local/bin.
#
# Usage:
# download_appimage $BINARY_NAME $VERSION $COMMIT $REPO_URL
#
# Args:
# BINARY_NAME: The name of the AppImage-bundled binary we want to download,
# e.g.: "linuxdeploy".
# VERSION: The upstream release tag.
# COMMIT: The (short) commit SHA the release tag points at; used to
# verify the cached binary matches the pinned version.
# REPO_URL: The URL of the GitHub repository hosting the release.
download_appimage() {
BINARY_NAME="$1"
VERSION="$2"
COMMIT="$3"
REPO_URL="$4"
APPIMAGE_NAME="$BINARY_NAME-$(uname -m).AppImage"
APPIMAGE_PATH="$LOCAL_BIN/$APPIMAGE_NAME"
if [ -x "$APPIMAGE_PATH" ] && [ "$(appimage_commit "$APPIMAGE_PATH")" = "$COMMIT" ]; then
echo "✅ Found $APPIMAGE_NAME in $LOCAL_BIN."
else
APPIMAGE_RELEASE_URL="$REPO_URL/releases/download/$VERSION/$APPIMAGE_NAME"
echo "⬇️ Downloading $APPIMAGE_RELEASE_URL..."
curl -fL "$APPIMAGE_RELEASE_URL" --output "$APPIMAGE_PATH"
chmod +x "$APPIMAGE_PATH"
fi
# Create a symlink so we can invoke it like a normal binary.
ln -sf "$APPIMAGE_PATH" "$LOCAL_BIN/$BINARY_NAME"
}
# Install linuxdeploy, a helper for constructing an AppDir (and then invoking
# appimagetool).
download_appimage "linuxdeploy" "1-alpha-20251107-1" "cc7b864" \
"https://github.com/linuxdeploy/linuxdeploy"
if [ ! -x "$(which linuxdeploy)" ]; then
echo -e "⚠️ ${red}Please make sure that \"$LOCAL_BIN\" is on your PATH, otherwise some scripts may not work.${reset}"
fi