#!/usr/bin/env bash # SmarterSheet installer for Linux - no root needed. # # curl -fsSL https://smartersheet.microide.com/install-linux.sh | bash # curl -fsSL https://smartersheet.microide.com/install-linux.sh | bash -s -- --no-service # # 1. checks for Python 3.10+ (says how to get it if missing) # 2. downloads run-smarterSheet.py into ~/.local/share/smartersheet (or $SMARTERSHEET_DIR) # 3. runs the setup in your terminal (API token walk-through, ITM sheets, edit rights, port) # 4. adds the command "smartersheet" to ~/.local/bin # 5. if systemd is there: installs and starts the user service "smartersheet" so it runs in the background # and comes back after a reboot (--no-service skips this; then start it with: smartersheet) # # Uninstall: systemctl --user disable --now smartersheet; rm ~/.config/systemd/user/smartersheet.service # ~/.local/bin/smartersheet; rm -r ~/.local/share/smartersheet (this also deletes your database) set -euo pipefail SITE="${SMARTERSHEET_SITE:-https://smartersheet.microide.com}" DIR="${SMARTERSHEET_DIR:-$HOME/.local/share/smartersheet}" BIN="$HOME/.local/bin" SERVICE=1 for a in "$@"; do case "$a" in --no-service) SERVICE=0 ;; -h|--help) sed -n '2,16p' "$0" 2>/dev/null || true; exit 0 ;; *) echo "unknown option: $a" >&2; exit 2 ;; esac done say() { printf '\n== %s\n' "$*"; } say "Checking for Python 3.10 or newer" PY="" for c in python3 python3.14 python3.13 python3.12 python3.11 python3.10; do if command -v "$c" >/dev/null 2>&1 && "$c" -c 'import sys; sys.exit(sys.version_info < (3, 10))' 2>/dev/null; then PY="$(command -v "$c")"; break fi done if [ -z "$PY" ]; then echo "Python 3.10+ was not found. Install it, then run this again:" echo " Debian/Ubuntu: sudo apt install python3" echo " Fedora: sudo dnf install python3" echo " Arch: sudo pacman -S python" exit 1 fi echo "using $PY ($("$PY" -V))" say "Downloading SmarterSheet into $DIR" mkdir -p "$DIR" "$BIN" if command -v curl >/dev/null 2>&1; then curl -fsSL "$SITE/run-smarterSheet.py" -o "$DIR/run-smarterSheet.py.part" else wget -qO "$DIR/run-smarterSheet.py.part" "$SITE/run-smarterSheet.py" fi mv "$DIR/run-smarterSheet.py.part" "$DIR/run-smarterSheet.py" chmod 755 "$DIR/run-smarterSheet.py" chmod 700 "$DIR" # the database next to the script holds your Smartsheet token say "Setup" if [ -e /dev/tty ] && (exec /dev/null; then (cd "$DIR" && "$PY" run-smarterSheet.py --setup-only "$BIN/smartersheet" </dev/null || echo 5300)" if [ "$SERVICE" = 1 ] && command -v systemctl >/dev/null 2>&1 && systemctl --user show-environment >/dev/null 2>&1; then say "Installing the background service (systemd --user)" mkdir -p "$HOME/.config/systemd/user" cat > "$HOME/.config/systemd/user/smartersheet.service" </dev/null systemctl --user restart smartersheet echo "service: $(systemctl --user is-active smartersheet) logs: journalctl --user -u smartersheet -f" echo "To keep it running while you are logged out: sudo loginctl enable-linger $USER" say "Done - open http://127.0.0.1:$PORT/smartsheet" else say "Done - start it with: smartersheet then open http://127.0.0.1:$PORT/smartsheet" fi