From 4837681105b012dd2b1805b874aba1029e04fb3d Mon Sep 17 00:00:00 2001 From: Kyle Gabriel Date: Sun, 14 Jan 2024 19:57:16 -0500 Subject: [PATCH] remove unnecessary symlink use, remove other access to /opt/Mycodo --- CHANGELOG.md | 2 +- mycodo/config.py | 10 +++++----- mycodo/scripts/upgrade_commands.sh | 1 + mycodo/scripts/upgrade_post.sh | 1 + mycodo/widgets/widget_graph_synchronous.py | 6 +++--- 5 files changed, 11 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ba85ffb90..3ee499a07 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ This release updates several python packages that require Python >= 3.8. You can This release changes the Desktop grid width from 20 to 24, enabling the use of 3 column layouts that are evenly-spaced. You will need to resize/rearrange Dashboard Widgets after this update to correct for the new width. The update of Gridstack to 10.0.1 also now allows the ability to drag Desktop widgets on mobile devices. If you don't like this behavior, you should lock the desktop from the Dashboard Configuration menu to prevent widgets from being dragged/rearranged. -This release changes the install directory from ~/Mycodo to /opt/Mycodo. This should occur automatically during the upgrade. +This release changes the install directory from ~/Mycodo to /opt/Mycodo. This necessitates deleting and regenerating the Python virtual environment. If you have any custom changes to the Mycodo venv, you will need to make those changes again after the upgrade. As a result of moving the install directory, following the upgrade, you will need to either run "sudo service mycodoflask restart" in a terminal or reboot your system for the web interface to become accessible again. ### Bugfixes diff --git a/mycodo/config.py b/mycodo/config.py index 7a7648584..e527f1b0c 100644 --- a/mycodo/config.py +++ b/mycodo/config.py @@ -356,11 +356,11 @@ 'cp -rf Highcharts-Stock-9.1.2/code/modules/data.js /opt/Mycodo/mycodo/mycodo_flask/static/js/user_js/data-9.1.2.js', 'cp -rf Highcharts-Stock-9.1.2/code/modules/data.js.map /opt/Mycodo/mycodo/mycodo_flask/static/js/user_js/data.js.map', 'cp -rf Highcharts-Stock-9.1.2/code/modules/exporting.js /opt/Mycodo/mycodo/mycodo_flask/static/js/user_js/exporting-9.1.2.js', - 'cp -rf Highcharts-Stock-9.1.2/code/modules/exporting.js.map /var/mycodo-root/mycodo/mycodo_flask/static/js/user_js/exporting.js.map', - 'cp -rf Highcharts-Stock-9.1.2/code/modules/export-data.js /var/mycodo-root/mycodo/mycodo_flask/static/js/user_js/export-data-9.1.2.js', - 'cp -rf Highcharts-Stock-9.1.2/code/modules/export-data.js.map /var/mycodo-root/mycodo/mycodo_flask/static/js/user_js/export-data.js.map', - 'cp -rf Highcharts-Stock-9.1.2/code/modules/offline-exporting.js /var/mycodo-root/mycodo/mycodo_flask/static/js/user_js/offline-exporting-9.1.2.js', - 'cp -rf Highcharts-Stock-9.1.2/code/modules/offline-exporting.js.map /var/mycodo-root/mycodo/mycodo_flask/static/js/user_js/offline-exporting.js.map', + 'cp -rf Highcharts-Stock-9.1.2/code/modules/exporting.js.map /opt/Mycodo/mycodo/mycodo_flask/static/js/user_js/exporting.js.map', + 'cp -rf Highcharts-Stock-9.1.2/code/modules/export-data.js /opt/Mycodo/mycodo/mycodo_flask/static/js/user_js/export-data-9.1.2.js', + 'cp -rf Highcharts-Stock-9.1.2/code/modules/export-data.js.map /opt/Mycodo/mycodo/mycodo_flask/static/js/user_js/export-data.js.map', + 'cp -rf Highcharts-Stock-9.1.2/code/modules/offline-exporting.js /opt/Mycodo/mycodo/mycodo_flask/static/js/user_js/offline-exporting-9.1.2.js', + 'cp -rf Highcharts-Stock-9.1.2/code/modules/offline-exporting.js.map /opt/Mycodo/mycodo/mycodo_flask/static/js/user_js/offline-exporting.js.map', 'rm -rf Highcharts-Stock-9.1.2' ]) ] diff --git a/mycodo/scripts/upgrade_commands.sh b/mycodo/scripts/upgrade_commands.sh index 8591baac7..34733006e 100755 --- a/mycodo/scripts/upgrade_commands.sh +++ b/mycodo/scripts/upgrade_commands.sh @@ -604,6 +604,7 @@ case "${1:-''}" in find "${MYCODO_PATH}" -type d -exec chmod u+wx,g+wx {} + find "${MYCODO_PATH}" -type f -exec chmod u+w,g+w,o+r {} + + chmod 770 /opt/Mycodo # Exclude other users from viewing files chown root:mycodo "${MYCODO_PATH}"/mycodo/scripts/mycodo_wrapper chmod 4770 "${MYCODO_PATH}"/mycodo/scripts/mycodo_wrapper diff --git a/mycodo/scripts/upgrade_post.sh b/mycodo/scripts/upgrade_post.sh index de484e436..c76ef467b 100755 --- a/mycodo/scripts/upgrade_post.sh +++ b/mycodo/scripts/upgrade_post.sh @@ -20,6 +20,7 @@ rm -f "${INSTALL_DIRECTORY}"/statistics.id # Delete /env if Mycodo symlink target isn't /opt/Mycodo if [ "$(readlink /var/mycodo-root)" != "/opt/Mycodo" ] ; then + printf "\n#### Deleting and regenerating virtual environment ####\n\n" rm -rf "${INSTALL_DIRECTORY}"/env fi diff --git a/mycodo/widgets/widget_graph_synchronous.py b/mycodo/widgets/widget_graph_synchronous.py index 5fdaa7408..40a3a3404 100644 --- a/mycodo/widgets/widget_graph_synchronous.py +++ b/mycodo/widgets/widget_graph_synchronous.py @@ -225,9 +225,9 @@ def generate_page_variables(widget_unique_id, widget_options): 'cp -rf Highcharts-Stock-9.1.2/code/modules/exporting.js /opt/Mycodo/mycodo/mycodo_flask/static/js/user_js/exporting-9.1.2.js', 'cp -rf Highcharts-Stock-9.1.2/code/modules/exporting.js.map /opt/Mycodo/mycodo/mycodo_flask/static/js/user_js/exporting.js.map', 'cp -rf Highcharts-Stock-9.1.2/code/modules/export-data.js /opt/Mycodo/mycodo/mycodo_flask/static/js/user_js/export-data-9.1.2.js', - 'cp -rf Highcharts-Stock-9.1.2/code/modules/export-data.js.map /var/mycodo-root/mycodo/mycodo_flask/static/js/user_js/export-data.js.map', - 'cp -rf Highcharts-Stock-9.1.2/code/modules/offline-exporting.js /var/mycodo-root/mycodo/mycodo_flask/static/js/user_js/offline-exporting-9.1.2.js', - 'cp -rf Highcharts-Stock-9.1.2/code/modules/offline-exporting.js.map /var/mycodo-root/mycodo/mycodo_flask/static/js/user_js/offline-exporting.js.map', + 'cp -rf Highcharts-Stock-9.1.2/code/modules/export-data.js.map /opt/Mycodo/mycodo/mycodo_flask/static/js/user_js/export-data.js.map', + 'cp -rf Highcharts-Stock-9.1.2/code/modules/offline-exporting.js /opt/Mycodo/mycodo/mycodo_flask/static/js/user_js/offline-exporting-9.1.2.js', + 'cp -rf Highcharts-Stock-9.1.2/code/modules/offline-exporting.js.map /opt/Mycodo/mycodo/mycodo_flask/static/js/user_js/offline-exporting.js.map', 'rm -rf Highcharts-Stock-9.1.2.zip', 'rm -rf Highcharts-Stock-9.1.2' ])