Add an uninstall wrapper, and move to the stores org
uninstall.sh mirrors install.sh: it names the store and lets the engine do the work. It passes STORE_ID rather than a config URL — taking a store away does not need a download, and the id is what names its home. Both wrappers are POSIX sh now, and neither pipes curl into a shell any more: a failed download would feed an empty script to sh and look like success, so the installer is fetched to a file and run from there. The repository moved from the tools org to stores. The old raw URLs still redirect, so a box installed yesterday keeps updating. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
+17
-11
@@ -1,32 +1,33 @@
|
||||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
# Install the Teletype Games store on a Batocera box.
|
||||
#
|
||||
# curl -fsSL https://git.teletypegames.org/tools/ttg-batocera-store/raw/branch/master/install.sh | bash
|
||||
# curl -fsSL https://git.teletypegames.org/stores/ttg-batocera-store/raw/branch/master/install.sh | sh
|
||||
#
|
||||
# All the work is done by the shared engine; this script only says which store
|
||||
# to install. See https://git.teletypegames.org/tools/warp-engine-batocera-store
|
||||
# to install. See https://git.teletypegames.org/stores/warp-engine-batocera-store
|
||||
#
|
||||
set -euo pipefail
|
||||
set -eu
|
||||
|
||||
FORGE="${FORGE:-https://git.teletypegames.org}"
|
||||
ENGINE_RAW_BASE="${ENGINE_RAW_BASE:-$FORGE/tools/warp-engine-batocera-store/raw/branch/master}"
|
||||
# Only set when run as a file; piped from curl "$0" is `bash` and everything
|
||||
FORGE="${FORGE:-https://git.teletypegames.org/stores}"
|
||||
ENGINE_RAW_BASE="${ENGINE_RAW_BASE:-$FORGE/warp-engine-batocera-store/raw/branch/master}"
|
||||
# Only set when run as a file; piped from curl "$0" is `sh` and everything
|
||||
# has to come from the forge — never from whatever the cwd happens to hold.
|
||||
SRC_DIR=""
|
||||
if [ -f "$0" ]; then
|
||||
SRC_DIR="$(cd "$(dirname "$(readlink -f "$0")")" && pwd)"
|
||||
SRC_DIR="$(cd "$(dirname "$(readlink -f "$0" 2>/dev/null || echo "$0")")" && pwd)"
|
||||
fi
|
||||
|
||||
# Prefer the config next to this script when run from a checkout.
|
||||
if [ -z "${STORE_CONFIG:-}" ] && [ -n "$SRC_DIR" ] && [ -f "$SRC_DIR/config.json" ]; then
|
||||
STORE_CONFIG="$SRC_DIR/config.json"
|
||||
else
|
||||
STORE_CONFIG="${STORE_CONFIG:-$FORGE/tools/ttg-batocera-store/raw/branch/master/config.json}"
|
||||
STORE_CONFIG="${STORE_CONFIG:-$FORGE/ttg-batocera-store/raw/branch/master/config.json}"
|
||||
fi
|
||||
export STORE_CONFIG ENGINE_RAW_BASE
|
||||
|
||||
# Keep the Ports entry the box already has, so an upgrade replaces it in place.
|
||||
export BATOCERA_PORT_NAME="${BATOCERA_PORT_NAME:-Teletype Games Store}"
|
||||
BATOCERA_PORT_NAME="${BATOCERA_PORT_NAME:-Teletype Games Store}"
|
||||
export BATOCERA_PORT_NAME
|
||||
|
||||
# --- migrate the pre-split ttg-store layout -------------------------------
|
||||
# Up to engine 1.x everything lived in /userdata/system/ttg-store. The ROMs
|
||||
@@ -49,4 +50,9 @@ if [ -d "$LEGACY_HOME" ] && [ ! -f "$NEW_HOME/state.json" ]; then
|
||||
echo "[install] old install kept at $LEGACY_HOME.pre-split — delete it once things look right"
|
||||
fi
|
||||
|
||||
curl -fsSL "$ENGINE_RAW_BASE/install.sh" | bash
|
||||
# Fetched to a file rather than piped into a shell: a failed download must fail
|
||||
# loudly instead of feeding an empty script to sh, which would look like success.
|
||||
TMP="$(mktemp)"
|
||||
trap 'rm -f "$TMP"' EXIT
|
||||
curl -fsSL "$ENGINE_RAW_BASE/install.sh" -o "$TMP"
|
||||
sh "$TMP"
|
||||
|
||||
Reference in New Issue
Block a user