Skip to content

Instantly share code, notes, and snippets.

@hoho4190
Created April 9, 2024 12:12
Show Gist options
  • Save hoho4190/62e17dde80ce77d89ec0ed7733823d77 to your computer and use it in GitHub Desktop.
Save hoho4190/62e17dde80ce77d89ec0ed7733823d77 to your computer and use it in GitHub Desktop.
btop-install-update

Debian GNU/Linux 12 (bookworm) aarch64

https://github.com/aristocratos/btop?tab=readme-ov-file#installation

btop-install-update.sh

#!/bin/bash

DOWNLOAD_DIR=~/downloads
LATEST_TAG=$(curl -s "https://api.github.com/repos/aristocratos/btop/releases/latest" | jq -r '.tag_name')
ARCHITECTURE=$(uname -m)
KERNEL_NAME=$(uname -s | tr '[:upper:]' '[:lower:]')

# version check
if version_info=$(btop --version); then
        cur_version=$(echo "$version_info" | grep -oP '\K[0-9]+(\.[0-9]+){1,2}')
        if ! dpkg --compare-versions "${LATEST_TAG//v/}" "gt" "$cur_version"; then
                echo "btop is already the newest version ($cur_version)"
                exit 0
        fi
fi

mkdir -p "$DOWNLOAD_DIR"
cd "$DOWNLOAD_DIR" || exit 1

asset_name="btop-${ARCHITECTURE}-${KERNEL_NAME}-musl.tbz"
echo "Asset name: $asset_name"

curl -Lo btop.tbz \
        "https://github.com/aristocratos/btop/releases/download/$LATEST_TAG/$asset_name"
tar -xjf btop.tbz
rm btop.tbz && rm -rf ~/btop
mv btop ~/

cd ~/btop || exit 1
sudo make install
sudo make setuid
  • check and set DOWNLOAD_DIR
  • check asset_name
  • jq required

check

btop --version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment