Files
shell/install/anytype
2025-12-13 22:03:48 +08:00

47 lines
1.1 KiB
Bash
Executable File

#!/usr/bin/env bash
##makedesc: Manage anytype (deb)
set -eo pipefail
installDir="$HOME/install/anytype"
install() {
release="$(curl -s 'https://api.github.com/repos/anyproto/anytype-ts/releases/latest')"
tag="$(echo "$release" | jq -r '.tag_name')"
asset="$(echo "$release" | jq -r '.assets.[] | select(.name | test("amd64.deb$"))')"
url="$(echo "$asset" | jq -r '.browser_download_url')"
echo -e "$tag $url"
echo
echo "==============================================="
echo "Installing anytype $tag"
echo "==============================================="
echo
mkdir -p "$installDir"
filepath="$installDir/anytype_${tag}_amd46.deb"
wget "$url" -O "$filepath"
sudo dpkg -i "$filepath"
echo
echo "Finish! $tag"
echo
}
remove() {
echo
echo "==============================================="
echo "Removing anytype"
echo "==============================================="
echo
sudo apt purge -y anytype*
echo
echo "Finish!"
echo
}
case "$1" in
r|remove|d|delete|p|purge) remove ;;
*) install ;;
esac