Update binary name, DB path, session cookie, deploy scripts, systemd service, Docker config, CI workflow, and .dockerignore. Remove stale Claude command and settings files.
97 lines
2.8 KiB
Bash
Executable File
97 lines
2.8 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Reassembles base64 chunks and extracts the games deployment tarball.
|
|
# Expects chunk files in the current directory.
|
|
set -euo pipefail
|
|
|
|
cd "$HOME"
|
|
|
|
echo "=== Games Deployment Reassembler ==="
|
|
echo "Working directory: $HOME"
|
|
echo ""
|
|
|
|
#==============================================================================
|
|
# Find and validate chunk files
|
|
#==============================================================================
|
|
echo "--- Finding chunk files ---"
|
|
|
|
CHUNKS=($(ls -1 games-deploy-*_b64_part*.txt 2>/dev/null | sort))
|
|
|
|
if [[ ${#CHUNKS[@]} -eq 0 ]]; then
|
|
echo "ERROR: No chunk files found matching games-deploy-*_b64_part*.txt"
|
|
exit 1
|
|
fi
|
|
|
|
echo "Found ${#CHUNKS[@]} chunks:"
|
|
for chunk in "${CHUNKS[@]}"; do
|
|
echo " - $chunk ($(du -h "$chunk" | cut -f1))"
|
|
done
|
|
|
|
#==============================================================================
|
|
# Reassemble and decode
|
|
#==============================================================================
|
|
echo ""
|
|
echo "--- Reassembling chunks ---"
|
|
|
|
TIMESTAMP=$(echo "${CHUNKS[0]}" | sed -E 's/games-deploy-([0-9]+-[0-9]+)_b64_part.*/\1/')
|
|
TARBALL="games-deploy-${TIMESTAMP}.tar.gz"
|
|
COMBINED="combined_b64.txt"
|
|
|
|
echo "Concatenating chunks..."
|
|
cat "${CHUNKS[@]}" > "$COMBINED"
|
|
echo " -> Created $COMBINED ($(du -h "$COMBINED" | cut -f1))"
|
|
|
|
echo "Decoding base64..."
|
|
base64 -d "$COMBINED" > "$TARBALL"
|
|
echo " -> Created $TARBALL ($(du -h "$TARBALL" | cut -f1))"
|
|
|
|
echo "Verifying tarball..."
|
|
if tar -tzf "$TARBALL" > /dev/null 2>&1; then
|
|
echo " -> Tarball is valid"
|
|
else
|
|
echo "ERROR: Tarball verification failed"
|
|
exit 1
|
|
fi
|
|
|
|
#==============================================================================
|
|
# Archive existing source
|
|
#==============================================================================
|
|
echo ""
|
|
echo "--- Archiving existing source ---"
|
|
|
|
if [[ -d games ]]; then
|
|
rm -rf games.bak
|
|
mv games games.bak
|
|
echo " -> Moved games -> games.bak"
|
|
else
|
|
echo " -> No existing games directory"
|
|
fi
|
|
|
|
#==============================================================================
|
|
# Extract
|
|
#==============================================================================
|
|
echo ""
|
|
echo "--- Extracting tarball ---"
|
|
|
|
tar -xzf "$TARBALL"
|
|
echo " -> Extracted to ~/games"
|
|
|
|
#==============================================================================
|
|
# Cleanup
|
|
#==============================================================================
|
|
echo ""
|
|
echo "--- Cleaning up ---"
|
|
|
|
rm -f "$COMBINED" "$TARBALL" "${CHUNKS[@]}"
|
|
echo " -> Removed chunks, combined base64, and tarball"
|
|
|
|
#==============================================================================
|
|
# Next steps
|
|
#==============================================================================
|
|
echo ""
|
|
echo "=== Reassembly Complete ==="
|
|
echo ""
|
|
echo "Next steps:"
|
|
echo " cd ~/games"
|
|
echo " sudo ./deploy/setup.sh # first time only"
|
|
echo " sudo ./deploy/deploy.sh"
|