mirror of
https://github.com/akuker/RASCSI.git
synced 2026-01-22 05:20:23 +00:00
Add --token parameter to easyinstall.sh
Add --skip-token parameter to easyinstall.sh
Install required apt packages explicitly (--no-install-recommends)
Allow standalone RaSCSI and web UI installations to specify an auth token
Add development mode to web UI (web/start.sh --dev-mode)
Initial Docker-based development environment for Python and web UI
Bump protobuf version
Workaround for Flask development server and asyncio incompatibility
Build Python protobuf interface on container launch, if it doesn’t exist
Allow containers to be configured with environment variables, add support for token authentication
Move web UI live editing setup out of main Docker Compose config
Update dockerignore to exclude by default
Update README
Add OS_DISTRO, OS_VERSION and OS_ARCH build args
Allow extracted files to be moved to target when crossing a filesystem boundary
Reduce noise from watchmedo auto-restarts
Update Docker tag structure to rascsi:{build}-{platform}-{variant}
Prevent Docker Compose from attempting to pull images from Docker registry
Add workaround for issue #821
Allow container processes to be stopped with Ctrl+C
Update README, bind to ports 8080/8443 on the Docker host by default
Update README to clarify audience and no board connectivity
Add AIBOM and GAMERNIUM to --connect_type validation
Update cfilesystem.patch following rebase
134 lines
3.5 KiB
Bash
Executable File
134 lines
3.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -e
|
|
# set -x # Uncomment to Debug
|
|
|
|
cd "$(dirname "$0")"
|
|
# verify packages installed
|
|
ERROR=0
|
|
if ! command -v genisoimage &> /dev/null ; then
|
|
echo "genisoimage could not be found"
|
|
echo "Run 'sudo apt install genisoimage' to fix."
|
|
ERROR=1
|
|
fi
|
|
if ! command -v python3 &> /dev/null ; then
|
|
echo "python3 could not be found"
|
|
echo "Run 'sudo apt install python3' to fix."
|
|
ERROR=1
|
|
fi
|
|
if ! python3 -m venv --help &> /dev/null ; then
|
|
echo "venv could not be found"
|
|
echo "Run 'sudo apt install python3-venv' to fix."
|
|
ERROR=1
|
|
fi
|
|
if ! command -v unzip &> /dev/null ; then
|
|
echo "unzip could not be found"
|
|
echo "Run 'sudo apt install unzip' to fix."
|
|
ERROR=1
|
|
fi
|
|
if ! command -v unar &> /dev/null ; then
|
|
echo "unar could not be found"
|
|
echo "Run 'sudo apt install unar' to fix."
|
|
ERROR=1
|
|
fi
|
|
if [ $ERROR = 1 ] ; then
|
|
echo
|
|
echo "Fix errors and re-run ./start.sh"
|
|
exit 1
|
|
fi
|
|
|
|
# Test for two known broken venv states
|
|
if test -e venv; then
|
|
GOOD_VENV=true
|
|
if ! test -e venv/bin/activate; then
|
|
GOOD_VENV=false
|
|
else
|
|
source venv/bin/activate
|
|
pip3 list 1> /dev/null
|
|
test $? -eq 1 && GOOD_VENV=false
|
|
fi
|
|
if ! "$GOOD_VENV"; then
|
|
echo "Deleting bad python venv"
|
|
sudo rm -rf venv
|
|
fi
|
|
fi
|
|
|
|
# Create the venv if it doesn't exist
|
|
if ! test -e venv; then
|
|
echo "Creating python venv for web server"
|
|
python3 -m venv venv
|
|
echo "Activating venv"
|
|
source venv/bin/activate
|
|
echo "Installing requirements.txt"
|
|
pip3 install wheel
|
|
pip3 install -r requirements.txt
|
|
|
|
git rev-parse --is-inside-work-tree &> /dev/null
|
|
if [[ $? -eq 0 ]]; then
|
|
git rev-parse HEAD > current
|
|
fi
|
|
fi
|
|
|
|
source venv/bin/activate
|
|
|
|
# Detect if someone updates the git repo - we need to re-run pip3 install.
|
|
set +e
|
|
|
|
git rev-parse --is-inside-work-tree &> /dev/null
|
|
if [[ $? -eq 0 ]]; then
|
|
set -e
|
|
if ! test -e current; then
|
|
git rev-parse > current
|
|
elif [ "$(cat current)" != "$(git rev-parse HEAD)" ]; then
|
|
echo "New version detected, updating libraries from requirements.txt"
|
|
pip3 install -r requirements.txt
|
|
git rev-parse HEAD > current
|
|
fi
|
|
else
|
|
echo "Warning: Not running from a valid git repository. Will not be able to update the code."
|
|
fi
|
|
set -e
|
|
|
|
pybabel compile -d src/translations
|
|
|
|
# parse arguments
|
|
while [ "$1" != "" ]; do
|
|
PARAM=$(echo "$1" | awk -F= '{print $1}')
|
|
VALUE=$(echo "$1" | awk -F= '{print $2}')
|
|
case $PARAM in
|
|
-p | --web-port)
|
|
ARG_PORT="--port $VALUE"
|
|
;;
|
|
-P | --password)
|
|
ARG_PASSWORD="--password $VALUE"
|
|
;;
|
|
-h | --rascsi-host)
|
|
ARG_RASCSI_HOST="--rascsi-host $VALUE"
|
|
;;
|
|
-o | --rascsi-port)
|
|
ARG_RASCSI_PORT="--rascsi-port $VALUE"
|
|
;;
|
|
-l | --log-level)
|
|
ARG_LOG_LEVEL="--log-level $VALUE"
|
|
;;
|
|
-d | --dev-mode)
|
|
ARG_DEV_MODE="--dev-mode"
|
|
;;
|
|
*)
|
|
echo "ERROR: unknown parameter \"$PARAM\""
|
|
exit 1
|
|
;;
|
|
esac
|
|
shift
|
|
done
|
|
|
|
PYTHON_COMMON_PATH=$(dirname $PWD)/common/src
|
|
echo "Starting web server for RaSCSI Web Interface..."
|
|
export PYTHONPATH=$PWD/src:${PYTHON_COMMON_PATH}
|
|
cd src
|
|
|
|
if [[ $ARG_DEV_MODE ]]; then
|
|
watchmedo auto-restart --directory=../../ --pattern=*.py --recursive -- \
|
|
python3 web.py ${ARG_PORT} ${ARG_PASSWORD} ${ARG_RASCSI_HOST} ${ARG_RASCSI_PORT} ${ARG_LOG_LEVEL} ${ARG_DEV_MODE}
|
|
else
|
|
python3 web.py ${ARG_PORT} ${ARG_PASSWORD} ${ARG_RASCSI_HOST} ${ARG_RASCSI_PORT} ${ARG_LOG_LEVEL} ${ARG_DEV_MODE}
|
|
fi |