From a4ec7afdbca9a051b289a289491521c217fe61eb Mon Sep 17 00:00:00 2001 From: Krakinou Date: Fri, 26 May 2023 23:23:50 +0200 Subject: [PATCH] Init v2 for 2023.1 --- conf/app.src.default | 5 --- doc/ADMIN.md | 6 +++- doc/ADMIN_fr.md | 4 +++ doc/DESCRIPTION.md | 3 -- doc/DESCRIPTION_fr.md | 3 -- doc/POST_INSTALL_fr.md | 10 ++---- doc/POST_INTALL.md | 11 ++----- doc/PRE_INSTALL.md | 4 +++ doc/PRE_INSTALL_fr.md | 7 ++++- manifest.toml | 54 ++++++++++++++++++++------------ scripts/backup | 4 +-- scripts/install | 23 +++++--------- scripts/remove | 2 +- scripts/restore | 6 ++-- scripts/upgrade | 26 +++++----------- tests.toml | 70 +++++++++++++++++++++--------------------- 16 files changed, 116 insertions(+), 122 deletions(-) delete mode 100644 conf/app.src.default diff --git a/conf/app.src.default b/conf/app.src.default deleted file mode 100644 index 79ebb78..0000000 --- a/conf/app.src.default +++ /dev/null @@ -1,5 +0,0 @@ -SOURCE_URL=http://www.domoticz.com/download.php?channel=release&type=release&system=__OS__&machine=__MACH__ -SOURCE_SUM=__SHA256__ -SOURCE_SUM_PRG=sha256sum -SOURCE_FORMAT=tar.gz -SOURCE_IN_SUBDIR=false diff --git a/doc/ADMIN.md b/doc/ADMIN.md index e7da649..989bb96 100644 --- a/doc/ADMIN.md +++ b/doc/ADMIN.md @@ -87,4 +87,8 @@ As far as I know, there is no way to filter for IPv6 address on local network : allow ::/1; ```` This will authorized only IPv4 within local network to access your domoticz API. -You may add individual IPv6 address in the same way. \ No newline at end of file +You may add individual IPv6 address in the same way. + +## Limitations + +* Backup cannot be restored on a different machine type (arm, x86...) as compiled sources are different \ No newline at end of file diff --git a/doc/ADMIN_fr.md b/doc/ADMIN_fr.md index 478cc8d..f5c3f05 100644 --- a/doc/ADMIN_fr.md +++ b/doc/ADMIN_fr.md @@ -89,3 +89,7 @@ allow ::/1; ```` Ceci autorisera seulement les adresses IPv4 local a accéder aux API de domoticz. Vous pouvez ajouter des adresses IPv6 de la même façon. + +## Limitations + +* Un backup ne peut pas être restauré sur un type de machine différente de celle d'origine (x86, arm...) car les sources compilées sont différentes diff --git a/doc/DESCRIPTION.md b/doc/DESCRIPTION.md index d4ad925..28e082b 100644 --- a/doc/DESCRIPTION.md +++ b/doc/DESCRIPTION.md @@ -12,7 +12,4 @@ For example this system can be used with: * And more ... -**Shipped version:** Always the last stable one. The last compiled version is retrieved from [this directory](https://releases.domoticz.com/releases/?dir=./release) during install. -Once installed, **updates from the uptream app are managed from within the app**. Yunohost upgrade script will only upgrade the Yunohost package. - The MQTT broker mosquitto is integrated into the package. It requires its own domain or subdomain. It's an optional setting: during install if you set the same domaine as your main app domain, it won't be installed. \ No newline at end of file diff --git a/doc/DESCRIPTION_fr.md b/doc/DESCRIPTION_fr.md index a120655..6a64cdc 100644 --- a/doc/DESCRIPTION_fr.md +++ b/doc/DESCRIPTION_fr.md @@ -11,8 +11,5 @@ Il peut par exemple être utilisé avec : * des voltmètres * Et bien d'autres -**Version incluse :** Toujours la dernière version stable. La dernière version compilée est récupérée dans [ce répertoire](https://releases.domoticz.com/releases/?dir=./release) lors de l'installation. -Une fois installée, **les mises à jour de l'application sont gérées depuis les menus de l'application elle même**. Le script de mise à jour Yunohost mettra uniquement à jour de nouvelles version du package. - Le broker MQTT mosquitto est intégré au package et nécessite un sous-domaine ou un domaine distinct. Il est optionnel et si vous indiquez lors de l'installation le même domaine que le domaine principal, il ne sera pas installé. diff --git a/doc/POST_INSTALL_fr.md b/doc/POST_INSTALL_fr.md index a384450..51eb591 100644 --- a/doc/POST_INSTALL_fr.md +++ b/doc/POST_INSTALL_fr.md @@ -1,14 +1,10 @@ -## Limitations +### Première connexion -* Pas de gestion d'utilisateurs ni d'intégration LDAP. L'application ne [prévoit pas de gérer les utilisateurs par LDAP](https://github.com/domoticz/domoticz/issues/838), donc le package non plus. -* Un backup ne peut pas être restauré sur un type de machine différente de celle d'origine (x86, arm...) car les sources compilées sont différentes +L'utilisateur *admin* et le mot de passe *domoticz* vous permettront d'accéder au système. Il est bien évidemment recommandé de les modifier immédiatement -## A propos de la sécurité - -Bien que vous pouviez activer une page de connexion dans l'application (soit depuis le menu *Configuration/Paramètres/Système/Sécurité* ou depuis *Configuration/Plus d'options/Gérer les utilisateurs*), les fonctionnalités ne semblent pas très avancées ni safe pour l'instant (version 2022.2 au moment d'écrire). Un travail a été entrepris pour renforcer la sécurité ([voir ici](https://www.domoticz.com/wiki/Security)) dans les versions futures mais n'a pas encore été released. ### recommandations -Il semble conseillé de ne pas rendre l'application publique en dehors du sso yunohost (public = oui à l'installation ou mettre la permission domoticz à 'Visiteurs' dans le panel d'administration Yunohost). Si pour quelques raisons que ce soit, vous deviez le faire, je vous recommande: +Il est conseillé de ne pas rendre l'application publique en dehors du sso yunohost (public = oui à l'installation ou mettre la permission domoticz à 'Visiteurs' dans le panel d'administration Yunohost). Si pour quelques raisons que ce soit, vous deviez le faire, je vous recommande: - d'activer la sécurité de connexion à domoticz (plutot avec la login page qu'avec la basic-auth) - Dans *Configuration/Système/Réseaux Locaux (pas d'authentification)* d'entrer les adresses du proxy nginx (cela devrait être "::1;127.0.0.1" dans une installation Yunohost Standard) afin que Fail2ban puisse bloquer les tentatives de connexions (voir les dernières lignes de [ce wiki](https://www.domoticz.com/wiki/WebServer_Proxy) \ No newline at end of file diff --git a/doc/POST_INTALL.md b/doc/POST_INTALL.md index 0486c62..de109af 100644 --- a/doc/POST_INTALL.md +++ b/doc/POST_INTALL.md @@ -1,14 +1,9 @@ -## Limitations +### Initial access -* No user management nor LDAP integration This function is [not planned to be implemented into the app](https://github.com/domoticz/domoticz/issues/838), hence it's not planned into the package neither. -* Backup cannot be restored on a different machine type (arm, x86...) as compiled sources are different - -## Security consideration - -Although you may activate a login page on the application (either from the *Setup/Settings/System/Website protection* menu or from the *Setup/More Options/Edit Users* menu), it doesn't seems to be very reliable and secure so far (version 2022.2 at the time of writing). Work is ongoing to strengthen the security ([see here](https://www.domoticz.com/wiki/Security)) in future version but is not yet released. +User *admin* with password *domoticz* allow you to access the system. Of course, you should change them immediately. ### recommandation -It seems advisable to not make the app publicly available outside of the yunohost sso (public = yes at install or setting the domoticz permission to 'visitors' in the admin panel). If for any reason you need to, I recommend the following: +It is advisable to not make the app publicly available outside of the yunohost sso (public = yes at install or setting the domoticz permission to 'visitors' in the admin panel). If for any reason you need to, I recommend the following: - Activate the website protection/user management (with login page instead of Basic-auth) - In *Setup/Settings/System/Local Networks (no username/password)* enter the address of the nginx proxy (should be "::1;127.0.0.1" in any standard Yunohost installation) so that the Fail2ban settings is active (see last lines of [this wiki](https://www.domoticz.com/wiki/WebServer_Proxy) \ No newline at end of file diff --git a/doc/PRE_INSTALL.md b/doc/PRE_INSTALL.md index 2ee8450..ad09051 100644 --- a/doc/PRE_INSTALL.md +++ b/doc/PRE_INSTALL.md @@ -3,3 +3,7 @@ During installation, a [MQTT](https://en.wikipedia.org/wiki/MQTT) broker, [Mosquitto](https://mosquitto.org/), may be installed at the same time as Domoticz. It's an optional setting: during install if you set the same domaine as your main app domain, it won't be installed. The installed version is the one from the official project repo and not from Debian ones. This broker requires a dedicated domain or subdomain to work (ex : mqtt.your.domain.tld) : creating this domain prior installation is a prerequisite + +## Installed Version + +For now, domoticz project does not (yet) provide compiled binaries for each release. So, the installed release is a precompiled version from a [project fork](https://github.com/Krakinou/domoticz_build_on_arch). The source code is exactly the same as the original version. diff --git a/doc/PRE_INSTALL_fr.md b/doc/PRE_INSTALL_fr.md index de4d7c0..46f3e81 100644 --- a/doc/PRE_INSTALL_fr.md +++ b/doc/PRE_INSTALL_fr.md @@ -2,4 +2,9 @@ A l'installation, un broker [MQTT](https://fr.wikipedia.org/wiki/MQTT), [Mosquitto](https://mosquitto.org/), peut être installé en même temps que Domoticz. Il est optionnel et si vous indiquez lors de l'installation le même domaine que le domaine principal, il ne sera pas installé. La version installée est celle du dépot officiel du projet, et non des dépots Debian. -Ce broker nécessite un domaine ou un sous-domaine particulier pour fonctionner (ex : mqtt.your.domain.tld) : il est nécessaire de créer ce domaine auparavant. \ No newline at end of file +Ce broker nécessite un domaine ou un sous-domaine particulier pour fonctionner (ex : mqtt.your.domain.tld) : il est nécessaire de créer ce domaine auparavant. + + +## Version installée + +Actuellement, le projet domoticz ne fourni pas (encore) ces sources compilées par version. La version installée est donc une version compilée sur un [fork du projet](https://github.com/Krakinou/domoticz_build_on_arch). Le code source est celui de la version correspondante de domoticz. \ No newline at end of file diff --git a/manifest.toml b/manifest.toml index cab1481..1b1c7fc 100644 --- a/manifest.toml +++ b/manifest.toml @@ -5,7 +5,7 @@ name = "Domoticz" description.en = "Home automation system that lets you monitor and configure miscellaneous devices" description.fr = "Logiciel de domotique qui vous permet de configurer un grand nombre d'appareils" -version = "2023.1~ynh1" +version = "2023.1~ynh2" maintainers = ["Krakinou"] @@ -19,8 +19,8 @@ cpe = "cpe:2.3:a:domoticz:domoticz" fund = "https://www.paypal.com/donate?token=rF_gUybGmQGia_jzLfu3vkeXRqYLRV-v-BxCTylrTsEN4mB-nDdSVQhg3a-I9LkiqORq70Gtxbo6rq3r&locale.x=US" [integration] -yunohost = ">= 11.1.11" -architectures = "all" +yunohost = ">= 11.1.18" +architectures = [ "amd64", "armhf", "arm64" ] multi_instance = false ldap = false sso = false @@ -51,25 +51,41 @@ ram.runtime = "50M" optional = true [resources] - [resources.system_user] + [resources.sources.main] + arm64.url = "https://github.com/Krakinou/domoticz_build_on_arch/releases/download/2023.1/domoticz_linux_2023.1_aarch64.tgz" + arm64.sha256 = "e268e298fdd3d165840e0174b22b6c6b6ef06f4c7d4ab596f3bd6e984cda1b15" + armhf.url = "https://github.com/Krakinou/domoticz_build_on_arch/releases/download/2023.1/domoticz_linux_2023.1_armhf.tgz" + armhf.sha256 = "a51f2a2b6238a36ecc4f41d676fc2448313373ab181dd215630260b8230449db" + amd64.url = "https://github.com/Krakinou/domoticz_build_on_arch/releases/download/2023.1/domoticz_linux_2023.1_x86_64.tgz" + amd64.sha256 = "b88e82af38385d33d78d3dbb034f57ac429855e8dcb2da6c7ee17c7c71ba235f" + format="tar.gz" + in_subdir=false + extract=true - [resources.install_dir] - - [resources.permissions] - main.url = "/" - - api.url = "/_api/__APP_" - api.show_title = false - + autoupdate.strategy = "latest_github_release" - [resources.ports] - main.default = 8080 - #to be checked if it can become conditionnal - #mqtt.default = 1883 - #mqtt_websocket.default = 8883 + autoupdate.asset.arm64 = "*_aarch64.tgz" + autoupdate.asset.amd64 = "*_x86_64.tgz" + autoupdate.asset.armhf = "*_armhf.tgz" + + [resources.system_user] - [resources.apt] - packages = "libudev-dev, python3-dev, libcurl4, libusb-0.1-4" + [resources.install_dir] + + [resources.permissions] + main.url = "/" + + api.url = "/_api/__APP_" + api.show_title = false + + [resources.ports] + main.default = 8080 + #to be checked if it can become conditionnal + #mqtt.default = 1883 + #mqtt_websocket.default = 8883 + + [resources.apt] + packages = "libudev-dev, python3-dev, libcurl4, libusb-0.1-4" #[[resources.apt.extras]] #repo = "deb https://repo.mosquitto.org/debian buster main" diff --git a/scripts/backup b/scripts/backup index 435dd07..d1a193f 100755 --- a/scripts/backup +++ b/scripts/backup @@ -27,7 +27,7 @@ ynh_backup --src_path="$install_dir" ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/api_"$app".conf" -[[ ! -z "$mqtt_domain" ]] && ynh_backup --src_path="/etc/nginx/conf.d/$mqtt_domain.d/mqtt_$app.conf" --not_mandatory +[[ "$mqtt_domain" != "$domain" ]] && ynh_backup --src_path="/etc/nginx/conf.d/$mqtt_domain.d/mqtt_$app.conf" --not_mandatory #================================================= # SPECIFIC BACKUP @@ -54,7 +54,7 @@ ynh_backup --src_path="/etc/systemd/system/$app.service" # BACKUP VARIOUS FILES #================================================= -[[ ! -z "$mqtt_domain" ]] && ynh_backup --src_path="/etc/mosquitto/conf.d" --not_mandatory +[[ "$mqtt_domain" != "$domain" ]] && ynh_backup --src_path="/etc/mosquitto/conf.d" --not_mandatory ynh_backup --src_path="/usr/share/yunohost/hooks/conf_regen/95-nginx_domoticz" diff --git a/scripts/install b/scripts/install index 3666820..dfdfb00 100755 --- a/scripts/install +++ b/scripts/install @@ -20,9 +20,6 @@ else api_path=/api_"$path" fi -if [ "$domain" == "$mqtt_domain" ]; then - mqtt_domain="" -fi #================================================= # STORE SETTINGS FROM MANIFEST @@ -35,7 +32,7 @@ ynh_app_setting_set --app="$app" --key=mach --value="$mach" #path used by api & mqtt to read/update domoticz ynh_app_setting_set --app="$app" --key=api_path --value="$api_path" -[[ ! -z "$mqtt_domain" ]] && ynh_app_setting_set --app="$app" --key=mqtt_domain --value="$mqtt_domain" +[[ "$mqtt_domain" != "$domain" ]] && ynh_app_setting_set --app="$app" --key=mqtt_domain --value="$mqtt_domain" #================================================= @@ -43,7 +40,7 @@ ynh_app_setting_set --app="$app" --key=api_path --value="$api_path" #================================================= # FIND AND OPEN A PORT #================================================= -if [ ! -z "$mqtt_domain" ]; then +if [ "$mqtt_domain" != "$domain" ]; then ynh_script_progression --message="Finding available ports for Mosquitto..." mqtt_port=$(ynh_find_port --port="$default_mqtt_port") ynh_app_setting_set --app="$app" --key=mqtt_port --value="$mqtt_port" @@ -74,10 +71,6 @@ fi ynh_script_progression --message="Setting up source files..." --weight=5 # Download, check integrity, uncompress and patch the source from app.src -# Create an app.src for the correct version of domoticz -# match string are fulfilled in _common.sh via the upstream bash installation script -ynh_add_config --template="../conf/app.src.default" --destination="../conf/app.src" - ynh_setup_source --dest_dir="$install_dir" #Create the database file @@ -94,7 +87,7 @@ chown -R "$app":"$app" "$install_dir" #================================================= # SET MOSQUITTO SETTINGS #================================================= -if [ ! -z "$mqtt_domain" ]; then +if [ "$mqtt_domain" != "$domain" ]; then ynh_script_progression --message="Setting up mosquitto..." --weight=5 @@ -120,7 +113,7 @@ fi #================================================= ynh_script_progression --message="Configuring NGINX web server..." --weight=2 -[[ ! -z "$mqtt_domain" ]] && ynh_add_config --template="../conf/mqtt_nginx.conf" --destination="/etc/nginx/conf.d/"$mqtt_domain".d/mqtt_"$app".conf" +[[ "$mqtt_domain" != "$domain" ]] && ynh_add_config --template="../conf/mqtt_nginx.conf" --destination="/etc/nginx/conf.d/"$mqtt_domain".d/mqtt_"$app".conf" #Set Hook for nginx domain cp -R ../sources/hooks/conf_regen/95-nginx_domoticz /usr/share/yunohost/hooks/conf_regen/ @@ -152,7 +145,7 @@ chown -R domoticz: /var/log/"$app" # Use logrotate to manage application logfile(s) ynh_use_logrotate -[[ ! -z "$mqtt_domain" ]] && ynh_use_logrotate --logfile="/var/log/mosquitto" +[[ "$mqtt_domain" != "$domain" ]] && ynh_use_logrotate --logfile="/var/log/mosquitto" #================================================= # INTEGRATE SERVICE IN YUNOHOST @@ -160,7 +153,7 @@ ynh_use_logrotate ynh_script_progression --message="Integrating service in YunoHost..." yunohost service add "$app" --description="Domotique open sources" --log="/var/log/$app/$app.log" -[[ ! -z "$mqtt_domain" ]] && yunohost service add mosquitto --description="Serveur MQTT pour domoticz" --log="/var/log/mosquitto/mosquitto.log" +[[ "$mqtt_domain" != "$domain" ]] && yunohost service add mosquitto --description="Serveur MQTT pour domoticz" --log="/var/log/mosquitto/mosquitto.log" #================================================= @@ -172,7 +165,7 @@ ynh_script_progression --message="Starting a systemd service..." ynh_systemd_action --service_name="$app" --action="start" #Restarting mosquitto to take changes into account -[[ ! -z "$mqtt_domain" ]] && ynh_systemd_action --service_name=mosquitto --action="restart" +[[ "$mqtt_domain" != "$domain" ]] && ynh_systemd_action --service_name=mosquitto --action="restart" #================================================= # SETUP FAIL2BAN @@ -199,7 +192,7 @@ ynh_print_info --message="If you wish for Fail2ban to work, set up your local ad #API & MQTT should stay publicly accessible. ynh_permission_create --permission="domoticz_API" --label="api" --url="$domain$api_path" --allowed="visitors" --show_tile="false" --protected="true" -[[ ! -z "$mqtt_domain" ]] && ynh_permission_create --permission="domoticz_MQTT" --label="MQTT" --url="$mqtt_domain" --allowed="visitors" --show_tile="false" --protected="true" +[[ "$mqtt_domain" != "$domain" ]] && ynh_permission_create --permission="domoticz_MQTT" --label="MQTT" --url="$mqtt_domain" --allowed="visitors" --show_tile="false" --protected="true" #================================================= diff --git a/scripts/remove b/scripts/remove index 2e5b416..efe8618 100755 --- a/scripts/remove +++ b/scripts/remove @@ -15,7 +15,7 @@ source /usr/share/yunohost/helpers # REMOVE SERVICE INTEGRATION IN YUNOHOST #================================================= -if [ ! -z "$mqtt_domain" ]; then +if [ "$mqtt_domain" != "$domain" ]; then ynh_script_progression --message="Removing system configurations related to Mosquitto..." --weight=1 yunohost service remove mosquitto ynh_secure_remove --file="/etc/mosquitto/conf.d" diff --git a/scripts/restore b/scripts/restore index 8c328ea..4c88e4d 100755 --- a/scripts/restore +++ b/scripts/restore @@ -66,7 +66,7 @@ chown -R "$app":"$app" "$install_dir" #================================================= # SET MOSQUITTO SETTINGS #================================================= -if [ ! -z "$mqtt_domain" ]; then +if [ "$mqtt_domain" != "$domain" ]; then ynh_script_progression --message="Reinstalling up mosquitto..." --weight=5 #Installing packages @@ -89,7 +89,7 @@ systemctl enable "$app".service --quiet ynh_script_progression --message="Integrating service in YunoHost..." yunohost service add "$app" --description="Domotique open sources" --log="/var/log/$app/$app.log" -[[ ! -z "$mqtt_domain" ]] && yunohost service add mosquitto --description="Serveur MQTT pour domoticz" --log="/var/log/mosquitto/mosquitto.log" +[[ "$mqtt_domain" != "$domain" ]] && yunohost service add mosquitto --description="Serveur MQTT pour domoticz" --log="/var/log/mosquitto/mosquitto.log" #================================================= @@ -100,7 +100,7 @@ ynh_script_progression --message="Starting a systemd service..." ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/$app/$app.log" #Restarting mosquitto to take changes into account -[[ ! -z "$mqtt_domain" ]] && ynh_systemd_action --service_name=mosquitto --action="restart" +[[ "$mqtt_domain" != "$domain" ]] && ynh_systemd_action --service_name=mosquitto --action="restart" #================================================= # RESTORE THE LOGROTATE CONFIGURATION diff --git a/scripts/upgrade b/scripts/upgrade index 493d611..1b44a65 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -15,6 +15,9 @@ source /usr/share/yunohost/helpers current_OS=$(ynh_app_setting_get --app="$app" --key=OS) current_mach=$(ynh_app_setting_get --app="$app" --key=mach) +mqtt_domain=$(ynh_app_setting_get --app="$app" --key=mqtt_domain) +mqtt_port=$(ynh_app_setting_get --app="$app" --key=mqtt_port) +mqtt_websocket_port=$(ynh_app_setting_get --app="$app" --key=mqtt_websocket_port) #================================================= # CHECK VERSION @@ -60,11 +63,6 @@ if [ -z "$api_path" ]; then ynh_app_setting_set --app="$app" --key=api_path --value="$api_path" fi -#Create a dedicated path for the mqtt access -if [ -z "$mqtt_domain" ]; then - ynh_print_info --message="Mosquitto, a mqtt server, can now be installed during upgrade, pleaser refer to package documentation to activate it" -fi - #Port to listen for MQTT internal if [[ -z "$mqtt_port" && ! -z "$mqtt_domain" ]]; then mqtt_port=$(ynh_find_port --port="$default_mqtt_port") @@ -121,9 +119,6 @@ fi if [ "$upgrade_type" == "UPGRADE_APP" ] then ynh_script_progression --message="Upgrading source files..." --weight=15 - - # Download, check integrity, uncompress and patch the source from app.src - ynh_add_config --template="../conf/app.src.default" --destination="../conf/app.src" ynh_setup_source --dest_dir="$install_dir" #Create the database file if [ ! -f "$install_dir"/domoticz.db ]; then @@ -139,7 +134,7 @@ chown -R "$app":"$app" "$install_dir" #================================================= # SET MOSQUITTO SETTINGS #================================================= -if [ ! -z "$mqtt_domain" ]; then +if [ "$mqtt_domain" != "$domain" ]; then ynh_script_progression --message="Setting up mosquitto..." --weight=5 #Installing packages @@ -166,7 +161,7 @@ fi #================================================= ynh_script_progression --message="Upgrading NGINX web server configuration..." -[[ ! -z "$mqtt_domain" ]] && ynh_add_config --template="../conf/mqtt_nginx.conf" --destination="/etc/nginx/conf.d/"$mqtt_domain".d/mqtt_"$app".conf" +[[ "$mqtt_domain" != "$domain" ]] && ynh_add_config --template="../conf/mqtt_nginx.conf" --destination="/etc/nginx/conf.d/"$mqtt_domain".d/mqtt_"$app".conf" #Set Hook for nginx domain cp -R ../sources/hooks/conf_regen/95-nginx_domoticz /usr/share/yunohost/hooks/conf_regen/ @@ -226,7 +221,7 @@ ynh_print_info --message="If you wish for Fail2ban to work, set up your local ad ynh_script_progression --message="Integrating service in YunoHost..." yunohost service add "$app" --description="Domotique open sources" --log="/var/log/$app/$app.log" -[[ ! -z "$mqtt_domain" ]] && yunohost service add mosquitto --description="Serveur MQTT pour domoticz" --log="/var/log/mosquitto/mosquitto.log" +[[ "$mqtt_domain" != "$domain" ]] && yunohost service add mosquitto --description="Serveur MQTT pour domoticz" --log="/var/log/mosquitto/mosquitto.log" #================================================= @@ -237,14 +232,7 @@ ynh_script_progression --message="Starting a systemd service..." --weight=3 ynh_systemd_action --service_name="$app" --action="start" #Restarting mosquitto to take changes from /etc/mosquitto/conf.d/*.conf into account -[[ ! -z "$mqtt_domain" ]] && ynh_systemd_action --service_name=mosquitto --action="restart" - -#================================================= -# RELOAD NGINX -#================================================= -#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." - -#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload +[[ "$mqtt_domain" != "$domain" ]] && ynh_systemd_action --service_name=mosquitto --action="restart" #================================================= # END OF SCRIPT diff --git a/tests.toml b/tests.toml index eeb2be1..371f428 100644 --- a/tests.toml +++ b/tests.toml @@ -4,40 +4,40 @@ test_format = 1.0 args.mqtt_domain="sub.domain.tld" test_upgrade_from.27311ad.name = "2022.2" + test_upgrade_from.27311ad.args.mqtt_domain="sub.domain.tld" - -[With_Mosquitto_upgrade_with_mosquitto] - preinstall = """ - set -euxo pipefail - yunohost domain add mqtt.domain.tld - """ - preupgrade = """ - set -euxo pipefail - yunohost app setting domoticz mqtt_domain -v mqtt.domain.tld - """ - - args.mqtt_domain="mqtt.domain.tld" - - exclude = ["package_linter"] - - test_upgrade_from.27311ad.name = "2022.2 with mosquitto" - test_upgrade_from.27311ad.args.mqtt_domain="mqtt.domain.tld" - - -[With_Mosquitto_upgrade_without_mosquitto] - preinstall = """ - set -euxo pipefail - yunohost domain add mqtt.domain.tld - """ - - preupgrade = """ - set -euxo pipefail - yunohost app setting domoticz mqtt_domain -v mqtt.domain.tld - """ - args.mqtt_domain="mqtt.domain.tld" - - exclude = ["package_linter", "install.private", "install.multi", "backup_restore", "change_url"] - - test_upgrade_from.27311ad.name = "2022.2 without mosquitto" - test_upgrade_from.27311ad.args.mqtt_domain="sub.domain.tld" \ No newline at end of file +#[With_Mosquitto_upgrade_with_mosquitto] +# preinstall = """ +# set -euxo pipefail +# yunohost domain add mqtt.domain.tld +# """ +# preupgrade = """ +# set -euxo pipefail +# yunohost app setting domoticz mqtt_domain -v mqtt.domain.tld +# """ +# +# args.mqtt_domain="mqtt.domain.tld" +# +# exclude = ["package_linter"] +# +# test_upgrade_from.27311ad.name = "2022.2 with mosquitto" +# test_upgrade_from.27311ad.args.mqtt_domain="mqtt.domain.tld" +# +# +#[With_Mosquitto_upgrade_without_mosquitto] +# preinstall = """ +# set -euxo pipefail +# yunohost domain add mqtt.domain.tld +# """ +# +# preupgrade = """ +# set -euxo pipefail +# yunohost app setting domoticz mqtt_domain -v mqtt.domain.tld +# """ +# args.mqtt_domain="mqtt.domain.tld" +# +# exclude = ["package_linter", "install.private", "install.multi", "backup_restore", "change_url"] +# +# test_upgrade_from.27311ad.name = "2022.2 without mosquitto" +# test_upgrade_from.27311ad.args.mqtt_domain="sub.domain.tld" \ No newline at end of file