mirror of
https://github.com/k1ng0fn0th1ng/reflectra
synced 2026-06-21 13:55:04 +00:00
66 lines
1.3 KiB
Bash
Executable File
66 lines
1.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -Eeuo pipefail
|
|
|
|
readonly CRYSTAL_PALACE_URL="https://tradecraftgarden.org/download"
|
|
readonly CPDIST_ARCHIVE="cpdist-latest.tgz"
|
|
readonly CPDIST_URL="$CRYSTAL_PALACE_URL/$CPDIST_ARCHIVE"
|
|
|
|
readonly TCG_ARCHIVE="tcg20260202.tgz"
|
|
readonly TCG_URL="$CRYSTAL_PALACE_URL/$TCG_ARCHIVE"
|
|
|
|
log() {
|
|
printf '[*] %s\n' "$*"
|
|
}
|
|
|
|
error() {
|
|
printf '[!] %s\n' "$*" >&2
|
|
}
|
|
|
|
require_command() {
|
|
local cmd="$1"
|
|
|
|
if ! command -v "$cmd" >/dev/null 2>&1; then
|
|
error "Required command not found: $cmd"
|
|
exit 1
|
|
fi
|
|
}
|
|
|
|
cleanup() {
|
|
rm -rf "$CPDIST_ARCHIVE" "$TCG_ARCHIVE" tcg/
|
|
}
|
|
|
|
main() {
|
|
require_command curl
|
|
require_command tar
|
|
require_command make
|
|
|
|
trap cleanup EXIT
|
|
|
|
log "Downloading Crystal Palace release"
|
|
curl -fsSL "$CPDIST_URL" -o "$CPDIST_ARCHIVE"
|
|
|
|
log "Extracting Crystal Palace release"
|
|
tar -xzf "$CPDIST_ARCHIVE"
|
|
|
|
log "Downloading Tradecraft Garden source"
|
|
curl -fsSL "$TCG_URL" -o "$TCG_ARCHIVE"
|
|
|
|
log "Extracting Tradecraft Garden source"
|
|
tar -xzf "$TCG_ARCHIVE"
|
|
|
|
if [[ ! -d "tcg/libtcg" ]]; then
|
|
error "Expected directory not found: tcg/libtcg"
|
|
exit 1
|
|
fi
|
|
|
|
log "Building libtcg"
|
|
make -s -C tcg/libtcg
|
|
|
|
log "Refreshing local libtcg directory"
|
|
rm -rf ./libtcg
|
|
mv tcg/libtcg ./libtcg
|
|
|
|
log "Installation completed successfully"
|
|
}
|
|
|
|
main "$@" |