From 17497cf1fe333d048977f4d44e43ad169eb9967a Mon Sep 17 00:00:00 2001 From: Benjamin Zeiss Date: Sun, 9 Jan 2022 15:26:28 +0100 Subject: [PATCH] clean squashed restructuring branch. #455 --- .gitignore | 8 +- easyinstall.sh | 291 +++++++++++------- {src => python}/.pylintrc | 0 python/common/src/.gitkeep | 0 python/common/tests/.gitkeep | 0 {src => python}/loopback_test/test.py | 0 python/oled/.pylintrc | 1 + {src/oled_monitor => python/oled}/README.md | 2 +- .../oled}/requirements.txt | 0 .../oled/resources}/splash_start_32.bmp | Bin .../oled/resources}/splash_start_64.bmp | Bin .../oled/resources}/type_writer.ttf | Bin .../oled/service-infra/rascsi-oled.service | 6 +- .../oled/src}/interrupt_handler.py | 0 .../oled/src}/pi_cmds.py | 0 .../oled/src}/ractl_cmds.py | 0 .../oled/src}/rascsi_oled_monitor.py | 4 +- .../oled/src}/socket_cmds.py | 0 {src/oled_monitor => python/oled}/start.sh | 14 +- python/oled/tests/.gitkeep | 0 python/web/.pylintrc | 1 + {src => python}/web/README.md | 2 +- {src => python}/web/babel.cfg | 0 {src => python}/web/mock/bin/brctl | 0 {src => python}/web/mock/bin/journalctl | 0 {src => python}/web/mock/bin/systemctl | 0 {src => python}/web/requirements.txt | 0 {src => python}/web/service-infra/502.html | 0 .../web/service-infra/nginx-default.conf | 0 .../web/service-infra/rascsi-web.service | 2 +- {src/web => python/web/src}/device_utils.py | 0 .../web/src}/drive_properties.json | 0 {src/web => python/web/src}/file_cmds.py | 0 {src/web => python/web/src}/pi_cmds.py | 0 .../web/src}/pwa/android-icon-144x144.png | Bin .../web/src}/pwa/android-icon-192x192.png | Bin .../web/src}/pwa/android-icon-36x36.png | Bin .../web/src}/pwa/android-icon-48x48.png | Bin .../web/src}/pwa/android-icon-72x72.png | Bin .../web/src}/pwa/android-icon-96x96.png | Bin .../web/src}/pwa/apple-icon-114x114.png | Bin .../web/src}/pwa/apple-icon-120x120.png | Bin .../web/src}/pwa/apple-icon-144x144.png | Bin .../web/src}/pwa/apple-icon-152x152.png | Bin .../web/src}/pwa/apple-icon-180x180.png | Bin .../web/src}/pwa/apple-icon-57x57.png | Bin .../web/src}/pwa/apple-icon-60x60.png | Bin .../web/src}/pwa/apple-icon-72x72.png | Bin .../web/src}/pwa/apple-icon-76x76.png | Bin .../web/src}/pwa/apple-icon-precomposed.png | Bin .../web => python/web/src}/pwa/apple-icon.png | Bin .../web/src}/pwa/browserconfig.xml | 0 .../web/src}/pwa/favicon-16x16.png | Bin .../web/src}/pwa/favicon-32x32.png | Bin .../web/src}/pwa/favicon-96x96.png | Bin {src/web => python/web/src}/pwa/favicon.ico | Bin {src/web => python/web/src}/pwa/manifest.json | 0 .../web/src}/pwa/ms-icon-144x144.png | Bin .../web/src}/pwa/ms-icon-150x150.png | Bin .../web/src}/pwa/ms-icon-310x310.png | Bin .../web/src}/pwa/ms-icon-70x70.png | Bin {src/web => python/web/src}/ractl_cmds.py | 0 {src/web => python/web/src}/settings.py | 0 {src/web => python/web/src}/socket_cmds.py | 0 {src/web => python/web/src}/static/style.css | 0 .../web/src}/templates/base.html | 0 .../web/src}/templates/drives.html | 0 .../web/src}/templates/index.html | 0 .../translations/de/LC_MESSAGES/messages.po | 0 .../translations/es/LC_MESSAGES/messages.po | 0 .../translations/fr/LC_MESSAGES/messages.po | 0 .../translations/sv/LC_MESSAGES/messages.po | 0 {src/web => python/web/src}/web.py | 0 {src => python}/web/start.sh | 10 +- python/web/tests/.gitkeep | 0 src/oled_monitor/.pylintrc | 1 - src/web/.pylintrc | 1 - 77 files changed, 211 insertions(+), 132 deletions(-) rename {src => python}/.pylintrc (100%) create mode 100644 python/common/src/.gitkeep create mode 100644 python/common/tests/.gitkeep rename {src => python}/loopback_test/test.py (100%) mode change 100755 => 100644 create mode 100644 python/oled/.pylintrc rename {src/oled_monitor => python/oled}/README.md (97%) rename {src/oled_monitor => python/oled}/requirements.txt (100%) rename {src/oled_monitor => python/oled/resources}/splash_start_32.bmp (100%) rename {src/oled_monitor => python/oled/resources}/splash_start_64.bmp (100%) rename {src/oled_monitor => python/oled/resources}/type_writer.ttf (100%) rename src/oled_monitor/monitor_rascsi.service => python/oled/service-infra/rascsi-oled.service (64%) rename {src/oled_monitor => python/oled/src}/interrupt_handler.py (100%) rename {src/oled_monitor => python/oled/src}/pi_cmds.py (100%) rename {src/oled_monitor => python/oled/src}/ractl_cmds.py (100%) rename {src/oled_monitor => python/oled/src}/rascsi_oled_monitor.py (98%) rename {src/oled_monitor => python/oled/src}/socket_cmds.py (100%) rename {src/oled_monitor => python/oled}/start.sh (91%) create mode 100644 python/oled/tests/.gitkeep create mode 100644 python/web/.pylintrc rename {src => python}/web/README.md (97%) rename {src => python}/web/babel.cfg (100%) rename {src => python}/web/mock/bin/brctl (100%) rename {src => python}/web/mock/bin/journalctl (100%) mode change 100755 => 100644 rename {src => python}/web/mock/bin/systemctl (100%) mode change 100755 => 100644 rename {src => python}/web/requirements.txt (100%) rename {src => python}/web/service-infra/502.html (100%) rename {src => python}/web/service-infra/nginx-default.conf (100%) rename {src => python}/web/service-infra/rascsi-web.service (77%) rename {src/web => python/web/src}/device_utils.py (100%) rename {src/web => python/web/src}/drive_properties.json (100%) rename {src/web => python/web/src}/file_cmds.py (100%) rename {src/web => python/web/src}/pi_cmds.py (100%) rename {src/web => python/web/src}/pwa/android-icon-144x144.png (100%) rename {src/web => python/web/src}/pwa/android-icon-192x192.png (100%) rename {src/web => python/web/src}/pwa/android-icon-36x36.png (100%) rename {src/web => python/web/src}/pwa/android-icon-48x48.png (100%) rename {src/web => python/web/src}/pwa/android-icon-72x72.png (100%) rename {src/web => python/web/src}/pwa/android-icon-96x96.png (100%) rename {src/web => python/web/src}/pwa/apple-icon-114x114.png (100%) rename {src/web => python/web/src}/pwa/apple-icon-120x120.png (100%) rename {src/web => python/web/src}/pwa/apple-icon-144x144.png (100%) rename {src/web => python/web/src}/pwa/apple-icon-152x152.png (100%) rename {src/web => python/web/src}/pwa/apple-icon-180x180.png (100%) rename {src/web => python/web/src}/pwa/apple-icon-57x57.png (100%) rename {src/web => python/web/src}/pwa/apple-icon-60x60.png (100%) rename {src/web => python/web/src}/pwa/apple-icon-72x72.png (100%) rename {src/web => python/web/src}/pwa/apple-icon-76x76.png (100%) rename {src/web => python/web/src}/pwa/apple-icon-precomposed.png (100%) rename {src/web => python/web/src}/pwa/apple-icon.png (100%) rename {src/web => python/web/src}/pwa/browserconfig.xml (100%) rename {src/web => python/web/src}/pwa/favicon-16x16.png (100%) rename {src/web => python/web/src}/pwa/favicon-32x32.png (100%) rename {src/web => python/web/src}/pwa/favicon-96x96.png (100%) rename {src/web => python/web/src}/pwa/favicon.ico (100%) rename {src/web => python/web/src}/pwa/manifest.json (100%) rename {src/web => python/web/src}/pwa/ms-icon-144x144.png (100%) rename {src/web => python/web/src}/pwa/ms-icon-150x150.png (100%) rename {src/web => python/web/src}/pwa/ms-icon-310x310.png (100%) rename {src/web => python/web/src}/pwa/ms-icon-70x70.png (100%) rename {src/web => python/web/src}/ractl_cmds.py (100%) rename {src/web => python/web/src}/settings.py (100%) rename {src/web => python/web/src}/socket_cmds.py (100%) rename {src/web => python/web/src}/static/style.css (100%) rename {src/web => python/web/src}/templates/base.html (100%) rename {src/web => python/web/src}/templates/drives.html (100%) rename {src/web => python/web/src}/templates/index.html (100%) rename {src/web => python/web/src}/translations/de/LC_MESSAGES/messages.po (100%) rename {src/web => python/web/src}/translations/es/LC_MESSAGES/messages.po (100%) rename {src/web => python/web/src}/translations/fr/LC_MESSAGES/messages.po (100%) rename {src/web => python/web/src}/translations/sv/LC_MESSAGES/messages.po (100%) rename {src/web => python/web/src}/web.py (100%) rename {src => python}/web/start.sh (93%) create mode 100644 python/web/tests/.gitkeep delete mode 120000 src/oled_monitor/.pylintrc delete mode 120000 src/web/.pylintrc diff --git a/.gitignore b/.gitignore index 6226875f..05087471 100644 --- a/.gitignore +++ b/.gitignore @@ -5,10 +5,10 @@ core .DS_Store *.swp __pycache__ -src/web/current -src/web/rascsi_interface_pb2.py -src/oled_monitor/current -src/oled_monitor/rascsi_interface_pb2.py +python/web/current +python/web/src/rascsi_interface_pb2.py +python/oled/current +python/oled/src/rascsi_interface_pb2.py src/raspberrypi/hfdisk/ *~ messages.pot diff --git a/easyinstall.sh b/easyinstall.sh index 9c13d940..6dbf6901 100755 --- a/easyinstall.sh +++ b/easyinstall.sh @@ -50,7 +50,8 @@ USER=$(whoami) BASE=$(dirname "$(readlink -f "${0}")") VIRTUAL_DRIVER_PATH="$HOME/images" CFG_PATH="$HOME/.config/rascsi" -WEB_INSTALL_PATH="$BASE/src/web" +WEB_INSTALL_PATH="$BASE/python/web" +OLED_INSTALL_PATH="$BASE/python/oled" SYSTEMD_PATH="/etc/systemd/system" HFS_FORMAT=/usr/bin/hformat HFDISK_BIN=/usr/bin/hfdisk @@ -100,108 +101,16 @@ function installRaScsiWebInterface() { echo "Deleting old Python protobuf library rascsi_interface_pb2.py" fi echo "Compiling the Python protobuf library rascsi_interface_pb2.py..." - protoc -I="$BASE/src/raspberrypi/" --python_out="$WEB_INSTALL_PATH" rascsi_interface.proto + protoc -I="$BASE/src/raspberrypi/" --python_out="$WEB_INSTALL_PATH/src" rascsi_interface.proto - sudo cp -f "$BASE/src/web/service-infra/nginx-default.conf" /etc/nginx/sites-available/default - sudo cp -f "$BASE/src/web/service-infra/502.html" /var/www/html/502.html + sudo cp -f "$WEB_INSTALL_PATH/service-infra/nginx-default.conf" /etc/nginx/sites-available/default + sudo cp -f "$WEB_INSTALL_PATH/service-infra/502.html" /var/www/html/502.html sudo usermod -a -G $USER www-data sudo systemctl reload nginx || true } -# updates configuration files and installs packages needed for the OLED screen script -function installRaScsiScreen() { - echo "IMPORTANT: This configuration requires a OLED screen to be installed onto your RaSCSI board." - echo "See wiki for more information: https://github.com/akuker/RASCSI/wiki/OLED-Status-Display-(Optional)" - echo "" - echo "Choose screen rotation:" - echo " 1) 0 degrees" - echo " 2) 180 degrees (default)" - read REPLY - - if [ "$REPLY" == "1" ]; then - echo "Proceeding with 0 degrees rotation." - ROTATION="0" - else - echo "Proceeding with 180 degrees rotation." - ROTATION="180" - fi - - echo "" - echo "Choose screen resolution:" - echo " 1) 128x32 pixels (default)" - echo " 2) 128x64 pixels" - read REPLY - - if [ "$REPLY" == "2" ]; then - echo "Proceeding with 128x64 pixel resolution." - SCREEN_HEIGHT="64" - else - echo "Proceeding with 128x32 pixel resolution." - SCREEN_HEIGHT="32" - fi - - if [ -z "$TOKEN" ]; then - echo "" - echo "Did you protect your RaSCSI installation with a token password? [y/N]" - read -r REPLY - if [ "$REPLY" == "y" ] || [ "$REPLY" == "Y" ]; then - echo -n "Enter the password that you configured with RaSCSI at the time of installation: " - read -r TOKEN - fi - fi - - stopRaScsiScreen - updateRaScsiGit - - sudo apt-get update && sudo apt-get install libjpeg-dev libpng-dev libopenjp2-7-dev i2c-tools raspi-config -y /dev/null 2>&1 || SERVICE_RASCSI_RUNNING=$? + if [[ $SERVICE_RASCSI_RUNNING -eq 0 ]]; then + sudo systemctl stop rascsi.service + fi fi } # Stops the rascsi-web service if it is running function stopRaScsiWeb() { - if [ -f "$SYSTEMD_PATH/rascsi-web.service" ]; then - sudo systemctl stop rascsi-web.service + if [[ -f "$SYSTEMD_PATH/rascsi-web.service" ]]; then + SERVICE_RASCSI_WEB_RUNNING=0 + sudo systemctl is-active --quiet rascsi-web.service >/dev/null 2>&1 || SERVICE_RASCSI_WEB_RUNNING=$? + if [[ $SERVICE_RASCSI_WEB_RUNNING -eq 0 ]]; then + sudo systemctl stop rascsi-web.service + fi fi } -# Stops the monitor_rascsi service if it is running +# Stops the rascsi-oled service if it is running function stopRaScsiScreen() { + if [[ -f "$SYSTEMD_PATH/monitor_rascsi.service" ]]; then + SERVICE_MONITOR_RASCSI_RUNNING=0 + sudo systemctl is-active --quiet monitor_rascsi.service >/dev/null 2>&1 || SERVICE_MONITOR_RASCSI_RUNNING=$? + if [[ $SERVICE_MONITOR_RASCSI_RUNNING -eq 0 ]]; then + sudo systemctl stop monitor_rascsi.service + fi + fi + if [[ -f "$SYSTEMD_PATH/rascsi-oled.service" ]]; then + SERVICE_RASCSI_OLED_RUNNING=0 + sudo systemctl is-active --quiet rascsi-oled.service >/dev/null 2>&1 || SERVICE_RASCSI_OLED_RUNNING=$? + if [[ $SERVICE_RASCSI_OLED_RUNNING -eq 0 ]]; then + sudo systemctl stop rascsi-oled.service + fi + fi +} + +# disables and removes the old monitor_rascsi service +function disableOldRaScsiMonitorService() { if [ -f "$SYSTEMD_PATH/monitor_rascsi.service" ]; then - sudo systemctl stop monitor_rascsi.service + SERVICE_MONITOR_RASCSI_RUNNING=0 + sudo systemctl is-active --quiet monitor_rascsi.service >/dev/null 2>&1 || SERVICE_MONITOR_RASCSI_RUNNING=$? + if [[ $SERVICE_MONITOR_RASCSI_RUNNING -eq 0 ]]; then + sudo systemctl stop monitor_rascsi.service + fi + + SERVICE_MONITOR_RASCSI_ENABLED=0 + sudo systemctl is-enabled --quiet monitor_rascsi.service >/dev/null 2>&1 || SERVICE_MONITOR_RASCSI_ENABLED=$? + if [[ $SERVICE_MONITOR_RASCSI_ENABLED -eq 0 ]]; then + sudo systemctl disable monitor_rascsi.service + fi + sudo rm $SYSTEMD_PATH/monitor_rascsi.service fi } @@ -365,10 +311,34 @@ function stopMacproxy() { fi } -# Starts the monitor_rascsi service if installed +# Starts the rascsi-oled service if installed +function isRaScsiScreenInstalled() { + SERVICE_RASCSI_OLED_ENABLED=0 + if [[ -f "$SYSTEMD_PATH/rascsi-oled.service" ]]; then + sudo systemctl is-enabled --quiet rascsi-oled.service >/dev/null 2>&1 || SERVICE_RASCSI_OLED_ENABLED=$? + elif [[ -f "$SYSTEMD_PATH/monitor_rascsi.service" ]]; then + sudo systemctl is-enabled --quiet monitor_rascsi.service >/dev/null 2>&1 || SERVICE_RASCSI_OLED_ENABLED=$? + fi + + echo $SERVICE_RASCSI_OLED_ENABLED +} + +# Starts the rascsi-oled service if installed +function isRaScsiScreenRunning() { + SERVICE_RASCSI_OLED_RUNNING=0 + if [[ -f "$SYSTEMD_PATH/rascsi-oled.service" ]]; then + sudo systemctl is-active --quiet rascsi-oled.service >/dev/null 2>&1 || SERVICE_RASCSI_OLED_RUNNING=$? + elif [[ -f "$SYSTEMD_PATH/monitor_rascsi.service" ]]; then + sudo systemctl is-active --quiet monitor_rascsi.service >/dev/null 2>&1 || SERVICE_RASCSI_OLED_RUNNING=$? + fi + + echo $SERVICE_RASCSI_OLED_RUNNING +} + +# Starts the rascsi-oled service if installed function startRaScsiScreen() { - if [ -f "$SYSTEMD_PATH/monitor_rascsi.service" ]; then - sudo systemctl start monitor_rascsi.service + if [[ $(isRaScsiScreenInstalled) -eq 0 ]] && [[ $(isRaScsiScreenRunning) -ne 1 ]]; then + sudo systemctl start rascsi-oled.service showRaScsiScreenStatus fi } @@ -391,9 +361,9 @@ function showRaScsiWebStatus() { systemctl status rascsi-web | tee } -# Shows status for the monitor_rascsi service +# Shows status for the rascsi-oled service function showRaScsiScreenStatus() { - systemctl status monitor_rascsi | tee + systemctl status rascsi-oled | tee } # Shows status for the macproxy service @@ -758,6 +728,103 @@ function installMacproxy { echo "" } +# updates configuration files and installs packages needed for the OLED screen script +function installRaScsiScreen() { + echo "IMPORTANT: This configuration requires a OLED screen to be installed onto your RaSCSI board." + echo "See wiki for more information: https://github.com/akuker/RASCSI/wiki/OLED-Status-Display-(Optional)" + echo "" + echo "Choose screen rotation:" + echo " 1) 0 degrees" + echo " 2) 180 degrees (default)" + read REPLY + + if [ "$REPLY" == "1" ]; then + echo "Proceeding with 0 degrees rotation." + ROTATION="0" + else + echo "Proceeding with 180 degrees rotation." + ROTATION="180" + fi + + echo "" + echo "Choose screen resolution:" + echo " 1) 128x32 pixels (default)" + echo " 2) 128x64 pixels" + read REPLY + + if [ "$REPLY" == "2" ]; then + echo "Proceeding with 128x64 pixel resolution." + SCREEN_HEIGHT="64" + else + echo "Proceeding with 128x32 pixel resolution." + SCREEN_HEIGHT="32" + fi + + if [ -z "$TOKEN" ]; then + echo "" + echo "Did you protect your RaSCSI installation with a token password? [y/N]" + read -r REPLY + if [ "$REPLY" == "y" ] || [ "$REPLY" == "Y" ]; then + echo -n "Enter the password that you configured with RaSCSI at the time of installation: " + read -r TOKEN + fi + fi + + stopRaScsiScreen + updateRaScsiGit + + sudo apt-get update && sudo apt-get install libjpeg-dev libpng-dev libopenjp2-7-dev i2c-tools raspi-config -y /dev/null; then +if pgrep -f "python3 src/rascsi_oled_monitor.py" &> /dev/null; then echo "Detected active rascsi_oled_monitor.py process" echo "Terminating before launching a new one." - sudo pkill -f "python3 rascsi_oled_monitor.py" + sudo pkill -f "python3 src/rascsi_oled_monitor.py" fi if ! i2cdetect -y 1 &> /dev/null ; then @@ -88,7 +88,13 @@ if ! test -e venv; then echo "Installing requirements.txt" pip3 install wheel CFLAGS="$COMPILER_FLAGS" pip3 install -r requirements.txt - git rev-parse HEAD > current + + set +e + git rev-parse --is-inside-work-tree &> /dev/null + if [[ $? -eq 0 ]]; then + git rev-parse HEAD > current + fi + set -e fi source venv/bin/activate @@ -143,4 +149,4 @@ if [ -z ${HEIGHT+x} ]; then else echo "Starting with parameter $HEIGHT" fi -python3 rascsi_oled_monitor.py ${ROTATION} ${HEIGHT} ${PASSWORD} +python3 src/rascsi_oled_monitor.py ${ROTATION} ${HEIGHT} ${PASSWORD} diff --git a/python/oled/tests/.gitkeep b/python/oled/tests/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/python/web/.pylintrc b/python/web/.pylintrc new file mode 100644 index 00000000..30b33b52 --- /dev/null +++ b/python/web/.pylintrc @@ -0,0 +1 @@ +../.pylintrc \ No newline at end of file diff --git a/src/web/README.md b/python/web/README.md similarity index 97% rename from src/web/README.md rename to python/web/README.md index 7616b450..e480a8b0 100644 --- a/src/web/README.md +++ b/python/web/README.md @@ -10,7 +10,7 @@ $ source venv/bin/activate # Install requirements $ pip install -r requirements.txt # Use mocks and a temp dir - start the web server -$ BASE_DIR=/tmp/images/ PATH=$PATH:`pwd`/mock/bin/ python3 web.py +$ BASE_DIR=/tmp/images/ PATH=$PATH:`pwd`/mock/bin/ cd src && python3 web.py ``` ### Mocks for local development diff --git a/src/web/babel.cfg b/python/web/babel.cfg similarity index 100% rename from src/web/babel.cfg rename to python/web/babel.cfg diff --git a/src/web/mock/bin/brctl b/python/web/mock/bin/brctl similarity index 100% rename from src/web/mock/bin/brctl rename to python/web/mock/bin/brctl diff --git a/src/web/mock/bin/journalctl b/python/web/mock/bin/journalctl old mode 100755 new mode 100644 similarity index 100% rename from src/web/mock/bin/journalctl rename to python/web/mock/bin/journalctl diff --git a/src/web/mock/bin/systemctl b/python/web/mock/bin/systemctl old mode 100755 new mode 100644 similarity index 100% rename from src/web/mock/bin/systemctl rename to python/web/mock/bin/systemctl diff --git a/src/web/requirements.txt b/python/web/requirements.txt similarity index 100% rename from src/web/requirements.txt rename to python/web/requirements.txt diff --git a/src/web/service-infra/502.html b/python/web/service-infra/502.html similarity index 100% rename from src/web/service-infra/502.html rename to python/web/service-infra/502.html diff --git a/src/web/service-infra/nginx-default.conf b/python/web/service-infra/nginx-default.conf similarity index 100% rename from src/web/service-infra/nginx-default.conf rename to python/web/service-infra/nginx-default.conf diff --git a/src/web/service-infra/rascsi-web.service b/python/web/service-infra/rascsi-web.service similarity index 77% rename from src/web/service-infra/rascsi-web.service rename to python/web/service-infra/rascsi-web.service index cd4a4dc5..0b681a60 100644 --- a/src/web/service-infra/rascsi-web.service +++ b/python/web/service-infra/rascsi-web.service @@ -5,7 +5,7 @@ After=network.target [Service] Type=simple Restart=always -ExecStart=/home/pi/RASCSI/src/web/start.sh +ExecStart=/home/pi/RASCSI/python/web/start.sh SyslogIdentifier=RASCSIWEB [Install] diff --git a/src/web/device_utils.py b/python/web/src/device_utils.py similarity index 100% rename from src/web/device_utils.py rename to python/web/src/device_utils.py diff --git a/src/web/drive_properties.json b/python/web/src/drive_properties.json similarity index 100% rename from src/web/drive_properties.json rename to python/web/src/drive_properties.json diff --git a/src/web/file_cmds.py b/python/web/src/file_cmds.py similarity index 100% rename from src/web/file_cmds.py rename to python/web/src/file_cmds.py diff --git a/src/web/pi_cmds.py b/python/web/src/pi_cmds.py similarity index 100% rename from src/web/pi_cmds.py rename to python/web/src/pi_cmds.py diff --git a/src/web/pwa/android-icon-144x144.png b/python/web/src/pwa/android-icon-144x144.png similarity index 100% rename from src/web/pwa/android-icon-144x144.png rename to python/web/src/pwa/android-icon-144x144.png diff --git a/src/web/pwa/android-icon-192x192.png b/python/web/src/pwa/android-icon-192x192.png similarity index 100% rename from src/web/pwa/android-icon-192x192.png rename to python/web/src/pwa/android-icon-192x192.png diff --git a/src/web/pwa/android-icon-36x36.png b/python/web/src/pwa/android-icon-36x36.png similarity index 100% rename from src/web/pwa/android-icon-36x36.png rename to python/web/src/pwa/android-icon-36x36.png diff --git a/src/web/pwa/android-icon-48x48.png b/python/web/src/pwa/android-icon-48x48.png similarity index 100% rename from src/web/pwa/android-icon-48x48.png rename to python/web/src/pwa/android-icon-48x48.png diff --git a/src/web/pwa/android-icon-72x72.png b/python/web/src/pwa/android-icon-72x72.png similarity index 100% rename from src/web/pwa/android-icon-72x72.png rename to python/web/src/pwa/android-icon-72x72.png diff --git a/src/web/pwa/android-icon-96x96.png b/python/web/src/pwa/android-icon-96x96.png similarity index 100% rename from src/web/pwa/android-icon-96x96.png rename to python/web/src/pwa/android-icon-96x96.png diff --git a/src/web/pwa/apple-icon-114x114.png b/python/web/src/pwa/apple-icon-114x114.png similarity index 100% rename from src/web/pwa/apple-icon-114x114.png rename to python/web/src/pwa/apple-icon-114x114.png diff --git a/src/web/pwa/apple-icon-120x120.png b/python/web/src/pwa/apple-icon-120x120.png similarity index 100% rename from src/web/pwa/apple-icon-120x120.png rename to python/web/src/pwa/apple-icon-120x120.png diff --git a/src/web/pwa/apple-icon-144x144.png b/python/web/src/pwa/apple-icon-144x144.png similarity index 100% rename from src/web/pwa/apple-icon-144x144.png rename to python/web/src/pwa/apple-icon-144x144.png diff --git a/src/web/pwa/apple-icon-152x152.png b/python/web/src/pwa/apple-icon-152x152.png similarity index 100% rename from src/web/pwa/apple-icon-152x152.png rename to python/web/src/pwa/apple-icon-152x152.png diff --git a/src/web/pwa/apple-icon-180x180.png b/python/web/src/pwa/apple-icon-180x180.png similarity index 100% rename from src/web/pwa/apple-icon-180x180.png rename to python/web/src/pwa/apple-icon-180x180.png diff --git a/src/web/pwa/apple-icon-57x57.png b/python/web/src/pwa/apple-icon-57x57.png similarity index 100% rename from src/web/pwa/apple-icon-57x57.png rename to python/web/src/pwa/apple-icon-57x57.png diff --git a/src/web/pwa/apple-icon-60x60.png b/python/web/src/pwa/apple-icon-60x60.png similarity index 100% rename from src/web/pwa/apple-icon-60x60.png rename to python/web/src/pwa/apple-icon-60x60.png diff --git a/src/web/pwa/apple-icon-72x72.png b/python/web/src/pwa/apple-icon-72x72.png similarity index 100% rename from src/web/pwa/apple-icon-72x72.png rename to python/web/src/pwa/apple-icon-72x72.png diff --git a/src/web/pwa/apple-icon-76x76.png b/python/web/src/pwa/apple-icon-76x76.png similarity index 100% rename from src/web/pwa/apple-icon-76x76.png rename to python/web/src/pwa/apple-icon-76x76.png diff --git a/src/web/pwa/apple-icon-precomposed.png b/python/web/src/pwa/apple-icon-precomposed.png similarity index 100% rename from src/web/pwa/apple-icon-precomposed.png rename to python/web/src/pwa/apple-icon-precomposed.png diff --git a/src/web/pwa/apple-icon.png b/python/web/src/pwa/apple-icon.png similarity index 100% rename from src/web/pwa/apple-icon.png rename to python/web/src/pwa/apple-icon.png diff --git a/src/web/pwa/browserconfig.xml b/python/web/src/pwa/browserconfig.xml similarity index 100% rename from src/web/pwa/browserconfig.xml rename to python/web/src/pwa/browserconfig.xml diff --git a/src/web/pwa/favicon-16x16.png b/python/web/src/pwa/favicon-16x16.png similarity index 100% rename from src/web/pwa/favicon-16x16.png rename to python/web/src/pwa/favicon-16x16.png diff --git a/src/web/pwa/favicon-32x32.png b/python/web/src/pwa/favicon-32x32.png similarity index 100% rename from src/web/pwa/favicon-32x32.png rename to python/web/src/pwa/favicon-32x32.png diff --git a/src/web/pwa/favicon-96x96.png b/python/web/src/pwa/favicon-96x96.png similarity index 100% rename from src/web/pwa/favicon-96x96.png rename to python/web/src/pwa/favicon-96x96.png diff --git a/src/web/pwa/favicon.ico b/python/web/src/pwa/favicon.ico similarity index 100% rename from src/web/pwa/favicon.ico rename to python/web/src/pwa/favicon.ico diff --git a/src/web/pwa/manifest.json b/python/web/src/pwa/manifest.json similarity index 100% rename from src/web/pwa/manifest.json rename to python/web/src/pwa/manifest.json diff --git a/src/web/pwa/ms-icon-144x144.png b/python/web/src/pwa/ms-icon-144x144.png similarity index 100% rename from src/web/pwa/ms-icon-144x144.png rename to python/web/src/pwa/ms-icon-144x144.png diff --git a/src/web/pwa/ms-icon-150x150.png b/python/web/src/pwa/ms-icon-150x150.png similarity index 100% rename from src/web/pwa/ms-icon-150x150.png rename to python/web/src/pwa/ms-icon-150x150.png diff --git a/src/web/pwa/ms-icon-310x310.png b/python/web/src/pwa/ms-icon-310x310.png similarity index 100% rename from src/web/pwa/ms-icon-310x310.png rename to python/web/src/pwa/ms-icon-310x310.png diff --git a/src/web/pwa/ms-icon-70x70.png b/python/web/src/pwa/ms-icon-70x70.png similarity index 100% rename from src/web/pwa/ms-icon-70x70.png rename to python/web/src/pwa/ms-icon-70x70.png diff --git a/src/web/ractl_cmds.py b/python/web/src/ractl_cmds.py similarity index 100% rename from src/web/ractl_cmds.py rename to python/web/src/ractl_cmds.py diff --git a/src/web/settings.py b/python/web/src/settings.py similarity index 100% rename from src/web/settings.py rename to python/web/src/settings.py diff --git a/src/web/socket_cmds.py b/python/web/src/socket_cmds.py similarity index 100% rename from src/web/socket_cmds.py rename to python/web/src/socket_cmds.py diff --git a/src/web/static/style.css b/python/web/src/static/style.css similarity index 100% rename from src/web/static/style.css rename to python/web/src/static/style.css diff --git a/src/web/templates/base.html b/python/web/src/templates/base.html similarity index 100% rename from src/web/templates/base.html rename to python/web/src/templates/base.html diff --git a/src/web/templates/drives.html b/python/web/src/templates/drives.html similarity index 100% rename from src/web/templates/drives.html rename to python/web/src/templates/drives.html diff --git a/src/web/templates/index.html b/python/web/src/templates/index.html similarity index 100% rename from src/web/templates/index.html rename to python/web/src/templates/index.html diff --git a/src/web/translations/de/LC_MESSAGES/messages.po b/python/web/src/translations/de/LC_MESSAGES/messages.po similarity index 100% rename from src/web/translations/de/LC_MESSAGES/messages.po rename to python/web/src/translations/de/LC_MESSAGES/messages.po diff --git a/src/web/translations/es/LC_MESSAGES/messages.po b/python/web/src/translations/es/LC_MESSAGES/messages.po similarity index 100% rename from src/web/translations/es/LC_MESSAGES/messages.po rename to python/web/src/translations/es/LC_MESSAGES/messages.po diff --git a/src/web/translations/fr/LC_MESSAGES/messages.po b/python/web/src/translations/fr/LC_MESSAGES/messages.po similarity index 100% rename from src/web/translations/fr/LC_MESSAGES/messages.po rename to python/web/src/translations/fr/LC_MESSAGES/messages.po diff --git a/src/web/translations/sv/LC_MESSAGES/messages.po b/python/web/src/translations/sv/LC_MESSAGES/messages.po similarity index 100% rename from src/web/translations/sv/LC_MESSAGES/messages.po rename to python/web/src/translations/sv/LC_MESSAGES/messages.po diff --git a/src/web/web.py b/python/web/src/web.py similarity index 100% rename from src/web/web.py rename to python/web/src/web.py diff --git a/src/web/start.sh b/python/web/start.sh similarity index 93% rename from src/web/start.sh rename to python/web/start.sh index 82e48839..86ab4a79 100755 --- a/src/web/start.sh +++ b/python/web/start.sh @@ -56,13 +56,18 @@ if ! test -e venv; then echo "Installing requirements.txt" pip3 install wheel pip3 install -r requirements.txt - git rev-parse HEAD > current + + 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 @@ -78,7 +83,7 @@ else fi set -e -pybabel compile -d translations +pybabel compile -d src/translations # parse arguments while [ "$1" != "" ]; do @@ -100,4 +105,5 @@ while [ "$1" != "" ]; do done echo "Starting web server for RaSCSI Web Interface..." +cd src python3 web.py ${PORT} ${PASSWORD} diff --git a/python/web/tests/.gitkeep b/python/web/tests/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/src/oled_monitor/.pylintrc b/src/oled_monitor/.pylintrc deleted file mode 120000 index 30b33b52..00000000 --- a/src/oled_monitor/.pylintrc +++ /dev/null @@ -1 +0,0 @@ -../.pylintrc \ No newline at end of file diff --git a/src/web/.pylintrc b/src/web/.pylintrc deleted file mode 120000 index 30b33b52..00000000 --- a/src/web/.pylintrc +++ /dev/null @@ -1 +0,0 @@ -../.pylintrc \ No newline at end of file