diff --git a/.github/workflows/updater.yml b/.github/workflows/updater.yml
index 4363d38..4a866ff 100644
--- a/.github/workflows/updater.yml
+++ b/.github/workflows/updater.yml
@@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Fetch the source code
- uses: actions/checkout@v2
+ uses: actions/checkout@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Run the updater script
@@ -33,7 +33,7 @@ jobs:
- name: Create Pull Request
id: cpr
if: ${{ env.PROCEED == 'true' }}
- uses: peter-evans/create-pull-request@v3
+ uses: peter-evans/create-pull-request@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: Update to version ${{ env.VERSION }}
diff --git a/README.md b/README.md
index fd4d593..b805577 100644
--- a/README.md
+++ b/README.md
@@ -25,20 +25,16 @@ Integrate zwave-js-ui natively in Domoticz_ynh.
To work correctly, this app require to install either
- [domoticz package](https://github.com/YunoHost-Apps/domoticz_ynh) with **mqtt broker Mosquitto**
-- or [Home-Assistant package](https://github.com/YunoHost-Apps/homeassistant_ynh)
-
-Suivez le [guide d'installation rapide](https://zwave-js.github.io/zwave-js-ui/#/getting-started/quick-start?id=minimum-settings) pour l'intégrer dans l'une ou l'autre de ces applications.
-
-**Shipped version:** 8.8.6~ynh1
-## Disclaimers / important information
-
-
+- [Home-Assistant package](https://github.com/YunoHost-Apps/homeassistant_ynh)
For now, although the package is fully functional (install, remove, backup, restore...), it is not integrated with domoticz and mosquitto package, this means that all settings needs to be done manually from inside the app.
During install, the whole app need to be recompile using yarn, this lead to long installation time. Also, a temporary swap file will be created if less than 2Gb of memory (RAM+Swap) are available : Be sure to have enough space on disk.
+
+
+**Shipped version:** 8.8.6~ynh2
## Documentation and resources
* Official app website:
diff --git a/README_fr.md b/README_fr.md
index 3f259f6..1611660 100644
--- a/README_fr.md
+++ b/README_fr.md
@@ -27,18 +27,12 @@ Pour fonctionner correctement, cette application nécessite d'avoir installé so
- le package [domoticz](https://github.com/YunoHost-Apps/domoticz_ynh) avec le **broker MQTT mosquitto**
- le package [Home-Assistant](https://github.com/YunoHost-Apps/homeassistant_ynh)
-Follow the [quick start instruction](https://zwave-js.github.io/zwave-js-ui/#/getting-started/quick-start?id=minimum-settings) to set up the integration with one or the other.
-
-
-**Version incluse :** 8.8.6~ynh1
-## Avertissements / informations importantes
-
-
-
Pour l'instant, bien que le package fonctionne (installation, désinstallation, sauvegarde, restauration...), il n'est pas intégré avec domoticz et mosquitto, les paramétrages doivent être fait manuellement depuis l'application.
Pendant l'installation, la totalité de l'application doit être recompilé en utilisant yarn : cela amène à des temps d'installation très long. Un fichier de swap temporaire sera créé si moins de 2Go de mémoire sont disponibles (RAM + swap): Assurez vous d'avoir suffisament d'espace disque.
+
+**Version incluse :** 8.8.6~ynh2
## Documentations et ressources
* Site officiel de l’app :
diff --git a/check_process b/check_process
deleted file mode 100644
index a259230..0000000
--- a/check_process
+++ /dev/null
@@ -1,26 +0,0 @@
-;; Test complet
- ; Manifest
- domain="domain.tld"
- path="/path"
- is_public=0
- port="8091"
- ; Checks
- pkg_linter=1
- setup_sub_dir=1
- setup_root=1
- setup_nourl=0
- setup_private=1
- setup_public=1
- upgrade=1
- upgrade=1 from_commit=1c9098b5570b86489d2d089ee093cb839c1a90f2
- backup_restore=1
- multi_instance=0
- port_already_use=1
- change_url=1
-;;; Options
-Email=misterl56@hotmail.com
-Notification=none
-;;; Upgrade options
- ; commit=1c9098b5570b86489d2d089ee093cb839c1a90f2
- name=Initial version
- manifest_arg=domain=DOMAIN&path=PATH&is_public=1&language=fr&admin=USER&password=pass&port=666&
diff --git a/conf/systemd.service b/conf/systemd.service
index d0de7e9..68e74fc 100644
--- a/conf/systemd.service
+++ b/conf/systemd.service
@@ -8,7 +8,7 @@ User=__APP__
Group=__APP__
#Environment not working, don't know why, have to add env command to ExecStart, if you know a better way, don't hesitate to make a PR
#Environment="__YNH_NODE_LOAD_PATH__"
-WorkingDirectory=__FINALPATH__/
+WorkingDirectory=__INSTALL_DIR__/
ExecStart=env __YNH_NODE_LOAD_PATH__ yarn start
StandardOutput=append:/var/log/__APP__/__APP__.log
StandardError=inherit
@@ -45,3 +45,4 @@ CapabilityBoundingSet=~CAP_SYS_ADMIN CAP_SYS_PTRACE CAP_SYSLOG
[Install]
WantedBy=multi-user.target
+
diff --git a/doc/DESCRIPTION.md b/doc/DESCRIPTION.md
index 86d7ec7..24030a8 100644
--- a/doc/DESCRIPTION.md
+++ b/doc/DESCRIPTION.md
@@ -7,6 +7,10 @@ Integrate zwave-js-ui natively in Domoticz_ynh.
To work correctly, this app require to install either
- [domoticz package](https://github.com/YunoHost-Apps/domoticz_ynh) with **mqtt broker Mosquitto**
-- or [Home-Assistant package](https://github.com/YunoHost-Apps/homeassistant_ynh)
+- [Home-Assistant package](https://github.com/YunoHost-Apps/homeassistant_ynh)
-Suivez le [guide d'installation rapide](https://zwave-js.github.io/zwave-js-ui/#/getting-started/quick-start?id=minimum-settings) pour l'intégrer dans l'une ou l'autre de ces applications.
\ No newline at end of file
+
+For now, although the package is fully functional (install, remove, backup, restore...), it is not integrated with domoticz and mosquitto package, this means that all settings needs to be done manually from inside the app.
+
+
+During install, the whole app need to be recompile using yarn, this lead to long installation time. Also, a temporary swap file will be created if less than 2Gb of memory (RAM+Swap) are available : Be sure to have enough space on disk.
diff --git a/doc/DESCRIPTION_fr.md b/doc/DESCRIPTION_fr.md
index 22a359d..abe4bfb 100644
--- a/doc/DESCRIPTION_fr.md
+++ b/doc/DESCRIPTION_fr.md
@@ -9,4 +9,7 @@ Pour fonctionner correctement, cette application nécessite d'avoir installé so
- le package [domoticz](https://github.com/YunoHost-Apps/domoticz_ynh) avec le **broker MQTT mosquitto**
- le package [Home-Assistant](https://github.com/YunoHost-Apps/homeassistant_ynh)
-Follow the [quick start instruction](https://zwave-js.github.io/zwave-js-ui/#/getting-started/quick-start?id=minimum-settings) to set up the integration with one or the other.
+
+Pour l'instant, bien que le package fonctionne (installation, désinstallation, sauvegarde, restauration...), il n'est pas intégré avec domoticz et mosquitto, les paramétrages doivent être fait manuellement depuis l'application.
+
+Pendant l'installation, la totalité de l'application doit être recompilé en utilisant yarn : cela amène à des temps d'installation très long. Un fichier de swap temporaire sera créé si moins de 2Go de mémoire sont disponibles (RAM + swap): Assurez vous d'avoir suffisament d'espace disque.
\ No newline at end of file
diff --git a/doc/DISCLAIMER.md b/doc/DISCLAIMER.md
deleted file mode 100644
index 2c933ac..0000000
--- a/doc/DISCLAIMER.md
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-For now, although the package is fully functional (install, remove, backup, restore...), it is not integrated with domoticz and mosquitto package, this means that all settings needs to be done manually from inside the app.
-
-
-During install, the whole app need to be recompile using yarn, this lead to long installation time. Also, a temporary swap file will be created if less than 2Gb of memory (RAM+Swap) are available : Be sure to have enough space on disk.
\ No newline at end of file
diff --git a/doc/DISCLAIMER_fr.md b/doc/DISCLAIMER_fr.md
deleted file mode 100644
index dc3eaa9..0000000
--- a/doc/DISCLAIMER_fr.md
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-Pour l'instant, bien que le package fonctionne (installation, désinstallation, sauvegarde, restauration...), il n'est pas intégré avec domoticz et mosquitto, les paramétrages doivent être fait manuellement depuis l'application.
-
-Pendant l'installation, la totalité de l'application doit être recompilé en utilisant yarn : cela amène à des temps d'installation très long. Un fichier de swap temporaire sera créé si moins de 2Go de mémoire sont disponibles (RAM + swap): Assurez vous d'avoir suffisament d'espace disque.
\ No newline at end of file
diff --git a/doc/POST_INSTALL.md b/doc/POST_INSTALL.md
new file mode 100644
index 0000000..18a3a14
--- /dev/null
+++ b/doc/POST_INSTALL.md
@@ -0,0 +1 @@
+Follow the [quick start guide](https://zwave-js.github.io/zwave-js-ui/#/getting-started/quick-start?id=minimum-settings) to integrate Zwave-JS-UI in home Assistant or Domotizc.
\ No newline at end of file
diff --git a/doc/POST_INSTALL_fr.md b/doc/POST_INSTALL_fr.md
new file mode 100644
index 0000000..88e0229
--- /dev/null
+++ b/doc/POST_INSTALL_fr.md
@@ -0,0 +1 @@
+Suivez le [guide d'installation rapide](https://zwave-js.github.io/zwave-js-ui/#/getting-started/quick-start?id=minimum-settings) pour intégrer Zwave-JS-UI avec Home Assistant ou Domoticz.
\ No newline at end of file
diff --git a/doc/PRE_INSTALL.md b/doc/PRE_INSTALL.md
new file mode 100644
index 0000000..6f15d96
--- /dev/null
+++ b/doc/PRE_INSTALL.md
@@ -0,0 +1,6 @@
+Beware!
+A temporary swap file will be created during install if less than 2Gb of memory (RAM+Swap) are available : Be sure to have enough space on disk!
+
+To work correctly, this app require to install either
+- [domoticz package](https://github.com/YunoHost-Apps/domoticz_ynh) with **mqtt broker Mosquitto**
+- [Home-Assistant package](https://github.com/YunoHost-Apps/homeassistant_ynh)
\ No newline at end of file
diff --git a/doc/PRE_INSTALL_fr.md b/doc/PRE_INSTALL_fr.md
new file mode 100644
index 0000000..37dd1b3
--- /dev/null
+++ b/doc/PRE_INSTALL_fr.md
@@ -0,0 +1,6 @@
+Attention!
+Un fichier de swap temporaire sera créé durant l'installation si moins de 2Go de mémoire (RAM+Swap) sont disponibles : Assurez vous d'avoir assez d'espace disque!
+
+Pour fonctionner correctement, cette application nécessite d'avoir installé soit:
+- le package [domoticz](https://github.com/YunoHost-Apps/domoticz_ynh) avec le **broker MQTT mosquitto**
+- le package [Home-Assistant](https://github.com/YunoHost-Apps/homeassistant_ynh)
\ No newline at end of file
diff --git a/manifest.json b/manifest.json
deleted file mode 100644
index 8804e48..0000000
--- a/manifest.json
+++ /dev/null
@@ -1,53 +0,0 @@
-{
- "name": "Zwave-JS-UI",
- "id": "zwave-js-ui",
- "packaging_format": 1,
- "description": {
- "en": "Full featured Z-Wave Control Panel and MQTT Gateway integrated with domoticz",
- "fr": "Panneau de controle Z-Wave et MQTT intégré avec Domoticz"
- },
- "version": "8.8.6~ynh1",
- "url": "https://github.com/zwave-js/zwave-js-ui",
- "upstream": {
- "license": "MIT",
- "website": "https://zwave-js.github.io/zwave-js-ui/#/",
- "admindoc": "https://zwave-js.github.io/zwave-js-ui/#/",
- "userdoc": "https://www.domoticz.com/wiki/Zwave-JS-UI",
- "code": "https://github.com/zwave-js/zwave-js-ui"
- },
- "license": "MIT",
- "maintainer": {
- "name": "Krakinou",
- "email": "misterl56@hotmail.com"
- },
- "requirements": {
- "yunohost": ">= 11.0.0"
- },
- "multi_instance": false,
- "services": [
- "domoticz"
- ],
- "arguments": {
- "install": [
- {
- "name": "domain",
- "type": "domain"
- },
- {
- "name": "path",
- "type": "path",
- "example": "/zwavejsui",
- "default": "/zwavejsui"
- },
- {
- "name": "is_public",
- "type": "boolean",
- "default": false,
- "help": {
- "en": "If set public, anyone can access the app without login in yunohost, you activate password protected login from within the app",
- "fr": "Si publique, N'importe qui peut accéder à l'application sans se connecter à yunohost, vous pouvez cependant activer une connection par mot de passe depuis l'application"
- }
- }
- ]
- }
-}
diff --git a/manifest.toml b/manifest.toml
new file mode 100644
index 0000000..279f503
--- /dev/null
+++ b/manifest.toml
@@ -0,0 +1,53 @@
+packaging_format = 2
+
+id = "zwave-js-ui"
+name = "Zwave-JS-UI"
+description.en = "Full featured Z-Wave Control Panel and MQTT Gateway integrated with domoticz"
+description.fr = "Panneau de controle Z-Wave et MQTT intégré avec Domoticz"
+
+version = "8.8.6~ynh2"
+
+maintainers = ["Krakinou"]
+
+[upstream]
+license = "MIT"
+website = "https://zwave-js.github.io/zwave-js-ui/#/"
+admindoc = "https://zwave-js.github.io/zwave-js-ui/#/"
+userdoc = "https://www.domoticz.com/wiki/Zwave-JS-UI"
+code = "https://github.com/zwave-js/zwave-js-ui"
+fund = "https://liberapay.com/robertsLando/donate"
+
+[integration]
+yunohost = ">= 11.1.11"
+architectures = "all"
+multi_instance = false
+ldap = "not_relevant"
+sso = "not_relevant"
+disk = "650M"
+ram.build = "2G"
+ram.runtime = "100M"
+
+[install]
+ [install.domain]
+ type = "domain"
+
+ [install.path]
+ type = "path"
+ default = "/zwavejsui"
+
+ [install.init_main_permission]
+ help.en = "If set public, anyone can access the app without login in YunoHost, you activate password protected login from within the app"
+ help.fr = "Si publique, N'importe qui peut accéder à l'application sans se connecter à YunoHost, vous pouvez cependant activer une connection par mot de passe depuis l'application"
+ type = "group"
+ default = "all_users"
+
+[resources]
+ [resources.system_user]
+
+ [resources.install_dir]
+
+ [resources.permissions]
+ main.url = "/"
+
+ [resources.ports]
+ main.default = 8091
\ No newline at end of file
diff --git a/scripts/backup b/scripts/backup
index fd26ce5..260dd79 100755
--- a/scripts/backup
+++ b/scripts/backup
@@ -10,43 +10,16 @@
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
-#=================================================
-# MANAGE SCRIPT FAILURE
-#=================================================
-
-ynh_clean_setup () {
- ### Remove this function if there's nothing to clean before calling the remove script.
- true
-}
-# Exit if an error occurs during the execution of the script
-ynh_abort_if_errors
-
-#=================================================
-# LOAD SETTINGS
-#=================================================
-ynh_print_info --message="Loading installation settings..."
-
-app=$YNH_APP_INSTANCE_NAME
-
-final_path=$(ynh_app_setting_get --app=$app --key=final_path)
-domain=$(ynh_app_setting_get --app=$app --key=domain)
-
-
#=================================================
# DECLARE DATA AND CONF FILES TO BACKUP
#=================================================
ynh_print_info --message="Declaring files to be backed up..."
-### N.B. : the following 'ynh_backup' calls are only a *declaration* of what needs
-### to be backuped and not an actual copy of any file. The actual backup that
-### creates and fill the archive with the files happens in the core after this
-### script is called. Hence ynh_backups calls takes basically 0 seconds to run.
-
#=================================================
# BACKUP THE APP MAIN DIR
#=================================================
-ynh_backup --src_path="$final_path"
+ynh_backup --src_path="$install_dir"
#=================================================
# BACKUP THE NGINX CONFIGURATION
@@ -54,13 +27,6 @@ ynh_backup --src_path="$final_path"
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
-#=================================================
-# BACKUP FAIL2BAN CONFIGURATION
-#=================================================
-
-#ynh_backup --src_path="/etc/fail2ban/jail.d/$app.conf"
-#ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf"
-
#=================================================
# SPECIFIC BACKUP
#=================================================
@@ -80,4 +46,4 @@ ynh_backup --src_path="/etc/systemd/system/$app.service"
# END OF SCRIPT
#=================================================
-ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
+ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
\ No newline at end of file
diff --git a/scripts/install b/scripts/install
index 42149da..4f9c527 100755
--- a/scripts/install
+++ b/scripts/install
@@ -9,50 +9,11 @@
source _common.sh
source /usr/share/yunohost/helpers
-#=================================================
-# MANAGE SCRIPT FAILURE
-#=================================================
-
-ynh_clean_setup () {
- ### Remove this function if there's nothing to clean before calling the remove script.
- true
-}
-# Exit if an error occurs during the execution of the script
-ynh_abort_if_errors
-
-#=================================================
-# RETRIEVE ARGUMENTS FROM THE MANIFEST
-#=================================================
-
-domain=$YNH_APP_ARG_DOMAIN
-path_url=$YNH_APP_ARG_PATH
-is_public=$YNH_APP_ARG_IS_PUBLIC
-app=$YNH_APP_INSTANCE_NAME
-
-#=================================================
-# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
-#=================================================
-ynh_script_progression --message="Validating installation parameters..." --weight=4
-
-final_path=/var/www/$app
-test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
-
-# Register (book) web path
-ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
-
-#=================================================
-# STORE SETTINGS FROM MANIFEST
-#=================================================
-ynh_script_progression --message="Storing installation settings..." --weight=1
-
-ynh_app_setting_set --app=$app --key=domain --value=$domain
-ynh_app_setting_set --app=$app --key=path --value=$path_url
-
#=================================================
# ADD SWAP IF NEEDED
#=================================================
#https://github.com/zwave-js/zwave-js-ui/issues/2699
-ynh_script_progression --message="Adding swap if needed for compiling..."
+ynh_script_progression --message="Checking for RAM..."
total_memory=$(ynh_get_ram --total)
swap_needed=0
@@ -66,24 +27,12 @@ if [ $total_memory -lt $MEMORY_NEEDED ]; then
fi
-#=================================================
-# STANDARD MODIFICATIONS
-#=================================================
-# FIND AND OPEN A PORT
-#=================================================
-ynh_script_progression --message="Finding an available port..." --weight=1
-
-# Find an available port
-port=$(ynh_find_port --port=8091)
-ynh_app_setting_set --app=$app --key=port --value=$port
-
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Configuring system user..." --weight=1
-# Create a system user
-ynh_system_user_create --username=$app --home_dir="$final_path"
+usermod -d $install_dir $app
if grep dialout -q < /etc/group; then
usermod -a -G dialout "$app"
@@ -99,7 +48,7 @@ fi
#=================================================
# INSTALL EXTRA DEPENDENCIES
#=================================================
-ynh_script_progression --message="Installing dependencies..." --weight=15
+#REMOVEME? ynh_script_progression --message="Installing dependencies..." --weight=15
ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
ynh_use_nodejs
@@ -110,21 +59,20 @@ ynh_exec_warn_less $ynh_npm install ---global yarn
#=================================================
ynh_script_progression --message="Setting up source files..." --weight=8
-ynh_app_setting_set --app=$app --key=final_path --value=$final_path
# Download, check integrity, uncompress and patch the source from app.src
-ynh_setup_source --dest_dir="$final_path"
+ynh_setup_source --dest_dir="$install_dir"
-chmod 750 "$final_path"
-chmod -R o-rwx "$final_path"
-chown -R $app: "$final_path"
+chmod 750 "$install_dir"
+chmod -R o-rwx "$install_dir"
+chown -R $app: "$install_dir"
#=================================================
# BUILD FROM SOURCE
#=================================================
ynh_script_progression --message="Building from sources..." --weight=1
-pushd "$final_path"
- ynh_script_progression --message="Fetching Yarn dependencies... This can be very long, be patient !" --weight=40
+pushd "$install_dir"
+ ynh_script_progression --message="Fetching Yarn dependencies... This can be very long, be patient !" --weight=40
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn plugin import workspace-tools
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn workspaces focus --production
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn install --network-timeout 1000000000
@@ -135,24 +83,23 @@ pushd "$final_path"
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn install --network-timeout 1000000000
ynh_script_progression --message="Cleaning cache... " --weight=3
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn cache clean 2>&1
- ynh_script_progression --message="Building Yarn dependencies... This can be very long, be patient !" --weight=30
+ ynh_script_progression --message="Building Yarn dependencies... This can be very long, be patient !" --weight=30
#https://geeklearning.io/angular-aot-webpack-memory-trick/
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH NODE_OPTIONS=--max-old-space-size=2048 yarn run build
ynh_script_progression --message="Cleaning cache... " --weight=3
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn cache clean 2>&1
popd
-chmod 750 "$final_path"
-chmod -R o-rwx "$final_path"
-chown -R $app: "$final_path"
+chmod 750 "$install_dir"
+chmod -R o-rwx "$install_dir"
+chown -R $app: "$install_dir"
#=================================================
# REMOVE ADDITIONNAL SWAP
#=================================================
-ynh_script_progression --message="Remove additionnal swap..." --weight=2
-
if [ $swap_needed > 0 ]; then
+ ynh_script_progression --message="Remove additionnal swap..." --weight=2
ynh_del_swap
fi
#=================================================
@@ -163,38 +110,6 @@ ynh_script_progression --message="Configuring NGINX web server..." --weight=2
# Create a dedicated NGINX config
ynh_add_nginx_config
-#=================================================
-# ADD A CONFIGURATION
-#=================================================
-#ynh_script_progression --message="Adding a configuration file..." --weight=1
-
-### You can add specific configuration files.
-###
-### Typically, put your template conf file in ../conf/your_config_file
-### The template may contain strings such as __FOO__ or __FOO_BAR__,
-### which will automatically be replaced by the values of $foo and $foo_bar
-###
-### ynh_add_config will also keep track of the config file's checksum,
-### which later during upgrade may allow to automatically backup the config file
-### if it's found that the file was manually modified
-###
-### Check the documentation of `ynh_add_config` for more info.
-
-######ynh_add_config --template="some_config_file" --destination="$final_path/some_config_file"
-
-# FIXME: this should be handled by the core in the future
-# You may need to use chmod 600 instead of 400,
-# for example if the app is expected to be able to modify its own config
-#######chmod 400 "$final_path/some_config_file"
-#######chown $app:$app "$final_path/some_config_file"
-
-### For more complex cases where you want to replace stuff using regexes,
-### you shoud rely on ynh_replace_string (which is basically a wrapper for sed)
-### When doing so, you also need to manually call ynh_store_file_checksum
-###
-### ynh_replace_string --match_string="match_string" --replace_string="replace_string" --target_file="$final_path/some_config_file"
-### ynh_store_file_checksum --file="$final_path/some_config_file"
-
#=================================================
# SETUP SYSTEMD
#=================================================
@@ -203,27 +118,6 @@ ynh_script_progression --message="Configuring a systemd service..." --weight=2
# Create a dedicated systemd config
ynh_add_systemd_config
-#=================================================
-# SETUP APPLICATION WITH CURL
-#=================================================
-
-### Use these lines only if the app installation needs to be finalized through
-### web forms. We generally don't want to ask the final user,
-### so we're going to use curl to automatically fill the fields and submit the
-### forms.
-
-# Set the app as temporarily public for curl call
-#####ynh_script_progression --message="Configuring SSOwat..." --weight=1
-# Making the app public for curl
-#####ynh_permission_update --permission="main" --add="visitors"
-
-# Installation with curl
-#####ynh_script_progression --message="Finalizing installation..." --weight=1
-#####ynh_local_curl "/INSTALL_PATH" "key1=value1" "key2=value2" "key3=value3"
-
-# Remove the public access
-####ynh_permission_update --permission="main" --remove="visitors"
-
#=================================================
# GENERIC FINALIZATION
#=================================================
@@ -249,34 +143,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1
# Start a systemd service
ynh_systemd_action --service_name=$app --action="start" --line_match="Listening on port" -t 30 --log_path="/var/log/$app/$app.log"
-#=================================================
-# SETUP FAIL2BAN
-#=================================================
-#ynh_script_progression --message="Configuring Fail2Ban..." --weight=1
-
-# Create a dedicated Fail2Ban config
-#ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failregex="Regex to match into the log for a failed login"
-
-#=================================================
-# SETUP SSOWAT
-#=================================================
-ynh_script_progression --message="Configuring permissions..." --weight=5
-
-# Make app public if necessary
-if [ $is_public -eq 1 ]
-then
- # Everyone can access the app.
- # The "main" permission is automatically created before the install script.
- ynh_permission_update --permission="main" --add="visitors"
-fi
-
-#=================================================
-# RELOAD NGINX
-#=================================================
-ynh_script_progression --message="Reloading NGINX web server..." --weight=1
-
-ynh_systemd_action --service_name=nginx --action=reload
-
#=================================================
# END OF SCRIPT
#=================================================
diff --git a/scripts/remove b/scripts/remove
index 1554df4..79780d6 100755
--- a/scripts/remove
+++ b/scripts/remove
@@ -9,17 +9,6 @@
source _common.sh
source /usr/share/yunohost/helpers
-#=================================================
-# LOAD SETTINGS
-#=================================================
-ynh_script_progression --message="Loading installation settings..." --weight=1
-
-app=$YNH_APP_INSTANCE_NAME
-
-domain=$(ynh_app_setting_get --app=$app --key=domain)
-port=$(ynh_app_setting_get --app=$app --key=port)
-final_path=$(ynh_app_setting_get --app=$app --key=final_path)
-
#=================================================
# STANDARD REMOVE
#=================================================
@@ -33,85 +22,23 @@ then
yunohost service remove $app
fi
-#=================================================
-# STOP AND REMOVE SERVICE
-#=================================================
-ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1
+ynh_script_progression --message="Removing various system files..." --weight=1
-# Remove the dedicated systemd config
ynh_remove_systemd_config
-#=================================================
-# REMOVE LOGROTATE CONFIGURATION
-#=================================================
-ynh_script_progression --message="Removing logrotate configuration..." --weight=1
-
-# Remove the app-specific logrotate config
ynh_remove_logrotate
-#=================================================
-# REMOVE DEPENDENCIES
-#=================================================
-ynh_script_progression --message="Removing dependencies..." --weight=1
-
ynh_remove_nodejs
-#=================================================
-# REMOVE APP MAIN DIR
-#=================================================
-ynh_script_progression --message="Removing app main directory..." --weight=1
-
-# Remove the app directory securely
-ynh_secure_remove --file="$final_path"
-
-
-#=================================================
-# REMOVE ADDITIONNAL SWAP
-#=================================================
#In case install or upgrade went wrong, remove script is launched, so we need to ensure additional swap is deleted
if [ -e /swap_$app ]; then
ynh_script_progression --message="Remove additionnal swap..." --weight=2
ynh_del_swap
fi
-#=================================================
-# REMOVE NGINX CONFIGURATION
-#=================================================
-ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1
-
-# Remove the dedicated NGINX config
ynh_remove_nginx_config
-#=================================================
-# REMOVE FAIL2BAN CONFIGURATION
-#=================================================
-#ynh_script_progression --message="Removing Fail2Ban configuration..." --weight=1
-
-# Remove the dedicated Fail2Ban config
-#ynh_remove_fail2ban_config
-
-#=================================================
-# SPECIFIC REMOVE
-#=================================================
-# REMOVE VARIOUS FILES
-#=================================================
-ynh_script_progression --message="Removing various files..." --weight=1
-
# Remove the log files
ynh_secure_remove --file="/var/log/$app"
-#=================================================
-# GENERIC FINALIZATION
-#=================================================
-# REMOVE DEDICATED USER
-#=================================================
-ynh_script_progression --message="Removing the dedicated system user..." --weight=7
-
-# Delete a system user
-ynh_system_user_delete --username=$app
-
-#=================================================
-# END OF SCRIPT
-#=================================================
-
-ynh_script_progression --message="Removal of $app completed" --last
+ynh_script_progression --message="Removal of $app completed" --last
\ No newline at end of file
diff --git a/scripts/restore b/scripts/restore
index aa0db7b..055d5ac 100755
--- a/scripts/restore
+++ b/scripts/restore
@@ -10,46 +10,12 @@
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
-#=================================================
-# MANAGE SCRIPT FAILURE
-#=================================================
-ynh_clean_setup () {
- #### Remove this function if there's nothing to clean before calling the remove script.
- true
-}
-# Exit if an error occurs during the execution of the script
-ynh_abort_if_errors
-
-#=================================================
-# LOAD SETTINGS
-#=================================================
-ynh_script_progression --message="Loading installation settings..." --weight=1
-
-app=$YNH_APP_INSTANCE_NAME
-
-domain=$(ynh_app_setting_get --app=$app --key=domain)
-path_url=$(ynh_app_setting_get --app=$app --key=path)
-final_path=$(ynh_app_setting_get --app=$app --key=final_path)
-
-#=================================================
-# CHECK IF THE APP CAN BE RESTORED
-#=================================================
-ynh_script_progression --message="Validating restoration parameters..." --weight=1
-
-test ! -d $final_path \
- || ynh_die --message="There is already a directory: $final_path "
-
-#=================================================
-# STANDARD RESTORATION STEPS
#=================================================
# RECREATE THE DEDICATED USER
#=================================================
ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
-# Create the dedicated user (if not existing)
-ynh_system_user_create --username=$app --home_dir="$final_path"
-
if grep dialout -q < /etc/group; then
usermod -a -G dialout "$app"
fi
@@ -63,7 +29,7 @@ fi
#=================================================
# INSTALL EXTRA DEPENDENCIES
#=================================================
-ynh_script_progression --message="Installing dependencies..." --weight=15
+#REMOVEME? ynh_script_progression --message="Installing dependencies..." --weight=15
ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
ynh_use_nodejs
@@ -74,7 +40,7 @@ ynh_exec_warn_less $ynh_npm install ---global yarn
#=================================================
ynh_script_progression --message="Restoring the app main directory..." --weight=1
-ynh_restore_file --origin_path="$final_path"
+ynh_restore_file --origin_path="$install_dir"
# FIXME: this should be managed by the core in the future
# Here, as a packager, you may have to tweak the ownerhsip/permissions
@@ -82,53 +48,22 @@ ynh_restore_file --origin_path="$final_path"
# files in some cases.
# But FOR THE LOVE OF GOD, do not allow r/x for "others" on the entire folder -
# this will be treated as a security issue.
-chmod 750 "$final_path"
-chmod -R o-rwx "$final_path"
-chown -R $app: "$final_path"
+chmod 750 "$install_dir"
+chmod -R o-rwx "$install_dir"
+chown -R $app: "$install_dir"
-#=================================================
-# RESTORE FAIL2BAN CONFIGURATION
-#=================================================
-#ynh_script_progression --message="Restoring the Fail2Ban configuration..." --weight=1
-
-#ynh_restore_file --origin_path="/etc/fail2ban/jail.d/$app.conf"
-#ynh_restore_file --origin_path="/etc/fail2ban/filter.d/$app.conf"
-#ynh_systemd_action --action=restart --service_name=fail2ban
-
-#=================================================
-# RESTORE THE NGINX CONFIGURATION
-#=================================================
-ynh_script_progression --message="Restoring the NGINX web server configuration..." --weight=1
+ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
-#=================================================
-# RESTORE SYSTEMD
-#=================================================
-ynh_script_progression --message="Restoring the systemd configuration..." --weight=1
-
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
systemctl enable $app.service --quiet
-#=================================================
-# RESTORE THE LOGROTATE CONFIGURATION
-#=================================================
-ynh_script_progression --message="Restoring the logrotate configuration..." --weight=1
-
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
-#=================================================
-# RESTORE THE LOG FILE DIRECTORY
-#=================================================
mkdir -p /var/log/$app
chown -R $app:$app /var/log/$app
-
-#=================================================
-# INTEGRATE SERVICE IN YUNOHOST
-#=================================================
-ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
-
yunohost service add $app --description="Zwave integration in domoticz" --log="/var/log/$app/$app.log"
#=================================================
diff --git a/scripts/upgrade b/scripts/upgrade
index 14977b2..fe9ba89 100644
--- a/scripts/upgrade
+++ b/scripts/upgrade
@@ -9,38 +9,12 @@
source _common.sh
source /usr/share/yunohost/helpers
-#=================================================
-# LOAD SETTINGS
-#=================================================
-ynh_script_progression --message="Loading installation settings..." --weight=1
-
-app=$YNH_APP_INSTANCE_NAME
-
-domain=$(ynh_app_setting_get --app=$app --key=domain)
-path_url=$(ynh_app_setting_get --app=$app --key=path)
-final_path=$(ynh_app_setting_get --app=$app --key=final_path)
-port=$(ynh_app_setting_get --app=$app --key=port)
-
#=================================================
# CHECK VERSION
#=================================================
upgrade_type=$(ynh_check_app_version_changed)
-#=================================================
-# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
-#=================================================
-ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=1
-
-# Backup the current version of the app
-ynh_backup_before_upgrade
-ynh_clean_setup () {
- # Restore it if the upgrade fails
- ynh_restore_upgradebackup
-}
-# Exit if an error occurs during the execution of the script
-ynh_abort_if_errors
-
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
@@ -59,17 +33,19 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app
# ADD SWAP IF NEEDED
#=================================================
#https://github.com/zwave-js/zwave-js-ui/issues/2699
-ynh_script_progression --message="Adding swap if needed for compiling..."
+if [ "$upgrade_type" == "UPGRADE_APP" ]; then
+ ynh_script_progression --message="Checking for RAM..."
-total_memory=$(ynh_get_ram --total)
-swap_needed=0
+ total_memory=$(ynh_get_ram --total)
+ swap_needed=0
-if [ $total_memory -lt $MEMORY_NEEDED ]; then
- # Need a minimum of 2Go of memory
- swap_needed=$(($MEMORY_NEEDED - $total_memory))
- ynh_script_progression --message="Adding $swap_needed Mo to swap..."
- SD_CARD_CAN_SWAP=1
- ynh_add_swap --size=$swap_needed
+ if [ $total_memory -lt $MEMORY_NEEDED ]; then
+ # Need a minimum of 2Go of memory
+ swap_needed=$(($MEMORY_NEEDED - $total_memory))
+ ynh_script_progression --message="Adding $swap_needed Mo to swap..."
+ SD_CARD_CAN_SWAP=1
+ ynh_add_swap --size=$swap_needed
+ fi
fi
#=================================================
@@ -77,9 +53,6 @@ fi
#=================================================
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
-# Create a dedicated user (if not existing)
-ynh_system_user_create --username=$app --home_dir="$final_path"
-
if grep dialout -q < /etc/group; then
usermod -a -G dialout "$app"
fi
@@ -93,7 +66,7 @@ fi
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
-ynh_script_progression --message="Upgrading dependencies..." --weight=1
+#REMOVEME? ynh_script_progression --message="Upgrading dependencies..." --weight=1
ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
ynh_use_nodejs
@@ -108,14 +81,14 @@ then
ynh_script_progression --message="Upgrading source files..." --weight=1
# Download, check integrity, uncompress and patch the source from app.src
- ynh_setup_source --dest_dir="$final_path"
+ ynh_setup_source --dest_dir="$install_dir"
- chmod 750 "$final_path"
- chmod -R o-rwx "$final_path"
- chown -R $app: "$final_path"
+ chmod 750 "$install_dir"
+ chmod -R o-rwx "$install_dir"
+ chown -R $app: "$install_dir"
ynh_script_progression --message="Building from sources..." --weight=15
- pushd "$final_path"
+ pushd "$install_dir"
ynh_script_progression --message="Fetching Yarn dependencies... This can be very long, be patient !" --weight=18
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn plugin import workspace-tools
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn workspaces focus --production
@@ -127,29 +100,29 @@ then
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn install --network-timeout 1000000000
ynh_script_progression --message="Cleaning cache... " --weight=3
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn cache clean 2>&1
- ynh_script_progression --message="Building Yarn dependencies... This can be very long, be patient !" --weight=18
+ ynh_script_progression --message="Building Yarn dependencies... This can be very long, be patient !" --weight=18
#https://geeklearning.io/angular-aot-webpack-memory-trick/
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH NODE_OPTIONS=--max-old-space-size=2048 yarn run build
ynh_script_progression --message="Cleaning cache... " --weight=3
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn cache clean 2>&1
popd
- chmod 750 "$final_path"
- chmod -R o-rwx "$final_path"
- chown -R $app: "$final_path"
+ chmod 750 "$install_dir"
+ chmod -R o-rwx "$install_dir"
+ chown -R $app: "$install_dir"
fi
#=================================================
# REMOVE ADDITIONNAL SWAP
#=================================================
-ynh_script_progression --message="Remove additionnal swap..." --weight=2
-
-if [ $swap_needed > 0 ]; then
- ynh_del_swap
+if [ "$upgrade_type" == "UPGRADE_APP" ]; then
+ if [ $swap_needed > 0 ]; then
+ ynh_script_progression --message="Remove additionnal swap..." --weight=2
+ ynh_del_swap
+ fi
fi
-
#=================================================
# NGINX CONFIGURATION
#=================================================
@@ -158,37 +131,6 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." -
# Create a dedicated NGINX config
ynh_add_nginx_config
-#=================================================
-# SPECIFIC UPGRADE
-#=================================================
-# ...
-#=================================================
-
-#=================================================
-# UPDATE A CONFIG FILE
-#=================================================
-#ynh_script_progression --message="Updating a configuration file..." --weight=1
-
-### Same as during install
-###
-### The file will automatically be backed-up if it's found to be manually modified (because
-### ynh_add_config keeps track of the file's checksum)
-
-#ynh_add_config --template="some_config_file" --destination="$final_path/some_config_file"
-
-# FIXME: this should be handled by the core in the future
-# You may need to use chmod 600 instead of 400,
-# for example if the app is expected to be able to modify its own config
-#chmod 400 "$final_path/some_config_file"
-#chown $app:$app "$final_path/some_config_file"
-
-### For more complex cases where you want to replace stuff using regexes,
-### you shoud rely on ynh_replace_string (which is basically a wrapper for sed)
-### When doing so, you also need to manually call ynh_store_file_checksum
-###
-### ynh_replace_string --match_string="match_string" --replace_string="replace_string" --target_file="$final_path/some_config_file"
-### ynh_store_file_checksum --file="$final_path/some_config_file"
-
#=================================================
# SETUP SYSTEMD
#=================================================
@@ -221,23 +163,8 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="start" --line_match="Listening on port" -t 30 --log_path="/var/log/$app/$app.log"
-#=================================================
-# UPGRADE FAIL2BAN
-#=================================================
-#ynh_script_progression --message="Reconfiguring Fail2Ban..." --weight=1
-
-# Create a dedicated Fail2Ban config
-#ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failregex="Regex to match into the log for a failed login"
-
-#=================================================
-# RELOAD NGINX
-#=================================================
-ynh_script_progression --message="Reloading NGINX web server..." --weight=1
-
-ynh_systemd_action --service_name=nginx --action=reload
-
#=================================================
# END OF SCRIPT
#=================================================
-ynh_script_progression --message="Upgrade of $app completed" --last
+ynh_script_progression --message="Upgrade of $app completed" --last
\ No newline at end of file
diff --git a/tests.toml b/tests.toml
new file mode 100644
index 0000000..8fd2692
--- /dev/null
+++ b/tests.toml
@@ -0,0 +1,5 @@
+test_format = 1.0
+
+[default]
+ test_upgrade_from.e4968ad.name = "Upgrade from 8.8.6~ynh1"
+ test_upgrade_from.9164618.name = "Upgrade from 8.8.5~ynh1"