diff --git a/README.md b/README.md index 38ba0af..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:** 4.4~ynh3 +**Shipped version:** 5.0.20~ynh1 diff --git a/README_fr.md b/README_fr.md index ca062df..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 :** 4.4~ynh3 +**Version incluse :** 5.0.20~ynh1 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 diff --git a/manifest.json b/manifest.json index 7292eda..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": "4.4~ynh3", + "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 e623d03..2939639 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -5,7 +5,15 @@ #================================================= # 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 libssh-4" + +zabbix_pkg_dependencies="zabbix-agent zabbix-frontend-php zabbix-server-mysql" YNH_PHP_VERSION="7.3" @@ -111,6 +119,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 @@ -210,18 +219,6 @@ check_proc_zabbixagent () { fi } -# 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 -} - -# 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 9f7ca25..f356a5c 100644 --- a/scripts/install +++ b/scripts/install @@ -61,9 +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 -dpkg -i --force-confmiss /var/cache/apt/archives/zabbix-server-mysql* +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/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/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 0e96805..53db434 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="4.4-1+stretch" -is_public=$(ynh_permission_has_user --permission=main --user=visitors && echo 1 || echo 0) +trustedversion="5.0.0-1+stretch" #================================================= # CHECK VERSION @@ -90,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 @@ -119,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" @@ -143,6 +114,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 #================================================= @@ -159,8 +132,8 @@ if [ "$upgrade_type" == "UPGRADE_APP" ] then ynh_script_progression --message="Upgrading dependencies..." - DEBIAN_FRONTEND=noninteractive apt-mark unhold zabbix-server-mysql zabbix-frontend-php 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" fi #================================================= @@ -192,32 +165,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 #================================================= @@ -247,22 +194,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 #=================================================