aboutsummaryrefslogtreecommitdiff
path: root/scripts/setup-telega.sh
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-11-20 15:59:47 -0600
committerCraig Jennings <c@cjennings.net>2026-11-20 15:59:47 -0600
commit4df81e5e751cf50c45e1b82e694394ddcb133ada (patch)
tree269e7d0dc65bf71965adc73c55858b2b7ae2f068 /scripts/setup-telega.sh
parent1e679c7193f55950849cf9b9d9ac41108db26b3f (diff)
downloaddotemacs-4df81e5e751cf50c45e1b82e694394ddcb133ada.tar.gz
dotemacs-4df81e5e751cf50c45e1b82e694394ddcb133ada.zip
refactor(telega): retire the Telegram client to the archive
I stopped using Telegram in Emacs, so the client goes to the archive. - The module and its tests moved to archive/. - The setup script and docker build files moved with them. - I dropped the init.el require and the make telega-image target. - The dashboard loses its Telegram launcher. Rows are now 5 4 2 2. - C-; T is free again.
Diffstat (limited to 'scripts/setup-telega.sh')
-rwxr-xr-xscripts/setup-telega.sh119
1 files changed, 0 insertions, 119 deletions
diff --git a/scripts/setup-telega.sh b/scripts/setup-telega.sh
deleted file mode 100755
index 351f98ba..00000000
--- a/scripts/setup-telega.sh
+++ /dev/null
@@ -1,119 +0,0 @@
-#!/usr/bin/env bash
-# Craig Jennings <c@cjennings.net>
-#
-# Prepares everything telega.el needs on a fresh clone.
-#
-# Sequence:
-# - Verifies docker is installed and the daemon is responsive.
-# - Verifies the user can talk to docker without sudo (group membership).
-# - Pulls the telega-server image if a public one is configured (env var
-# `TELEGA_DOCKER_IMAGE'); otherwise points at `make telega-image', which
-# builds the pinned image from docker/telega-server/Dockerfile.
-# - Installs the `telega' Emacs package via package.el if it isn't
-# already in package-user-dir. modules/telega-config.el uses
-# `:ensure nil' (a stale MELPA index can 404 and take startup down
-# if auto-install runs in init), so the install has to happen
-# explicitly somewhere. This is that somewhere.
-#
-# Does NOT handle Telegram account auth -- phone number + verification
-# code is interactive and runs inside `M-x telega' on first launch.
-#
-# Sourceable: only `main' runs when the script is executed directly, so
-# the helpers can be tested with bats.
-
-set -euo pipefail
-
-# Public image override. When set, the script pulls this image directly
-# instead of falling back to the in-Emacs build flow. Default empty so
-# the script doesn't assume an image name that may or may not exist
-# upstream.
-: "${TELEGA_DOCKER_IMAGE:=}"
-
-ensure_docker_installed() {
- if ! command -v docker >/dev/null 2>&1; then
- echo " ✗ docker not found on PATH"
- echo " install docker (https://docs.docker.com/get-docker/) and rerun"
- return 1
- fi
- echo " ✓ docker present: $(command -v docker)"
-}
-
-ensure_docker_running() {
- if ! docker info >/dev/null 2>&1; then
- echo " ✗ cannot talk to the docker daemon"
- echo " start the daemon (e.g. 'sudo systemctl start docker') or"
- echo " add your user to the 'docker' group, then re-login and rerun"
- return 1
- fi
- echo " ✓ docker daemon reachable"
-}
-
-pull_or_announce_image() {
- if [[ -z "$TELEGA_DOCKER_IMAGE" ]]; then
- cat <<EOF
- → no public image configured (set TELEGA_DOCKER_IMAGE to override)
- build the telega-server image once from the repo's Dockerfile:
- make telega-image
- modules/telega-config.el pins \`cj/telega-docker-image' to the tag
- that target builds (docker/telega-server/Dockerfile).
-EOF
- return 0
- fi
- echo " → pulling $TELEGA_DOCKER_IMAGE..."
- if docker pull "$TELEGA_DOCKER_IMAGE"; then
- echo " ✓ pulled $TELEGA_DOCKER_IMAGE"
- else
- echo " ✗ pull failed for $TELEGA_DOCKER_IMAGE"
- return 1
- fi
-}
-
-ensure_telega_package() {
- if ! command -v emacs >/dev/null 2>&1; then
- echo " ✗ emacs not on PATH; install Emacs first"
- return 1
- fi
- # Probe quietly whether telega is already in package-user-dir.
- if emacs --batch --eval "(progn
- (require 'package)
- (package-initialize)
- (kill-emacs (if (package-installed-p 'telega) 0 1)))" \
- >/dev/null 2>&1; then
- echo " ✓ telega Emacs package already installed"
- return 0
- fi
- echo " → installing telega via package.el..."
- if emacs --batch --eval "(progn
- (require 'package)
- (package-initialize)
- (unless (assoc \"melpa\" package-archives)
- (add-to-list 'package-archives '(\"melpa\" . \"https://melpa.org/packages/\") t))
- (package-refresh-contents)
- (package-install 'telega))" >/dev/null 2>&1; then
- echo " ✓ telega installed"
- else
- echo " ✗ telega install failed"
- echo " try interactively:"
- echo " M-x package-refresh-contents"
- echo " M-x package-install RET telega"
- return 1
- fi
-}
-
-main() {
- echo "→ checking docker..."
- ensure_docker_installed
- ensure_docker_running
- echo "→ preparing telega-server image..."
- pull_or_announce_image
- echo "→ checking telega Emacs package..."
- ensure_telega_package
- echo "✅ Telega setup complete."
- echo " First launch: M-x telega -- enter phone + verification code interactively."
-}
-
-# Run main only when the script is executed directly. Sourcing this file
-# (for example from a bats test) just defines the helpers above.
-if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
- main "$@"
-fi