From 354258a138f869d1c80b2c47976b3e1594ee31d0 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sat, 22 Jan 2022 00:41:07 +0100 Subject: [PATCH 1/9] Upgrade to 5.0~ynh1 --- README.md | 2 +- README_fr.md | 2 +- manifest.json | 2 +- scripts/_common.sh | 1 + scripts/install | 1 - scripts/upgrade | 2 +- 6 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 38ba0af..ebe59eb 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in A monitoring tool for diverse IT components, including networks, servers, VMs and cloud services. -**Shipped version:** 4.4~ynh3 +**Shipped version:** 5.0~ynh1 diff --git a/README_fr.md b/README_fr.md index ca062df..84d8b6f 100644 --- a/README_fr.md +++ b/README_fr.md @@ -13,7 +13,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour A monitoring tool for diverse IT components, including networks, servers, VMs and cloud services. -**Version incluse :** 4.4~ynh3 +**Version incluse :** 5.0~ynh1 diff --git a/manifest.json b/manifest.json index 7292eda..9726f32 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Monitoring tool for diverse IT components, including networks, servers, VMs and cloud services", "fr": "Outil pour monitorer des réseaux, des serveurs, des VMs et autres services en ligne" }, - "version": "4.4~ynh3", + "version": "5.0~ynh1", "url": "https://www.zabbix.com", "upstream": { "license": "GPL-2.0-or-later", diff --git a/scripts/_common.sh b/scripts/_common.sh index e623d03..dc942db 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -111,6 +111,7 @@ import_template () { cp "$confUserPpath" /etc/zabbix/zabbix_agentd.d/userP_yunohost.conf cp "$bashUserPpath" /etc/zabbix/zabbix_agentd.d/yunohost.sh + chown -R $app:$app "/etc/zabbix/zabbix_agentd.d/" chmod a+x /etc/zabbix/zabbix_agentd.d/yunohost.sh systemctl restart zabbix-agent diff --git a/scripts/install b/scripts/install index 9f7ca25..cf6c218 100644 --- a/scripts/install +++ b/scripts/install @@ -63,7 +63,6 @@ ynh_script_progression --message="Installing dependencies..." install_zabbix_repo ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies -dpkg -i --force-confmiss /var/cache/apt/archives/zabbix-server-mysql* ynh_replace_string --match_string="# $language.UTF-8 UTF-8" --replace_string="$language.UTF-8 UTF-8" --target_file=/etc/locale.gen locale-gen diff --git a/scripts/upgrade b/scripts/upgrade index 0e96805..7d14841 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -24,7 +24,7 @@ db_user=$(ynh_app_setting_get --app=$app --key=db_user) db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) language=$(ynh_app_setting_get --app=$app --key=language) -trustedversion="4.4-1+stretch" +trustedversion="5.0-1+stretch" is_public=$(ynh_permission_has_user --permission=main --user=visitors && echo 1 || echo 0) #================================================= From 22caba90a4d8c1dac345be451b304245cc874ed9 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sat, 22 Jan 2022 00:55:36 +0100 Subject: [PATCH 2/9] Fix repo --- scripts/_common.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index dc942db..23bbed1 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -214,7 +214,7 @@ check_proc_zabbixagent () { # Install Zabbix repo # install_zabbix_repo(){ - ynh_install_extra_repo --repo="http://repo.zabbix.com/zabbix/4.4/debian $(lsb_release -sc) main" --key=https://repo.zabbix.com/zabbix-official-repo.key --priority=999 --name=zabbix + ynh_install_extra_repo --repo="http://repo.zabbix.com/zabbix/5.0/debian $(lsb_release -sc) main" --key=https://repo.zabbix.com/zabbix-official-repo.key --priority=999 --name=zabbix } # Remove Zabbix repo From 6cd7998a17958e00a2c2c6be152e33e8f5a8598f Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sat, 22 Jan 2022 01:14:46 +0100 Subject: [PATCH 3/9] Fix linsnmpd version --- scripts/_common.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 23bbed1..ea7437d 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -5,7 +5,13 @@ #================================================= # dependencies used by the app -pkg_dependencies="libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap liblua5.2-0 ttf-dejavu-core patch smistrip unzip wget fping libcap2-bin libiksemel3 libopenipmi0 libpam-cap libsnmp-base libsnmp30 snmptrapd snmpd libjs-prototype jq zabbix-server-mysql zabbix-agent zabbix-frontend-php" +if [ "$(lsb_release --codename --short)" = "bullseye" ]; then + libsnmpd_version="libsnmp40" +else + libsnmpd_version="libsnmp30" +fi + +pkg_dependencies="libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap liblua5.2-0 fonts-dejavu-core patch smistrip unzip wget fping libcap2-bin libiksemel3 libopenipmi0 libpam-cap libsnmp-base $libsnmpd_version snmptrapd snmpd libjs-prototype jq zabbix-server-mysql zabbix-agent zabbix-frontend-php " YNH_PHP_VERSION="7.3" From 97521185951617c41cbd94b14583bc67defe7cac Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sat, 22 Jan 2022 17:36:37 +0100 Subject: [PATCH 4/9] Fix Duplicate entry 'Service state' for key 'valuemaps_1' --- conf/Template_Yunohost.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/conf/Template_Yunohost.xml b/conf/Template_Yunohost.xml index 259779c..50e2ff0 100644 --- a/conf/Template_Yunohost.xml +++ b/conf/Template_Yunohost.xml @@ -1,6 +1,6 @@ - 4.4 + 5.0 2020-11-26T12:48:35Z @@ -321,7 +321,7 @@ fi - Service state + Yunohost : Service state @@ -350,7 +350,7 @@ fi - Service state + Yunohost : Service state @@ -510,7 +510,7 @@ fi - Service state + Yunohost : Service state 0 From f912137c9e6caf4c2cc363e6b9af82f2c86f310b Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sun, 23 Jan 2022 15:43:10 +0100 Subject: [PATCH 5/9] Update repo during upgrade --- scripts/_common.sh | 1 + scripts/upgrade | 1 + 2 files changed, 2 insertions(+) diff --git a/scripts/_common.sh b/scripts/_common.sh index ea7437d..59eba6a 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -220,6 +220,7 @@ check_proc_zabbixagent () { # Install Zabbix repo # install_zabbix_repo(){ + ynh_remove_extra_repo --name=zabbix ynh_install_extra_repo --repo="http://repo.zabbix.com/zabbix/5.0/debian $(lsb_release -sc) main" --key=https://repo.zabbix.com/zabbix-official-repo.key --priority=999 --name=zabbix } diff --git a/scripts/upgrade b/scripts/upgrade index 7d14841..950c42b 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -159,6 +159,7 @@ if [ "$upgrade_type" == "UPGRADE_APP" ] then ynh_script_progression --message="Upgrading dependencies..." + install_zabbix_repo DEBIAN_FRONTEND=noninteractive apt-mark unhold zabbix-server-mysql zabbix-frontend-php ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies fi From 9fe703098d939c24efe41f1670caf6312de55c6b Mon Sep 17 00:00:00 2001 From: yalh76 Date: Mon, 24 Jan 2022 03:04:46 +0100 Subject: [PATCH 6/9] Fix upgrade from 4.0 --- scripts/_common.sh | 2 +- scripts/upgrade | 46 ++++------------------------------------------ 2 files changed, 5 insertions(+), 43 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 59eba6a..eeebdbc 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -11,7 +11,7 @@ else libsnmpd_version="libsnmp30" fi -pkg_dependencies="libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap liblua5.2-0 fonts-dejavu-core patch smistrip unzip wget fping libcap2-bin libiksemel3 libopenipmi0 libpam-cap libsnmp-base $libsnmpd_version snmptrapd snmpd libjs-prototype jq zabbix-server-mysql zabbix-agent zabbix-frontend-php " +pkg_dependencies="libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap liblua5.2-0 fonts-dejavu-core patch smistrip unzip wget fping libcap2-bin libiksemel3 libopenipmi0 libpam-cap libsnmp-base $libsnmpd_version snmptrapd snmpd libjs-prototype jq libssh-4 zabbix-agent zabbix-frontend-php zabbix-server-mysql" YNH_PHP_VERSION="7.3" diff --git a/scripts/upgrade b/scripts/upgrade index 950c42b..a7352d8 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -24,8 +24,7 @@ db_user=$(ynh_app_setting_get --app=$app --key=db_user) db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) language=$(ynh_app_setting_get --app=$app --key=language) -trustedversion="5.0-1+stretch" -is_public=$(ynh_permission_has_user --permission=main --user=visitors && echo 1 || echo 0) +trustedversion="5.0.0-1+stretch" #================================================= # CHECK VERSION @@ -162,6 +161,8 @@ then install_zabbix_repo DEBIAN_FRONTEND=noninteractive apt-mark unhold zabbix-server-mysql zabbix-frontend-php ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies + + apt-get upgrade -y --option Dpkg::Options::=--force-confdef --option Dpkg::Options::=--force-confold fi #================================================= @@ -193,32 +194,6 @@ convert_ZabbixDB set_mediatype_default_yunohost -#================================================= -# SETUP APPLICATION WITH CURL -#================================================= -ynh_script_progression --message="Setuping application with CURL..." - -# Set the app as temporarily public for curl call -ynh_script_progression --message="Configuring SSOwat..." -# Making the app public for curl -if [ $is_public -eq 0 ] -then - ynh_permission_update --permission="main" --add="visitors" -fi - -enable_admin_user - -import_template - -link_template - -disable_admin_user - -disable_guest_user - -# Remove the public access -ynh_permission_update --permission="main" --remove="visitors" - #================================================= # SETUP SYSTEMD #================================================= @@ -248,22 +223,9 @@ yunohost service add zabbix-agent --description="Management Zabbix agent daemon ynh_script_progression --message="Starting a systemd service..." # Start a systemd service -ynh_systemd_action --service_name=$app-server --action="restart" --log_path="/var/log/$app/${app}_server.log" +ynh_systemd_action --service_name=$app-server --action="restart" --log_path="/var/log/$app/${app}_server.log" --line_match="server #0 started" ynh_systemd_action --service_name=$app-agent --action="restart" --log_path="/var/log/$app/${app}_agent.log" -#================================================= -# SETUP SSOWAT -#================================================= -ynh_script_progression --message="Configuring permissions..." - -# 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 #================================================= From 8c866e956de6063d3471cdf947166e11261143be Mon Sep 17 00:00:00 2001 From: yalh76 Date: Wed, 2 Feb 2022 02:54:37 +0100 Subject: [PATCH 7/9] Remove zabbix repo --- manifest.json | 2 +- scripts/_common.sh | 17 +++-------------- scripts/install | 2 +- scripts/restore | 3 +-- scripts/upgrade | 24 +++--------------------- 5 files changed, 9 insertions(+), 39 deletions(-) diff --git a/manifest.json b/manifest.json index 9726f32..0ac633d 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Monitoring tool for diverse IT components, including networks, servers, VMs and cloud services", "fr": "Outil pour monitorer des réseaux, des serveurs, des VMs et autres services en ligne" }, - "version": "5.0~ynh1", + "version": "5.0.20~ynh1", "url": "https://www.zabbix.com", "upstream": { "license": "GPL-2.0-or-later", diff --git a/scripts/_common.sh b/scripts/_common.sh index eeebdbc..2939639 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -11,7 +11,9 @@ else libsnmpd_version="libsnmp30" fi -pkg_dependencies="libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap liblua5.2-0 fonts-dejavu-core patch smistrip unzip wget fping libcap2-bin libiksemel3 libopenipmi0 libpam-cap libsnmp-base $libsnmpd_version snmptrapd snmpd libjs-prototype jq libssh-4 zabbix-agent zabbix-frontend-php zabbix-server-mysql" +pkg_dependencies="libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap liblua5.2-0 fonts-dejavu-core patch smistrip unzip wget fping libcap2-bin libiksemel3 libopenipmi0 libpam-cap libsnmp-base $libsnmpd_version snmptrapd snmpd libjs-prototype jq libssh-4" + +zabbix_pkg_dependencies="zabbix-agent zabbix-frontend-php zabbix-server-mysql" YNH_PHP_VERSION="7.3" @@ -217,19 +219,6 @@ check_proc_zabbixagent () { fi } -# Install Zabbix repo -# -install_zabbix_repo(){ - ynh_remove_extra_repo --name=zabbix - ynh_install_extra_repo --repo="http://repo.zabbix.com/zabbix/5.0/debian $(lsb_release -sc) main" --key=https://repo.zabbix.com/zabbix-official-repo.key --priority=999 --name=zabbix -} - -# Remove Zabbix repo -# -remove_zabbix_repo(){ - ynh_remove_extra_repo --name=zabbix -} - # Remove previous Zabbix installation # remove_previous_zabbix () { diff --git a/scripts/install b/scripts/install index cf6c218..f356a5c 100644 --- a/scripts/install +++ b/scripts/install @@ -61,8 +61,8 @@ ynh_app_setting_set --app=$app --key=language --value=$language #================================================= ynh_script_progression --message="Installing dependencies..." -install_zabbix_repo ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies +ynh_exec_warn_less ynh_install_extra_app_dependencies --repo="http://repo.zabbix.com/zabbix/5.0/debian $(lsb_release -sc) main" --package="$zabbix_pkg_dependencies" --key="https://repo.zabbix.com/zabbix-official-repo.key" ynh_replace_string --match_string="# $language.UTF-8 UTF-8" --replace_string="$language.UTF-8 UTF-8" --target_file=/etc/locale.gen locale-gen diff --git a/scripts/restore b/scripts/restore index cdcbd0a..378b773 100644 --- a/scripts/restore +++ b/scripts/restore @@ -61,10 +61,9 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= ynh_script_progression --message="Reinstalling dependencies..." -install_zabbix_repo # Define and install dependencies ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies -DEBIAN_FRONTEND=noninteractive apt-mark hold zabbix-server-mysql zabbix-frontend-php +ynh_exec_warn_less ynh_install_extra_app_dependencies --repo="http://repo.zabbix.com/zabbix/5.0/debian $(lsb_release -sc) main" --package="$zabbix_pkg_dependencies" --key="https://repo.zabbix.com/zabbix-official-repo.key" ynh_replace_string --match_string="# $language.UTF-8 UTF-8" --replace_string="$language.UTF-8 UTF-8" --target_file=/etc/locale.gen locale-gen diff --git a/scripts/upgrade b/scripts/upgrade index a7352d8..0824f92 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -89,23 +89,6 @@ fi export mysqlconn="mysql --user=$db_user --password=$db_pwd --database=$db_name" -# patch if zabbix-release installed -if [ "$(dpkg -l zabbix-release 2>/dev/null | wc -l)" -ne 0 ] -then - DEBIAN_FRONTEND=noninteractive apt purge zabbix-release -y - install_zabbix_repo -fi - -# patch if zabbix-release has Candidate version but no Installed version -if [ -f "/etc/apt/sources.list.d/zabbix.list" ] -then - if [ "$(grep -c "4.2" /etc/apt/sources.list.d/zabbix.list)" -eq 1 ] - then - install_zabbix_repo - upgrade_type="UPGRADE_APP" - fi -fi - # patch to remove old zabbix-client service if [ ! -z "$(yunohost service status | grep zabbix-client)" ] then @@ -142,6 +125,8 @@ fi ln -s "/etc/zabbix/web/zabbix.conf.php" "/usr/share/zabbix/conf/zabbix.conf.php" +ynh_remove_extra_repo --name=zabbix + #================================================= # NGINX CONFIGURATION #================================================= @@ -158,11 +143,8 @@ if [ "$upgrade_type" == "UPGRADE_APP" ] then ynh_script_progression --message="Upgrading dependencies..." - install_zabbix_repo - DEBIAN_FRONTEND=noninteractive apt-mark unhold zabbix-server-mysql zabbix-frontend-php ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies - - apt-get upgrade -y --option Dpkg::Options::=--force-confdef --option Dpkg::Options::=--force-confold + ynh_exec_warn_less ynh_install_extra_app_dependencies --repo="http://repo.zabbix.com/zabbix/5.0/debian $(lsb_release -sc) main" --package="$zabbix_pkg_dependencies" --key="https://repo.zabbix.com/zabbix-official-repo.key" fi #================================================= From 0fdcf79aee247b71dde4bf46deb90ed22f893e70 Mon Sep 17 00:00:00 2001 From: Yunohost-Bot <> Date: Wed, 2 Feb 2022 01:54:42 +0000 Subject: [PATCH 8/9] Auto-update README --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ebe59eb..82551aa 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in A monitoring tool for diverse IT components, including networks, servers, VMs and cloud services. -**Shipped version:** 5.0~ynh1 +**Shipped version:** 5.0.20~ynh1 diff --git a/README_fr.md b/README_fr.md index 84d8b6f..4219ff3 100644 --- a/README_fr.md +++ b/README_fr.md @@ -13,7 +13,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour A monitoring tool for diverse IT components, including networks, servers, VMs and cloud services. -**Version incluse :** 5.0~ynh1 +**Version incluse :** 5.0.20~ynh1 From 1f8803fa7ef75d5b0c0241facd0894045fd4c87a Mon Sep 17 00:00:00 2001 From: yalh76 Date: Thu, 3 Feb 2022 03:34:04 +0100 Subject: [PATCH 9/9] Fix zabbix-release --- scripts/remove | 1 - scripts/upgrade | 11 ----------- 2 files changed, 12 deletions(-) diff --git a/scripts/remove b/scripts/remove index f66349f..9e04e1b 100644 --- a/scripts/remove +++ b/scripts/remove @@ -83,7 +83,6 @@ ynh_script_progression --message="Removing dependencies..." #Remove config file detection delete_initZabbixConf -DEBIAN_FRONTEND=noninteractive apt-get purge zabbix-release -y ynh_remove_app_dependencies ynh_remove_extra_repo --name=$app diff --git a/scripts/upgrade b/scripts/upgrade index 0824f92..53db434 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -101,17 +101,6 @@ ynh_remove_logrotate # Check if new zabbix version is available on repo" ynh_package_update -zabbixReleaseInstalledVersion=$(apt-cache policy zabbix-release | sed -n '2p' | grep -Po ".* \K(.*)") - -if [[ "$trustedversion" > "$zabbixReleaseInstalledVersion" ]] -then - upgrade_type="UPGRADE_APP" -fi - -if [ -f "/etc/zabbix/web/zabbix.conf.php" ] -then - ynh_secure_remove --file="/etc/zabbix/web/zabbix.conf.php" -fi ynh_add_config --template="../conf/etc_zabbix_web_zabbix.conf.php" --destination="/etc/zabbix/web/zabbix.conf.php"