mirror of
https://github.com/IgorAherne/Spellcast3d.git
synced 2026-12-01 16:36:47 -10:00
48 lines
1.9 KiB
Bash
Executable File
48 lines
1.9 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Installs the Spellcast3D hub if it is missing or changed, then starts it. The hub installs the tools (the image
|
|
# generator, Pixal3D, Instant Meshes, ...) in the background and shows the progress. install.py also makes
|
|
# spellcast3d-config.ini here when it is missing (the artist picks the image generator in it).
|
|
# Started by run-browser/run-spellcast3d.sh; its arguments are passed on to the hub
|
|
# (python -m spellcast --help lists them).
|
|
# Set SPELLCAST_NO_BROWSER=1 to never open a browser tab when the hub starts.
|
|
|
|
TOOLS="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
. "$TOOLS/environment.sh" || exit 1
|
|
|
|
# A fast no-op when the hub is installed and unchanged; installing it takes about a minute. Ctrl+C during it ends
|
|
# this script too (install.py itself answers an interrupt with an ordinary error code, and the hub would start).
|
|
trap 'echo; echo "Stopped."; exit 130' INT
|
|
"$PY" "$ROOT/code/install.py" --only hub --if-needed
|
|
code=$?
|
|
trap - INT
|
|
if [ "$code" -ge 3 ]; then # another Spellcast3D or installer is at work: install.py said so
|
|
exit 1
|
|
elif [ "$code" -ne 0 ]; then
|
|
echo
|
|
echo "Spellcast3D could not be updated - the messages above say why."
|
|
echo "The full log is in:"
|
|
echo " $ROOT/code/logs/install.log"
|
|
echo "Spellcast3D now starts as it was installed before; the update is retried at the next start."
|
|
fi
|
|
|
|
HUB_PY="$ROOT/code/venvs/hub/bin/python"
|
|
if [ ! -x "$HUB_PY" ]; then
|
|
echo
|
|
echo "ERROR: Spellcast3D itself could not be installed, so it cannot start - the messages above say why."
|
|
echo "Start it again once that is solved. The full log is in:"
|
|
echo " $ROOT/code/logs/install.log"
|
|
exit 1
|
|
fi
|
|
|
|
echo "Starting Spellcast3D..."
|
|
cd "$ROOT/code" || exit 1
|
|
"$HUB_PY" -m spellcast --open-browser "$@"
|
|
code=$?
|
|
if [ "$code" -ne 0 ]; then
|
|
echo
|
|
echo "Spellcast3D stopped with an error - the messages above say why."
|
|
echo "Its logs are in:"
|
|
echo " $ROOT/code/logs"
|
|
exit 1
|
|
fi
|