From d0fa554117f59332386db7741c0467a578fa275c Mon Sep 17 00:00:00 2001 From: detox-24 Date: Sun, 17 May 2026 21:21:05 -0600 Subject: [PATCH] feat(btop): Add 'btop' Co-authored-by: AJ ONeal --- btop/install.sh | 58 ++++++++++++++++++++++++++++++++++++++++++++++ btop/releases.conf | 2 ++ test/install.sh | 1 + 3 files changed, 61 insertions(+) create mode 100644 btop/install.sh create mode 100644 btop/releases.conf diff --git a/btop/install.sh b/btop/install.sh new file mode 100644 index 0000000..271d05d --- /dev/null +++ b/btop/install.sh @@ -0,0 +1,58 @@ +#!/bin/sh +__init_btop() { + set -e + set -u + + ################ + # Install btop # + ################ + + # Every package should define these 6 variables + pkg_cmd_name="btop" + + pkg_dst_cmd="$HOME/.local/bin/btop" + pkg_dst="$pkg_dst_cmd" + + pkg_src_cmd="$HOME/.local/opt/btop-v$WEBI_VERSION/bin/btop" + pkg_src_dir="$HOME/.local/opt/btop-v$WEBI_VERSION" + pkg_src="$pkg_src_cmd" + + # pkg_install must be defined by every package + pkg_install() { + # ~/.local/opt/btop-v1.4.6/bin + mkdir -p "$(dirname "${pkg_src_cmd}")" + + # mv ./btop/bin/btop ~/.local/opt/btop-v1.4.6/bin/btop + mv ./btop/bin/btop "${pkg_src_cmd}" + } + + # pkg_get_current_version is recommended, but not required + pkg_get_current_version() { + # 'btop --version' has output in this format: + # btop 1.4.6 (rev abcdef0123) + # This trims it down to just the version number: + # 1.4.6 + btop --version 2> /dev/null | + head -n 1 | + cut -d ' ' -f 2 + } + +} + +fn_btop_brew_install() { + if ! command -v brew > /dev/null; then + "$HOME/.local/bin/webi" brew + export PATH="$HOME/.local/opt/brew/bin:$HOME/.local/opt/brew/sbin:$PATH" + fi + + export HOMEBREW_NO_AUTO_UPDATE=1 + export HOMEBREW_NO_ENV_HINTS=1 + brew install btop +} + +my_os=$(uname -s) +if test "Darwin" = "${my_os}" && test "$WEBI_CHANNEL" = "error"; then + fn_btop_brew_install + return 0 +fi +__init_btop diff --git a/btop/releases.conf b/btop/releases.conf new file mode 100644 index 0000000..5112e7d --- /dev/null +++ b/btop/releases.conf @@ -0,0 +1,2 @@ +github_releases = aristocratos/btop +exclude = -m68k -bigsur -monterey -ventura -macos diff --git a/test/install.sh b/test/install.sh index 7e0b4bc..877eb5f 100644 --- a/test/install.sh +++ b/test/install.sh @@ -11,6 +11,7 @@ __rmrf_local() { archiver \ awless \ bat \ + btop \ caddy \ chromedriver \ cmake \