Files
Move/uninstall.sh
T
nokeo08 b43d5aad2d Add curl-pipe installer, uninstaller, and contributor bootstrap
End-user installation collapses to a single command:

  curl -fsSL https://gitea.cahlen.com/nokeo08/Move/raw/branch/master/install.sh | sh

Changes:

- install.sh rewritten as a POSIX sh, curl-pipeable end-user installer.
  Honors XDG_DATA_HOME and XDG_BIN_HOME (de facto). Idempotent via a
  version-marker file at $INSTALL_DIR/.installed-version; MOVE_FORCE=1
  overrides. Hard-fails if Bun is missing (no auto-install). Includes
  a safety guard refusing rm -rf on too-broad install dirs.
- uninstall.sh added; same curl-pipe pattern, shared XDG path
  resolution, leaves Bun alone.
- dev-setup.sh added (= the previous install.sh content, retitled for
  contributors and pointing at bun run start / bun link / install.sh).
- README updated: curl one-liner Install section, XDG behavior tables,
  new Uninstall section, new 'For contributors' section, Files table
  rows for all three scripts.
2026-06-17 11:55:03 -05:00

57 lines
1.4 KiB
Bash
Executable File

#!/usr/bin/env sh
#
# uninstall.sh - End-user uninstaller for the `move` CLI.
#
# Curl-pipe ready:
#
# curl -fsSL https://gitea.cahlen.com/nokeo08/Move/raw/branch/master/uninstall.sh | sh
#
# Removes the `move` wrapper from $XDG_BIN_HOME and the install tree from
# $XDG_DATA_HOME/move. Does NOT remove Bun — that's your runtime, not ours.
#
# Env vars (must match what install.sh used):
# XDG_DATA_HOME Source install root (default $HOME/.local/share).
# XDG_BIN_HOME Wrapper install root (default $HOME/.local/bin).
#
# POSIX sh; no bashisms.
set -eu
INSTALL_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/move"
BIN_DIR="${XDG_BIN_HOME:-$HOME/.local/bin}"
WRAPPER="$BIN_DIR/move"
die() {
printf 'Error: %s\n' "$1" >&2
exit 1
}
# Same safety guard as install.sh: refuse to wipe a directory that points
# somewhere catastrophic.
case "$INSTALL_DIR" in
'' | '/' | "$HOME" | "$HOME/" | '/move')
die "refusing to operate on INSTALL_DIR='$INSTALL_DIR' (too broad)"
;;
esac
REMOVED_SOMETHING=0
if [ -e "$WRAPPER" ] || [ -L "$WRAPPER" ]; then
rm -f "$WRAPPER"
printf 'Removed %s\n' "$WRAPPER"
REMOVED_SOMETHING=1
fi
if [ -d "$INSTALL_DIR" ]; then
rm -rf "$INSTALL_DIR"
printf 'Removed %s\n' "$INSTALL_DIR"
REMOVED_SOMETHING=1
fi
if [ "$REMOVED_SOMETHING" = "0" ]; then
printf 'Nothing to remove. Checked %s and %s.\n' "$WRAPPER" "$INSTALL_DIR"
exit 0
fi
printf '\nUninstalled. (Bun was not touched.)\n'