yalh76 пре 4 година
родитељ
комит
8c866e956d
5 измењених фајлова са 9 додато и 39 уклоњено
  1. 1 1
      manifest.json
  2. 3 14
      scripts/_common.sh
  3. 1 1
      scripts/install
  4. 1 2
      scripts/restore
  5. 3 21
      scripts/upgrade

+ 1 - 1
manifest.json

@@ -6,7 +6,7 @@
         "en": "Monitoring tool for diverse IT components, including networks, servers, VMs and cloud services",
         "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"
         "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",
     "url": "https://www.zabbix.com",
     "upstream": {
     "upstream": {
         "license": "GPL-2.0-or-later",
         "license": "GPL-2.0-or-later",

+ 3 - 14
scripts/_common.sh

@@ -11,7 +11,9 @@ else
     libsnmpd_version="libsnmp30"
     libsnmpd_version="libsnmp30"
 fi
 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"
 YNH_PHP_VERSION="7.3"
 
 
@@ -217,19 +219,6 @@ check_proc_zabbixagent () {
 	fi
 	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 installation
 #
 #
 remove_previous_zabbix () {
 remove_previous_zabbix () {

+ 1 - 1
scripts/install

@@ -61,8 +61,8 @@ ynh_app_setting_set --app=$app --key=language --value=$language
 #=================================================
 #=================================================
 ynh_script_progression --message="Installing dependencies..."
 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_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
 ynh_replace_string --match_string="# $language.UTF-8 UTF-8" --replace_string="$language.UTF-8 UTF-8" --target_file=/etc/locale.gen
 locale-gen
 locale-gen

+ 1 - 2
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..."
 ynh_script_progression --message="Reinstalling dependencies..."
 
 
-install_zabbix_repo
 # Define and install dependencies
 # Define and install dependencies
 ynh_exec_warn_less ynh_install_app_dependencies $pkg_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
 ynh_replace_string --match_string="# $language.UTF-8 UTF-8" --replace_string="$language.UTF-8 UTF-8" --target_file=/etc/locale.gen
 locale-gen
 locale-gen

+ 3 - 21
scripts/upgrade

@@ -89,23 +89,6 @@ fi
 
 
 export mysqlconn="mysql --user=$db_user --password=$db_pwd --database=$db_name"
 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
 # patch to remove old zabbix-client service
 if [ ! -z "$(yunohost service status | grep zabbix-client)" ]
 if [ ! -z "$(yunohost service status | grep zabbix-client)" ]
 then 
 then 
@@ -142,6 +125,8 @@ fi
 
 
 ln -s "/etc/zabbix/web/zabbix.conf.php" "/usr/share/zabbix/conf/zabbix.conf.php"
 ln -s "/etc/zabbix/web/zabbix.conf.php" "/usr/share/zabbix/conf/zabbix.conf.php"
 
 
+ynh_remove_extra_repo --name=zabbix
+
 #=================================================
 #=================================================
 # NGINX CONFIGURATION
 # NGINX CONFIGURATION
 #=================================================
 #=================================================
@@ -158,11 +143,8 @@ if [ "$upgrade_type" == "UPGRADE_APP" ]
 then
 then
 	ynh_script_progression --message="Upgrading dependencies..."
 	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
 	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
 fi
 
 
 #=================================================
 #=================================================