mirror of
https://github.com/YunoHost-Apps/aeneria_ynh.git
synced 2024-09-03 18:06:15 +02:00
commit
1681641e00
10 changed files with 113 additions and 66 deletions
17
README.md
17
README.md
|
@ -1,7 +1,5 @@
|
||||||
# æneria for YunoHost
|
# æneria for YunoHost
|
||||||
|
|
||||||
**DO NOT USE, WORK IN PROGRESS**
|
|
||||||
|
|
||||||
[![Integration level](https://dash.yunohost.org/integration/aeneria.svg)](https://dash.yunohost.org/appci/app/aeneria) ![](https://ci-apps.yunohost.org/ci/badges/aeneria.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/aeneria.maintain.svg)
|
[![Integration level](https://dash.yunohost.org/integration/aeneria.svg)](https://dash.yunohost.org/appci/app/aeneria) ![](https://ci-apps.yunohost.org/ci/badges/aeneria.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/aeneria.maintain.svg)
|
||||||
[![Install æneria with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=aeneria)
|
[![Install æneria with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=aeneria)
|
||||||
|
|
||||||
|
@ -9,12 +7,12 @@
|
||||||
If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.*
|
If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.*
|
||||||
|
|
||||||
## Overview
|
## Overview
|
||||||
The idea of [æneria](https://gitlab.com/aeneria/aeneria-app) is to display electricity consumption and weather data on a little dashboard that allow the user to:
|
The idea of [æneria](https://gitlab.com/aeneria/aeneria-app) is to display energy consumption and weather data on a little dashboard that allow the user to:
|
||||||
|
|
||||||
* Better understand his electricity consumption
|
* Better understand our own energy consumption
|
||||||
* Analyse his electricity consumption throw weather data
|
* Analyse energy consumption throw weather data
|
||||||
|
|
||||||
**Shipped version:** 1.0.3
|
**Shipped version:** 1.0.4
|
||||||
|
|
||||||
## Screenshots
|
## Screenshots
|
||||||
|
|
||||||
|
@ -22,8 +20,9 @@ The idea of [æneria](https://gitlab.com/aeneria/aeneria-app) is to display elec
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
* First of all, you'll need a Linky (obviously) and an [Enedis account](https://mon-compte-client.enedis.fr/)
|
* First of all, you'll need a Linky and an [Enedis account](https://mon-compte-client.enedis.fr/)
|
||||||
* After you have installed the app, just visit it and follow instructions
|
* In your Enedis space, go to ["Gérer l'accès à mes données"](https://mon-compte-particulier.enedis.fr/donnees/) tab, and allow Enedis to collect and store your hourly consumption
|
||||||
|
* After that, install æneria to your Yunohost instance, visit it and just follow instructions
|
||||||
* That's it, now wait a bit to see data appear !
|
* That's it, now wait a bit to see data appear !
|
||||||
|
|
||||||
## Documentation
|
## Documentation
|
||||||
|
@ -36,7 +35,7 @@ More information can be found on [æneria documentation](https://docs.aeneria.co
|
||||||
|
|
||||||
This new version introduced some breaking changes in data structure: migration from Pilea can't be done automaticly.
|
This new version introduced some breaking changes in data structure: migration from Pilea can't be done automaticly.
|
||||||
|
|
||||||
But don't worry, you can easilly transfer your data from Pilea to æneria, just follow [this documentation](https://docs.aeneria.com/fr/latest/administrateur/pilea_migration.html).
|
But don't worry, you can easilly transfer your data from Pilea to æneria following [this documentation](https://docs.aeneria.com/fr/latest/administrateur/pilea_migration.html).
|
||||||
|
|
||||||
## YunoHost specific features
|
## YunoHost specific features
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
setup_private=1
|
setup_private=1
|
||||||
setup_public=1
|
setup_public=1
|
||||||
upgrade=1
|
upgrade=1
|
||||||
upgrade=1 from_commit=702db62e7b25c06972301828b275529a087a98ba
|
upgrade=1 from_commit=25bf428e280f463fb85c3f8332b523415c56f816
|
||||||
backup_restore=1
|
backup_restore=1
|
||||||
multi_instance=1
|
multi_instance=1
|
||||||
incorrect_path=1
|
incorrect_path=1
|
||||||
|
@ -25,5 +25,5 @@
|
||||||
Email=
|
Email=
|
||||||
Notification=change
|
Notification=change
|
||||||
;;; Upgrade options
|
;;; Upgrade options
|
||||||
; commit=702db62e7b25c06972301828b275529a087a98ba
|
; commit=25bf428e280f463fb85c3f8332b523415c56f816
|
||||||
name=1.0.3
|
name=1.0.3
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
SOURCE_URL=https://statics.aeneria.com/aeneria-app-1.0.3.tar.gz
|
SOURCE_URL=https://statics.aeneria.com/aeneria-app-1.0.4.tar.gz
|
||||||
SOURCE_SUM=f61cf16edd8a435f693261243e2d671487f28e8253c17885da77397cd8878887
|
SOURCE_SUM=900e165d2992c1349b2ed1fff8fda7ec999b78c70e6a14043800defdb715a91d
|
||||||
SOURCE_SUM_PRG=sha256sum
|
SOURCE_SUM_PRG=sha256sum
|
||||||
SOURCE_FORMAT=tar.gz
|
SOURCE_FORMAT=tar.gz
|
||||||
SOURCE_IN_SUBDIR=true
|
SOURCE_IN_SUBDIR=true
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
"en": "A little dashboard to analyse your electricity consumption data from Linky & weather",
|
"en": "A little dashboard to analyse your electricity consumption data from Linky & weather",
|
||||||
"fr": "Un petit tableau de bord pour analyser votre consomation d'électricité à partir des données d'un Linky et de la météo"
|
"fr": "Un petit tableau de bord pour analyser votre consomation d'électricité à partir des données d'un Linky et de la météo"
|
||||||
},
|
},
|
||||||
"version": "1.0.3~ynh1",
|
"version": "1.0.4~ynh1",
|
||||||
"url": "https://gitlab.com/aeneria/aeneria-app",
|
"url": "https://gitlab.com/aeneria/aeneria-app",
|
||||||
"license": "AGPL-3.0-or-later",
|
"license": "AGPL-3.0-or-later",
|
||||||
"maintainer": {
|
"maintainer": {
|
||||||
|
|
|
@ -19,6 +19,56 @@ extra_php_dependencies="php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-pgsql ph
|
||||||
# EXPERIMENTAL HELPERS
|
# EXPERIMENTAL HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
# Execute a command as another user
|
||||||
|
# usage: exec_as USER COMMAND [ARG ...]
|
||||||
|
ynh_exec_as() {
|
||||||
|
local USER=$1
|
||||||
|
shift 1
|
||||||
|
|
||||||
|
if [[ $USER = $(whoami) ]]; then
|
||||||
|
eval "$@"
|
||||||
|
else
|
||||||
|
sudo -u "$USER" "$@"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Check available space before creating a temp directory.
|
||||||
|
#
|
||||||
|
# usage: ynh_smart_mktemp --min_size="Min size"
|
||||||
|
#
|
||||||
|
# | arg: -s, --min_size= - Minimal size needed for the temporary directory, in Mb
|
||||||
|
ynh_smart_mktemp () {
|
||||||
|
# Declare an array to define the options of this helper.
|
||||||
|
declare -Ar args_array=( [s]=min_size= )
|
||||||
|
local min_size
|
||||||
|
# Manage arguments with getopts
|
||||||
|
ynh_handle_getopts_args "$@"
|
||||||
|
|
||||||
|
min_size="${min_size:-300}"
|
||||||
|
# Transform the minimum size from megabytes to kilobytes
|
||||||
|
min_size=$(( $min_size * 1024 ))
|
||||||
|
|
||||||
|
# Check if there's enough free space in a directory
|
||||||
|
is_there_enough_space () {
|
||||||
|
local free_space=$(df --output=avail "$1" | sed 1d)
|
||||||
|
test $free_space -ge $min_size
|
||||||
|
}
|
||||||
|
|
||||||
|
if is_there_enough_space /tmp; then
|
||||||
|
local tmpdir=/tmp
|
||||||
|
elif is_there_enough_space /var; then
|
||||||
|
local tmpdir=/var
|
||||||
|
elif is_there_enough_space /; then
|
||||||
|
local tmpdir=/
|
||||||
|
elif is_there_enough_space /home; then
|
||||||
|
local tmpdir=/home
|
||||||
|
else
|
||||||
|
ynh_die "Insufficient free space to continue..."
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "$(mktemp --directory --tmpdir="$tmpdir")"
|
||||||
|
}
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# FUTURE OFFICIAL HELPERS
|
# FUTURE OFFICIAL HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -21,10 +21,23 @@ new_path=$YNH_APP_NEW_PATH
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# LOAD SETTINGS
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Loading installation settings..." --time --weight=1
|
||||||
|
|
||||||
|
# Needed for helper "ynh_add_nginx_config"
|
||||||
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
|
|
||||||
|
# Add settings here as needed by your application
|
||||||
|
#db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||||
|
#db_user=$db_name
|
||||||
|
#db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Backing up the app before changing its url (may take a while)..." --weight=1
|
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --time --weight=1
|
||||||
|
|
||||||
# Backup the current version of the app
|
# Backup the current version of the app
|
||||||
ynh_backup_before_upgrade
|
ynh_backup_before_upgrade
|
||||||
|
@ -32,7 +45,7 @@ ynh_clean_setup () {
|
||||||
# Remove the new domain config file, the remove script won't do it as it doesn't know yet its location.
|
# Remove the new domain config file, the remove script won't do it as it doesn't know yet its location.
|
||||||
ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
||||||
|
|
||||||
# restore it if the upgrade fails
|
# Restore it if the upgrade fails
|
||||||
ynh_restore_upgradebackup
|
ynh_restore_upgradebackup
|
||||||
}
|
}
|
||||||
# Exit if an error occurs during the execution of the script
|
# Exit if an error occurs during the execution of the script
|
||||||
|
@ -59,35 +72,23 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
# MODIFY URL IN NGINX CONF
|
# MODIFY URL IN NGINX CONF
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Updating nginx web server configuration..." --weight=1
|
ynh_script_progression --message="Updating NGINX web server configuration..." --time --weight=1
|
||||||
|
|
||||||
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
|
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
|
||||||
|
|
||||||
# Change the path in the nginx config file
|
# Change the path in the NGINX config file
|
||||||
if [ $change_path -eq 1 ]
|
if [ $change_path -eq 1 ]
|
||||||
then
|
then
|
||||||
# Make a backup of the original nginx config file if modified
|
# Make a backup of the original NGINX config file if modified
|
||||||
ynh_backup_if_checksum_is_different --file="$nginx_conf_path"
|
ynh_backup_if_checksum_is_different --file="$nginx_conf_path"
|
||||||
# Set global variables for nginx helper
|
# Set global variables for NGINX helper
|
||||||
domain="$old_domain"
|
domain="$old_domain"
|
||||||
path_url="$new_path"
|
path_url="$new_path"
|
||||||
# Store path_url setting
|
# Create a dedicated NGINX config
|
||||||
ynh_app_setting_set --app=$app --key=path_url --value="$path_url"
|
|
||||||
# Create a dedicated nginx config
|
|
||||||
ynh_add_nginx_config
|
ynh_add_nginx_config
|
||||||
if [ "$path_url" = "/" ]
|
|
||||||
then
|
|
||||||
# Replace "//" location (due to nginx template)
|
|
||||||
# Prevent from replacing in "http://" expressions by excluding ":" as preceding character
|
|
||||||
sed --in-place "s@\([^:]\)//@\1/@g" "$nginx_conf_path"
|
|
||||||
else
|
|
||||||
# Move prefix comment #for-subdir at end of lines
|
|
||||||
sed --in-place "s/#for-subdir\(.*\)/\1 #for-subdir/g" "$nginx_conf_path"
|
|
||||||
fi
|
|
||||||
ynh_store_file_checksum --file="$nginx_conf_path"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Change the domain for nginx
|
# Change the domain for NGINX
|
||||||
if [ $change_domain -eq 1 ]
|
if [ $change_domain -eq 1 ]
|
||||||
then
|
then
|
||||||
# Delete file checksum for the old conf file location
|
# Delete file checksum for the old conf file location
|
||||||
|
@ -102,7 +103,7 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Reloading nginx web server..." --weight=1
|
ynh_script_progression --message="Reloading NGINX web server..." --time --weight=1
|
||||||
|
|
||||||
ynh_systemd_action --service_name=nginx --action=reload
|
ynh_systemd_action --service_name=nginx --action=reload
|
||||||
|
|
||||||
|
@ -110,4 +111,4 @@ ynh_systemd_action --service_name=nginx --action=reload
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Change of URL completed for $app"
|
ynh_script_progression --message="Change of URL completed for $app" --time --last
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source ynh_exec_as
|
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source ynh_exec_as
|
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -85,8 +84,22 @@ if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||||
then
|
then
|
||||||
ynh_script_progression --message="Upgrading source files..."
|
ynh_script_progression --message="Upgrading source files..."
|
||||||
|
|
||||||
|
# For aeneria source update, we use a temporary directory because
|
||||||
|
# without it, patche can't be apply correctly:
|
||||||
|
# In 'app-00-ldap-auth.patch' we create a new file, if we try
|
||||||
|
# to apply the patch a second time while the file already exists, it
|
||||||
|
# throws a warning leading to an upgrade fail.
|
||||||
|
|
||||||
|
# Create tmpdir for new sources
|
||||||
|
tmpdir="$(ynh_smart_mktemp min_size=300)"
|
||||||
|
|
||||||
# Download, check integrity, uncompress and patch the source from app.src
|
# Download, check integrity, uncompress and patch the source from app.src
|
||||||
ynh_setup_source --dest_dir="$final_path"
|
ynh_setup_source --dest_dir="$tmpdir"
|
||||||
|
|
||||||
|
# Replace the old aeneria by the new one
|
||||||
|
ynh_secure_remove --file="$final_path"
|
||||||
|
mv "$tmpdir" "$final_path"
|
||||||
|
ynh_secure_remove --file="$tmpdir"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -1,14 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Execute a command as another user
|
|
||||||
# usage: exec_as USER COMMAND [ARG ...]
|
|
||||||
ynh_exec_as() {
|
|
||||||
local USER=$1
|
|
||||||
shift 1
|
|
||||||
|
|
||||||
if [[ $USER = $(whoami) ]]; then
|
|
||||||
eval "$@"
|
|
||||||
else
|
|
||||||
sudo -u "$USER" "$@"
|
|
||||||
fi
|
|
||||||
}
|
|
|
@ -2,8 +2,6 @@ commit c7a763a0fae7e1933f280b29bd2a1911b01f7170
|
||||||
Author: Simon Mellerin <simon.mellerin@makina-corpus.com>
|
Author: Simon Mellerin <simon.mellerin@makina-corpus.com>
|
||||||
Date: Fri Nov 27 12:19:02 2020 +0100
|
Date: Fri Nov 27 12:19:02 2020 +0100
|
||||||
|
|
||||||
toto
|
|
||||||
|
|
||||||
diff --git a/config/packages/security.yaml b/config/packages/security.yaml
|
diff --git a/config/packages/security.yaml b/config/packages/security.yaml
|
||||||
index 15ef608..8516775 100644
|
index 15ef608..8516775 100644
|
||||||
--- a/config/packages/security.yaml
|
--- a/config/packages/security.yaml
|
||||||
|
@ -178,3 +176,4 @@ index 0000000..39ba1e8
|
||||||
+ return $values[0];
|
+ return $values[0];
|
||||||
+ }
|
+ }
|
||||||
+}
|
+}
|
||||||
|
--
|
||||||
|
|
Loading…
Reference in a new issue