diff --git a/README.md b/README.md
index 6a1bf68..c7180f2 100644
--- a/README.md
+++ b/README.md
@@ -21,7 +21,7 @@ Monitorix is a free, open source, lightweight system monitoring tool designed to
It has been created to be used under production Linux/UNIX servers, but due to its simplicity and small size can be used on embedded devices as well.
-**Shipped version:** 3.15.0~ynh5
+**Shipped version:** 3.15.0~ynh6
**Demo:**
diff --git a/README_eu.md b/README_eu.md
index b6603cd..004ac02 100644
--- a/README_eu.md
+++ b/README_eu.md
@@ -21,7 +21,7 @@ Monitorix is a free, open source, lightweight system monitoring tool designed to
It has been created to be used under production Linux/UNIX servers, but due to its simplicity and small size can be used on embedded devices as well.
-**Paketatutako bertsioa:** 3.15.0~ynh5
+**Paketatutako bertsioa:** 3.15.0~ynh6
**Demoa:**
diff --git a/README_fr.md b/README_fr.md
index 3f44dda..8fc807f 100644
--- a/README_fr.md
+++ b/README_fr.md
@@ -21,7 +21,7 @@ Monitorix is a free, open source, lightweight system monitoring tool designed to
It has been created to be used under production Linux/UNIX servers, but due to its simplicity and small size can be used on embedded devices as well.
-**Version incluse :** 3.15.0~ynh5
+**Version incluse :** 3.15.0~ynh6
**Démo :**
diff --git a/README_gl.md b/README_gl.md
index 12232c7..eed5ef4 100644
--- a/README_gl.md
+++ b/README_gl.md
@@ -21,7 +21,7 @@ Monitorix is a free, open source, lightweight system monitoring tool designed to
It has been created to be used under production Linux/UNIX servers, but due to its simplicity and small size can be used on embedded devices as well.
-**Versión proporcionada:** 3.15.0~ynh5
+**Versión proporcionada:** 3.15.0~ynh6
**Demo:**
diff --git a/README_zh_Hans.md b/README_zh_Hans.md
index 0ffd21a..7aa9f4f 100644
--- a/README_zh_Hans.md
+++ b/README_zh_Hans.md
@@ -21,7 +21,7 @@ Monitorix is a free, open source, lightweight system monitoring tool designed to
It has been created to be used under production Linux/UNIX servers, but due to its simplicity and small size can be used on embedded devices as well.
-**分发版本:** 3.15.0~ynh5
+**分发版本:** 3.15.0~ynh6
**演示:**
diff --git a/conf/monitorix-alert.sh b/conf/monitorix-alert.sh
index 2544ecf..cacb65f 100644
--- a/conf/monitorix-alert.sh
+++ b/conf/monitorix-alert.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
#
# Example script used to execute an alert action.
#
diff --git a/conf/systemd.service b/conf/systemd.service
index 97d619c..310c2aa 100644
--- a/conf/systemd.service
+++ b/conf/systemd.service
@@ -27,7 +27,7 @@ ProtectKernelModules=yes
ProtectKernelTunables=yes
LockPersonality=yes
SystemCallArchitectures=native
-SystemCallFilter=~@clock @debug @module @mount @obsolete @reboot @cpu-emulation @swap
+SystemCallFilter=~@clock @debug @module @obsolete @reboot @cpu-emulation @swap
# # Denying access to capabilities that should not be relevant for webapps
# # Doc: https://man7.org/linux/man-pages/man7/capabilities.7.html
diff --git a/manifest.toml b/manifest.toml
index e1ede2c..b3467d3 100644
--- a/manifest.toml
+++ b/manifest.toml
@@ -7,7 +7,7 @@ name = "Monitorix"
description.en = "A system monitoring tool"
description.fr = "Un outil de monitoring système"
-version = "3.15.0~ynh5"
+version = "3.15.0~ynh6"
maintainers = ["Josué Tille"]
@@ -20,7 +20,7 @@ code = "https://github.com/mikaku/Monitorix"
cpe = "cpe:2.3:a:fibranet:monitorix"
[integration]
-yunohost = ">= 11.0.11"
+yunohost = ">= 11.2.11"
architectures = "all"
multi_instance = false
ldap = "not_relevant"
diff --git a/scripts/_common.sh b/scripts/_common.sh
index fcf8c2e..e59c7f7 100644
--- a/scripts/_common.sh
+++ b/scripts/_common.sh
@@ -79,7 +79,7 @@ load_vars() {
readonly home_user_dirs="$(echo /home/* | home_dir_filter)"
readonly net_gateway="$(ip --json route show default | jq -r '.[0].dev')"
readonly net_interface_list="$(ip --json link show | jq -r '.[].ifname | select(. != "lo")' | interface_speed_map)"
- readonly net_max_speed="$(cat /sys/class/net/*/speed 2>/dev/null | sort | tail -n1)"
+ readonly net_max_speed="$(cat /sys/class/net/*/speed 2>/dev/null | sort | tail -n1 | sed 's|-1|1000|g')"
readonly ssh_port="$((grep ssh_port /etc/yunohost/settings.yml || echo 22) | cut -d: -f2 | xargs)"
readonly port_infos="$(python3 </dev/null \
- | grep --count "ok installed" &>/dev/null
-}
diff --git a/scripts/install b/scripts/install
index b7eb8a4..603c236 100755
--- a/scripts/install
+++ b/scripts/install
@@ -17,34 +17,25 @@ ensure_vars_set
# Check datadir empty
#=================================================
-if [ -n "$(ls -A $data_dir)" ]; then
+if [ -n "$(ls -A "$data_dir")" ]; then
old_data_dir_path="${data_dir}_$(date '+%Y%m%d.%H%M%S')"
ynh_print_warn --message="Data directory was not empty. Data was moved to $old_data_dir_path"
- mkdir -p $old_data_dir_path
+ mkdir -p "$old_data_dir_path"
mv -t "$old_data_dir_path" "$data_dir"/*
app_data_dirs="$(echo /home/yunohost.app/*)"
fi
-
-#=================================================
-# STANDARD MODIFICATIONS
-#=================================================
-ynh_script_progression --message="Installing packages..." --weight=1
-
-# Download package and install it
-install_monitorix_package
+mkdir -p /var/log/"$app"
ynh_systemd_action --service_name="$app" --action=stop --log_path=systemd --timeout=15
-mkdir -p /var/log/new_"${app}"
-mv -t /var/log/new_"${app}" /var/log/monitorix*
-mv /var/log/new_"${app}" /var/log/"${app}"
#=================================================
# SYSTEM CONFIGURATION
#=================================================ç
ynh_script_progression --message="Adding configurations related to $app..." --weight=1
+mkdir -p /etc/monitorix
ynh_add_jinja_config --template=monitorix.conf --destination="/etc/monitorix/monitorix.conf"
-ynh_add_jinja_config --template=nginx_status.conf --destination "$nginx_status_conf"
+ynh_add_jinja_config --template=nginx_status.conf --destination="$nginx_status_conf"
ynh_add_nginx_config
ynh_add_systemd_config
@@ -62,6 +53,14 @@ fi
configure_hooks
configure_alerts_email
+#=================================================
+# STANDARD MODIFICATIONS
+#=================================================
+ynh_script_progression --message="Installing packages..." --weight=1
+
+# Download package and install it
+install_monitorix_package
+
#=================================================
# GENERIC FINALIZATION
#=================================================
@@ -69,14 +68,14 @@ ynh_script_progression --message="Protecting directory..."
set_permission
-ynh_use_logrotate --logfile "/var/log/$app"
+ynh_use_logrotate --logfile="/var/log/$app"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1
-ynh_systemd_action --service_name="$app" --action="start" --log_path 'systemd' --line_match ' - Ok, ready.'
+ynh_systemd_action --service_name="$app" --action="start" --log_path='systemd' --line_match=' - Ok, ready.'
# when we change the value of 'listen [::1]:xxx;' nginx don't reload correctly the config, so force to restart to ensure that the new config are loaded
ynh_systemd_action --service_name=nginx.service --action=restart
save_vars_current_value
diff --git a/scripts/remove b/scripts/remove
index 86f5fa6..bd84296 100755
--- a/scripts/remove
+++ b/scripts/remove
@@ -18,7 +18,7 @@ load_vars
#=================================================
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
-if ynh_exec_warn_less yunohost service status $app >/dev/null
+if ynh_exec_warn_less yunohost service status "$app" >/dev/null
then
ynh_script_progression --message="Removing $app service integration..." --weight=3
yunohost service remove "$app"
@@ -48,15 +48,18 @@ for pool_dir_by_version in /etc/php/*; do
fi
done
-if ynh_psql_user_exists --user=$db_user; then
- ynh_psql_drop_user $db_user
+if ynh_psql_user_exists --user="$db_user"; then
+ ynh_psql_drop_user "$db_user"
fi
-if ynh_mysql_user_exists --user=$db_user; then
- ynh_mysql_drop_user $db_user
+if ynh_mysql_user_exists --user="$db_user"; then
+ ynh_mysql_drop_user "$db_user"
fi
ynh_package_autopurge monitorix
-ynh_secure_remove --file=/var/log/"$app"
ynh_secure_remove --file="$install_dir"
+if [ "$YNH_APP_PURGE" -eq 1 ]; then
+ ynh_secure_remove --file=/var/log/"$app"
+fi
+
ynh_script_progression --message="Removal of $app completed" --last
diff --git a/scripts/restore b/scripts/restore
index 23e5795..69a1eb8 100755
--- a/scripts/restore
+++ b/scripts/restore
@@ -12,17 +12,6 @@ source ../settings/scripts/experimental_helper.sh
source /usr/share/yunohost/helpers
load_vars
-#=================================================
-# RESTORE THE DEPENDENCIES
-#=================================================
-ynh_script_progression --message="Restoring the dependencies..." --weight=1
-
-install_monitorix_package
-ynh_systemd_action --service_name="$app" --action=stop --log_path=systemd --timeout=15
-mkdir -p /var/log/new_"${app}"
-mv -t /var/log/new_"${app}" /var/log/monitorix*
-mv /var/log/new_"${app}" /var/log/"${app}"
-
ynh_script_progression --message="Configuring databases access..."
configure_db
@@ -32,15 +21,23 @@ configure_db
ynh_script_progression --message="Restoring files" --weight=1
ynh_restore
-mkdir -p /var/log/$app
-systemctl enable $app.service --quiet
+mkdir -p /var/log/"$app"
+systemctl enable "$app".service --quiet
ynh_script_progression --message="Configuring php fpm access if needed..."
if "$phpfpm_installed"; then
config_php_fpm
fi
-yunohost service add $app --description="Monitorix" --log="systemd"
+yunohost service add "$app" --description="Monitorix" --log="systemd"
+
+#=================================================
+# RESTORE THE DEPENDENCIES
+#=================================================
+ynh_script_progression --message="Restoring the dependencies..." --weight=1
+
+install_monitorix_package
+ynh_systemd_action --service_name="$app" --action=stop --log_path=systemd --timeout=15
#=================================================
# GENERIC FINALIZATION
@@ -49,7 +46,7 @@ ynh_script_progression --message="Protecting directory..."
set_permission
-ynh_use_logrotate --logfile "/var/log/$app"
+ynh_use_logrotate --logfile="/var/log/$app"
#=================================================
# GENERIC FINALIZATION
@@ -58,7 +55,7 @@ ynh_use_logrotate --logfile "/var/log/$app"
#=================================================
ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1
-ynh_systemd_action --service_name="$app" --action=start --log_path 'systemd' --line_match ' - Ok, ready.'
+ynh_systemd_action --service_name="$app" --action=start --log_path='systemd' --line_match=' - Ok, ready.'
# when we change the value of 'listen [::1]:xxx;' nginx don't reload correctly the config, so force to restart to ensure that the new config are loaded
ynh_systemd_action --service_name=nginx.service --action=restart
ynh_systemd_action --service_name=nginx --action=reload
diff --git a/scripts/upgrade b/scripts/upgrade
index 164baa1..5984372 100755
--- a/scripts/upgrade
+++ b/scripts/upgrade
@@ -11,7 +11,7 @@ source experimental_helper.sh
source /usr/share/yunohost/helpers
load_vars
-upgrade_type=$(ynh_check_app_version_changed)
+upgrade_type="$(ynh_check_app_version_changed)"
#=================================================
# STANDARD UPGRADE STEPS
@@ -30,14 +30,14 @@ ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
test -e /etc/monitorix/conf.d/00-debian.conf || touch /etc/monitorix/conf.d/00-debian.conf
# Remove old hook if exist
-ynh_secure_remove --file=/usr/share/yunohost/hooks/post_iptable_rules/50-$app
+ynh_secure_remove --file=/usr/share/yunohost/hooks/post_iptable_rules/50-"$app"
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Stopping a systemd service..." --weight=1
-ynh_systemd_action --service_name=$app --action=stop --log_path="/var/log/$app/$app.log"
+ynh_systemd_action --service_name="$app" --action=stop --log_path="/var/log/$app/$app.log"
#=================================================
# "REBUILD" THE APP (DEPLOY NEW SOURCES, RERUN NPM BUILD...)
@@ -77,7 +77,7 @@ fi
ynh_script_progression --message="Upgrading configurations related to $app..." --weight=1
ynh_add_jinja_config --template=monitorix.conf --destination=/etc/monitorix/monitorix.conf
-ynh_add_jinja_config --template=nginx_status.conf --destination "$nginx_status_conf"
+ynh_add_jinja_config --template=nginx_status.conf --destination="$nginx_status_conf"
if "$phpfpm_installed"; then
config_php_fpm
fi
@@ -104,14 +104,14 @@ ynh_script_progression --message="Protecting directory..."
set_permission
-ynh_use_logrotate --logfile "/var/log/$app"
+ynh_use_logrotate --logfile="/var/log/$app"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1
-ynh_systemd_action --service_name="$app" --action=restart --log_path=systemd --line_match ' - Ok, ready.'
+ynh_systemd_action --service_name="$app" --action=restart --log_path=systemd --line_match=' - Ok, ready.'
# when we change the value of 'listen [::1]:xxx;' nginx don't reload correctly the config, so force to restart to ensure that the new config are loaded
ynh_systemd_action --service_name=nginx.service --action=restart
save_vars_current_value
diff --git a/sources/update_config_if_needed.sh b/sources/update_config_if_needed.sh
index 8429664..a4846d3 100644
--- a/sources/update_config_if_needed.sh
+++ b/sources/update_config_if_needed.sh
@@ -76,13 +76,13 @@ if "$status_dirty"; then
emailreports_yearly_to="$(ynh_app_setting_get --app="$app" --key=emailreports_yearly_to)"
ynh_add_jinja_config --template=monitorix.conf --destination="/etc/monitorix/monitorix.conf"
- ynh_add_jinja_config --template=nginx_status.conf --destination "$nginx_status_conf"
+ ynh_add_jinja_config --template=nginx_status.conf --destination="$nginx_status_conf"
configure_db
if "$phpfpm_installed"; then
config_php_fpm
fi
- ynh_systemd_action --service_name="$app" --action=restart --log_path 'systemd' --line_match ' - Ok, ready.'
+ ynh_systemd_action --service_name="$app" --action=restart --log_path='systemd' --line_match=' - Ok, ready.'
ynh_systemd_action --service_name=nginx --action=reload
save_vars_current_value
fi