automate/020_bottom.sh

45 lines
1.4 KiB
Bash

# Upstream releases deb files
# https://github.com/ClementTsang/bottom/releases/tag/0.9.6
DEST=${1:-/etc/skel}
GITUSER=ClementTsang
PROJECT=bottom
LATEST_RELEASE_URL="https://api.github.com/repos/${GITUSER}/${PROJECT}/releases/latest"
ARCH=$(dpkg --print-architecture)
# Fetch the latest release tag
TAG=$(torsocks curl -sL -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" "${LATEST_RELEASE_URL}" | jq -r '.tag_name')
# Download the.deb file and its SHA256 checksum
# test for ARCH to select the correct file to download
case $ARCH in
amd64)
EXTENSION="_amd64.deb"
;;
arm64)
EXTENSION="_arm64.deb"
;;
armhf)
EXTENSION="_armhf.deb"
;;
*)
echo "Unable to determine system architecture."
exit 1
;;
esac
wget -c -O /tmp/${PROJECT}_${TAG}-1${EXTENSION} https://github.com/${GITUSER}/${PROJECT}/releases/download/${TAG}/${PROJECT}_${TAG}${EXTENSION}
# wget -c -O /tmp/${PROJECT}-${TAG}.${EXTENSION}.sha256 https://github.com/${GITUSER}/${PROJECT}/releases/download/${TAG}/${PROJECT}-${TAG}${EXTENSION}.sha256
# Verify the checksum using sha256sum --check
# sha256sum --check /tmp/${PROJECT}-${TAG}.${EXTENSION}.sha256
# If the checksum verification is successful, install the.deb file using dpkg
# if [ $? -eq 0 ]; then
sudo dpkg -i /tmp/${PROJECT}_${TAG}-1${EXTENSION}
sudo apt-get -f install
# else
# echo "Checksums do not match. Skipping installation."
#fi
# "Checksums do not match. Skipping installation."