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

Merge branch 'to4.4.0' into 'master'

To Zabbix 4.4

See merge request Mickael-Martin/zabbix_ynh!30
This commit is contained in:
Mickael-Martin 2019-11-19 13:59:28 +01:00
commit 0073d69105
4 changed files with 26 additions and 26 deletions

View file

@ -29,5 +29,5 @@ location __PATH__/ {
### End of PHP configuration part
# Include SSOWAT user panel.
#include conf.d/yunohost_panel.conf.inc;
include conf.d/yunohost_panel.conf.inc;
}

View file

@ -171,5 +171,5 @@ check_proc_zabbixagent(){
install_zabbix_repo(){
ynh_add_extra_apt_repos__3_path=$(find /var/cache/yunohost/ /etc/yunohost/apps/zabbix/ -name "ynh_add_extra_apt_repos__3" | tail -n 1)
source "$ynh_add_extra_apt_repos__3_path"
ynh_install_extra_repo --repo="http://repo.zabbix.com/zabbix/4.2/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/4.4/debian $(lsb_release -sc) main" --key=https://repo.zabbix.com/zabbix-official-repo.key --priority=999 --name=zabbix
}

View file

@ -106,7 +106,6 @@ ynh_print_info "Update and install dependencies"
#ynh_package_update no need cause ynh_install_app_dependencies after
ynh_install_app_dependencies libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap liblua5.2-0 php7.0 php-bcmath php7.0-bcmath ttf-dejavu-core php7.0-bcmath 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
dpkg -i --force-confmiss /var/cache/apt/archives/zabbix-server-mysql*
DEBIAN_FRONTEND=noninteractive apt-mark hold zabbix-server-mysql zabbix-frontend-php
ynh_replace_string --match_string="# fr_FR.UTF-8 UTF-8" --replace_string="fr_FR.UTF-8 UTF-8" --target_file=/etc/locale.gen
locale-gen

View file

@ -14,7 +14,8 @@ source /usr/share/yunohost/helpers
#=================================================
app=$YNH_APP_INSTANCE_NAME
trustedversion="1:4.2.4-1+stretch"
trustedversion="4.4-1+stretch"
forceupdate=0
export domain=$(ynh_app_setting_get "$app" domain)
export path_url=$(ynh_app_setting_get "$app" path)
#admin=$(ynh_app_setting_get "$app" admin) #not used
@ -118,6 +119,14 @@ if [ "$(dpkg -l zabbix-release 2>/dev/null | wc -l)" -ne 0 ];then
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
forceupdate=1
fi
fi
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
@ -127,20 +136,10 @@ ynh_remove_logrotate
ynh_print_info "Check if new zabbix version is available on repo"
ynh_package_update
zabbixServerInstalledVersion=$(apt-cache policy zabbix-server-mysql | sed -n '2p' | grep -Po ".*: \K(.*)")
zabbixServerCandidateVersion=$(apt-cache policy zabbix-server-mysql | sed -n '3p' | grep -Po ".*: \K(.*)")
zabbixReleaseInstalledVersion=$(apt-cache policy zabbix-release | sed -n '2p' | grep -Po ".* \K(.*)")
zabbixFrontendInstalledVersion=$(apt-cache policy zabbix-frontend-php | sed -n '2p' | grep -Po ".*: \K(.*)")
zabbixFrontendCandidateVersion=$(apt-cache policy zabbix-frontend-php | sed -n '3p' | grep -Po ".*: \K(.*)")
zabbixagentInstalledVersion=$(apt-cache policy zabbix-agent | sed -n '2p' | grep -Po ".*: \K(.*)")
zabbixagentCandidateVersion=$(apt-cache policy zabbix-agent | sed -n '3p' | grep -Po ".*: \K(.*)")
if [ "$trustedversion" == "$zabbixServerCandidateVersion" ]
if [[ "$trustedversion" > "$zabbixReleaseInstalledVersion" ]] || [[ "$forceupdate" == "1" ]]
then
if [ "$zabbixServerInstalledVersion" != "$zabbixServerCandidateVersion" ] || [ "$zabbixFrontendInstalledVersion" != "$zabbixFrontendCandidateVersion" ] || [ "$zabbixagentInstalledVersion" != "$zabbixagentCandidateVersion" ]
then
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
@ -149,21 +148,22 @@ then
ynh_backup_before_upgrade
ynh_clean_setup () {
# restore it if the upgrade fails
ynh_restore_upgradebackup
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
yunohost service stop zabbix-server
yunohost service stop zabbix-agent
cp -rp /etc/zabbix /tmp/
cp -p /usr/share/zabbix/conf/zabbix.conf.php /tmp/
DEBIAN_FRONTEND=noninteractive apt-mark unhold zabbix-server-mysql zabbix-frontend-php
ynh_package_remove zabbix-server-mysql zabbix-frontend-php
ynh_print_info "Update and install dependencies"
ynh_package_update
ynh_install_app_dependencies libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap liblua5.2-0 php7.0 php-bcmath php7.0-bcmath ttf-dejavu-core php7.0-bcmath 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
DEBIAN_FRONTEND=noninteractive apt-mark hold zabbix-server-mysql zabbix-frontend-php
ynh_print_info "Update zabbix via apt package"
ynh_install_app_dependencies libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap liblua5.2-0 ttf-dejavu-core php7.0-bcmath 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
rm /usr/share/zabbix/conf/zabbix.conf.php
cp -rpf /tmp/zabbix /etc/
@ -176,17 +176,17 @@ then
yunohost service add zabbix-server -d "Management Zabbix server daemon : Collect, agregate, compute and notify"
yunohost service add zabbix-agent -d "Management Zabbix agent daemon : send informations about this host to the server"
yunohost service start zabbix-server
yunohost service start zabbix-agent
#test if zabbix server is started
check_proc_zabbixagent
#test if zabbix agent is started
check_proc_zabbixserver
else
ynh_print_info "No update from repo ! (Already up to date)"
fi
else
ynh_print_info "No update from repo ! (Trusted version)"
ynh_print_info "No repo update ! (Trusted version)"
fi
#=================================================
@ -202,5 +202,6 @@ else
ynh_app_setting_set "$app" unprotected_uris "/"
fi
ynh_add_nginx_config
systemctl reload nginx
yunohost app ssowatconf