Skip to content

Commit

Permalink
setup-util-bottom: cross-platform support
Browse files Browse the repository at this point in the history
  • Loading branch information
balupton committed Apr 27, 2022
1 parent 2ec8a82 commit 7af65b3
Showing 1 changed file with 45 additions and 1 deletion.
46 changes: 45 additions & 1 deletion commands/setup-util-bottom
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,53 @@
source "$DOROTHY/sources/strict.bash"

# https://github.com/ClementTsang/bottom
# https://github.com/ClementTsang/bottom/releases
# top alternative

# bottom_0.6.8_amd64.deb
# bottom_aarch64-unknown-linux-gnu.tar.gz
# bottom_armv7-unknown-linux-gnueabihf.tar.gz
# bottom_i686-pc-windows-msvc.zip
# bottom_i686-unknown-linux-gnu.tar.gz
# bottom_i686-unknown-linux-musl.tar.gz
# bottom_powerpc64le-unknown-linux-gnu.tar.gz
# bottom_riscv64gc-unknown-linux-gnu.tar.gz
# bottom_x86_64-apple-darwin.tar.gz
# bottom_x86_64-pc-windows-gnu.zip
# bottom_x86_64-pc-windows-msvc.zip
# bottom_x86_64-unknown-linux-gnu.tar.gz
# bottom_x86_64-unknown-linux-gnu2-17.tar.gz
# bottom_x86_64-unknown-linux-musl.tar.gz
# bottom_x86_64_installer.msi

function setup-util-bottom() (
# determine github args if github is an option on this platform
local arch github_asset_filter='' github=()
arch="$(get-arch)"
if is-mac; then
github_asset_filter='_x86_64-apple-darwin'
elif test "$arch" = 'a64'; then
github_asset_filter='_aarch64-unknown-linux-gnu'
elif test "$arch" = 'a32'; then
github_asset_filter='_armv7-unknown-linux-gnu'
elif test "$arch" = 'x64'; then
github_asset_filter='_x86_64-unknown-linux-musl'
elif test "$arch" = 'x32'; then
github_asset_filter='_i686-unknown-linux-musl'
fi
if test -n "$github_asset_filter"; then
github+=(
GITHUB_SLUG='ClementTsang/bottom'
GITHUB_RELEASE='latest'
GITHUB_ASSET_FILTER="$github_asset_filter"
GITHUB_UNZIP_FILTER='**/btm'
GITHUB_FILENAME='btm'
)
fi

# install, preferring github
setup-util "$@" --name='bottom' --cli='btm' \
"${github[@]}" \
AUR='bottom-bin' \
BREW='bottom' \
CARGO='bottom' \
Expand All @@ -20,7 +63,8 @@ function setup-util-bottom() (
sudo eselect repository enable guru
sudo emerge --sync guru
echo "sys-process/bottom" | sudo tee /etc/portage/package.accept_keywords/10-guru
sudo emerge sys-process/bottom::guru'
sudo emerge sys-process/bottom::guru' \
-- github ...
)

# fire if invoked standalone
Expand Down

0 comments on commit 7af65b3

Please sign in to comment.