1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/zabbix_ynh.git synced 2024-09-03 20:36:14 +02:00

Merge pull request #32 from YunoHost-Apps/bullseye

Upgrade to 5.0~ynh1
This commit is contained in:
yalh76 2022-02-04 19:48:23 +01:00 committed by GitHub
commit 623eda1d01
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 24 additions and 96 deletions

View file

@ -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

View file

@ -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

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<zabbix_export>
<version>4.4</version>
<version>5.0</version>
<date>2020-11-26T12:48:35Z</date>
<groups>
<group>
@ -321,7 +321,7 @@ fi</description>
</application>
</applications>
<valuemap>
<name>Service state</name>
<name>Yunohost : Service state</name>
</valuemap>
<trigger_prototypes>
<trigger_prototype>
@ -350,7 +350,7 @@ fi</description>
</application>
</applications>
<valuemap>
<name>Service state</name>
<name>Yunohost : Service state</name>
</valuemap>
<trigger_prototypes>
<trigger_prototype>
@ -510,7 +510,7 @@ fi</description>
</triggers>
<value_maps>
<value_map>
<name>Service state</name>
<name>Yunohost : Service state</name>
<mappings>
<mapping>
<value>0</value>

View file

@ -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",

View file

@ -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 () {

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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
#=================================================