Post-Install Script
I decided to make a bash script that I can run after I install Debian based Linux distribution. Currently, I have been doing Zorin OS. Here's the script, use at your own risk:
Prerequisites
- Flatpak
- Debian based distribution (normal person explanation, advanced explanation)
- An internet connection (duh)
How to run. . .
- Save contents to a .txt file or download the script
- Rename to "post-install-script.sh"
- Run with "sudo sh post-install-script.sh"
#!/bin/bash
set -e
# Check for dependencies
if ! command -v jq >/dev/null; then
echo "Error: 'jq' is required. Install it with: sudo apt install jq"
exit 1
fi
# Set temporary directory
TEMP_DIR="/tmp"
# Repository info
REPO="anyproto/anytype-ts"
API_URL="https://api.github.com/repos/$REPO/releases"
echo "Finding most recent stable Anytype release..."
# Fetch releases and filter out alpha/beta/rc/draft/prerelease
STABLE_RELEASE=$(curl -s "$API_URL" | jq -r '
[.[]
| select(.prerelease == false and .draft == false)
| select(.tag_name | test("alpha|beta|rc") | not)
][0]
')
if [ -z "$STABLE_RELEASE" ] || [ "$STABLE_RELEASE" == "null" ]; then
echo "Error: No stable release found"
exit 1
fi
# Extract tag name and asset URL
STABLE_TAG=$(echo "$STABLE_RELEASE" | jq -r '.tag_name')
DEB_URL=$(echo "$STABLE_RELEASE" | jq -r '.assets[] | select(.name | test("amd64\\.deb$")) | .browser_download_url')
if [ -z "$DEB_URL" ]; then
echo "Error: Could not find AMD64 DEB package in release $STABLE_TAG"
echo "Available assets:"
echo "$STABLE_RELEASE" | jq -r '.assets[].browser_download_url'
exit 1
fi
FILENAME=$(basename "$DEB_URL")
echo "Downloading $FILENAME from tag $STABLE_TAG..."
wget -q --show-progress -P "$TEMP_DIR" "$DEB_URL"
echo "Installing Anytype..."
sudo dpkg -i "$TEMP_DIR/$FILENAME" || sudo apt-get install -f -y
echo "Cleaning up..."
rm -f "$TEMP_DIR/$FILENAME"
echo "Anytype (stable release $STABLE_TAG) installed successfully!"
AI Disclaimer: A significant amount of this script was generated using Claude AI and ChatGPT. It shows itself particularly in the more complex sections that pull files from Github. However, I kept the use of AI to a minimum so as to maximize learning.
Member discussion