firegex/firegex.sh
av0idd4rk f214cecf9f Add one-command installer for the MCP fork
Bootstrap the fork through run.py, build Docker from source, and prepare standalone with a checksum-pinned native runtime plus the MCP backend and Python dependencies. Preserve existing installations and data, propagate Docker build failures, and update README/setup guides. Validation: 347 unit tests and a real standalone-rootfs MCP smoke test passed in Docker.
2026-10-23 10:11:37 +03:00

47 lines
1.8 KiB
Bash
Executable File

#!/bin/sh
# Bootstrap this fork; run.py remains the deployment entry point.
set -eu
fail() { printf '%s\n' "Firegex installer: $*" >&2; exit 1; }
[ "$(uname -s)" = Linux ] || fail 'Linux is required.'
command -v python3 >/dev/null 2>&1 || fail 'Install Python 3.10 or newer first.'
command -v git >/dev/null 2>&1 || fail 'Install git first.'
python3 -c 'import sys, tarfile; sys.exit(not (sys.version_info >= (3, 10) and hasattr(tarfile, "tar_filter")))' \
|| fail 'Update Python: version 3.10+ with tarfile extraction filters is required.'
standalone=0
for argument in "$@"; do
case "$argument" in
--standalone) standalone=1 ;;
--prebuilt) fail 'Upstream prebuilt images do not include MCP; omit --prebuilt.' ;;
esac
done
# Keep rootless Docker on the standalone path even after privilege elevation.
docker_info=$(docker info --format '{{json .SecurityOptions}}' 2>/dev/null) || docker_info=
case "$docker_info" in
*rootless*) standalone=1; set -- "$@" --standalone ;;
esac
use_sudo=0
if [ "$(id -u)" != 0 ] && { [ "$standalone" = 1 ] || [ -z "$docker_info" ]; }; then
command -v sudo >/dev/null 2>&1 || fail 'Root privileges are required; run as root or install sudo.'
use_sudo=1
fi
install_dir=${FIREGEX_INSTALL_DIR:-"$PWD/firegex"}
case "$install_dir" in /*) ;; *) install_dir=$PWD/$install_dir ;; esac
if [ -e "$install_dir" ] || [ -L "$install_dir" ]; then
fail "$install_dir already exists. Use its run.py, or select a new FIREGEX_INSTALL_DIR."
fi
printf '%s\n' "Downloading Av0idD4rk/firegex into $install_dir"
git clone --depth 1 --branch main https://github.com/Av0idD4rk/firegex.git "$install_dir"
printf '%s\n' "Manage this installation with: $install_dir/run.py"
cd "$install_dir"
if [ "$use_sudo" = 1 ]; then
exec sudo python3 ./run.py start "$@"
fi
exec python3 ./run.py start "$@"