Pārlūkot izejas kodu

Fix issue with Debian 10 and exim update

Jaap Marcus 2 gadi atpakaļ
vecāks
revīzija
028d136602

+ 1 - 1
bin/v-update-sys-ip

@@ -46,7 +46,7 @@ if [ -z "$physical_nics" ]; then
 fi
 
 for nic in $physical_nics; do
-	nic_ipv4s="$(ip -4 -d -j addr show "$nic" | jq -r '.[].addr_info[] | if .scope == "global" then .local else empty end')"
+	nic_ipv4s="$(ip -4 -d -j addr show "$nic" | jq -r '.[] | select(length > 0) | .addr_info[] | if .scope == "global" then .local else empty end');"
 	if [ -z "$ips" ]; then
 		ips="$nic_ipv4s"
 	else

+ 1 - 1
install/upgrade/patch/3661-exim-srs-support.patch

@@ -1,5 +1,5 @@
 17a18,19
-> SRS_SECRET = readfile{/etc/exim4/srs.conf}
+> SRS_SECRET = ${readfile{/etc/exim4/srs.conf}}
 >   
 326a332,348
 > inbound_srs:

+ 12 - 2
install/upgrade/versions/1.8.0.sh

@@ -257,8 +257,18 @@ if [ "$MAIL_SYSTEM" = "exim4" ]; then
 			echo $srs > /etc/exim4/srs.conf
 			chmod 640 /etc/exim4/srs.conf
 			chown root:Debian-exim /etc/exim4/srs.conf
-			echo "[ * ] Update exim4.conf.template ..."
-			patch /etc/exim4/exim4.conf.template $HESTIA/install/upgrade/patch/3661-exim-srs-support.patch
+			cp /etc/exim4/exim4.conf.template /etc/exim4/exim4.conf.template.staging
+			patch /etc/exim4/exim4.conf.template.staging $HESTIA/install/upgrade/patch/3661-exim-srs-support.patch
+			exim -C /etc/exim4/exim4.conf.template.staging
+			if [ "$?" -ne 0 ]; then
+				#add_upgrade_message "Unable to successfully aply the SRS update patch for Exim.\n If you use SMTP relay with the SRS feature use the exim config found in /usr/local/hestia/install/deb/exim/exim4.conf.4.95.template"
+				"$BIN"/v-add-user-notification admin "Unable to apply patch to Exim config" 'Unable to successfully aply the SRS update patch for Exim.<br /> If you use SMTP relay with the SRS feature use the exim config found in /usr/local/hestia/install/deb/exim/exim4.conf.4.95.template'
+				sed -i "s/""$(grep -m 1 "Unable to apply patch to Exim config" "$HESTIA"/data/users/admin/notifications.conf | awk '{print $1}')""/NID='1'/" "$HESTIA"/data/users/admin/notifications.conf
+			else
+				echo "[ * ] Update exim4.conf.template ..."
+				cp /etc/exim4/exim4.conf.template.staging /etc/exim4/exim4.conf.template
+			fi
+			rm /etc/exim4/exim4.conf.template.staging
 		else
 			sed -i "s/SRS_SECRET = readfile{\/etc\/exim4\/srs.conf}/SRS_SECRET = \${readfile{\/etc\/exim4\/srs.conf}}/g" /etc/exim4/exim4.conf.template
 			chown root:Debian-exim /etc/exim4/srs.conf

+ 34 - 0
install/upgrade/versions/1.8.1.sh

@@ -0,0 +1,34 @@
+#!/bin/bash
+
+# Hestia Control Panel upgrade script for target version 1.8.0
+
+#######################################################################################
+#######                      Place additional commands below.                   #######
+#######################################################################################
+####### upgrade_config_set_value only accepts true or false.                    #######
+#######                                                                         #######
+####### Pass through information to the end user in case of a issue or problem  #######
+#######                                                                         #######
+####### Use add_upgrade_message "My message here" to include a message          #######
+####### in the upgrade notification email. Example:                             #######
+#######                                                                         #######
+####### add_upgrade_message "My message here"                                   #######
+#######                                                                         #######
+####### You can use \n within the string to create new lines.                   #######
+#######################################################################################
+
+upgrade_config_set_value 'UPGRADE_UPDATE_WEB_TEMPLATES' 'true'
+upgrade_config_set_value 'UPGRADE_UPDATE_DNS_TEMPLATES' 'false'
+upgrade_config_set_value 'UPGRADE_UPDATE_MAIL_TEMPLATES' 'true'
+upgrade_config_set_value 'UPGRADE_REBUILD_USERS' 'true'
+upgrade_config_set_value 'UPGRADE_UPDATE_FILEMANAGER_CONFIG' 'false'
+
+if [ "$MAIL_SYSTEM" = "exim4" ]; then
+	exim_version=$(exim4 --version | head -1 | awk '{print $3}' | cut -f -2 -d .)
+	# if Exim version > 4.95 or greater!
+	if version_ge "$exim_version" "4.95"; then
+		sed -i "s/SRS_SECRET = readfile{\/etc\/exim4\/srs.conf}/SRS_SECRET = \${readfile{\/etc\/exim4\/srs.conf}}/g" /etc/exim4/exim4.conf.template
+		chown root:Debian-exim /etc/exim4/srs.conf
+		chown 644 /etc/exim4/srs.conf
+	fi
+fi

+ 2 - 2
src/deb/nginx/hestia

@@ -39,10 +39,10 @@ adapt_nginx_config() {
 	fi
 	for nic in $physical_nics; do
 		if [ -z "$ipv4_scope_global" ]; then
-			ipv4_scope_global="$(ip -4 -d -j addr show "$nic" | jq -r '.[].addr_info[] | if .scope == "global" then .local else empty end')"
+			ipv4_scope_global="$(ip -4 -d -j addr show "$nic" | jq -r '.[] | select(length > 0) | .addr_info[] | if .scope == "global" then .local else empty end');"
 		fi
 		if [ -z "$ipv6_scope_global" ]; then
-			ipv6_scope_global="$(ip -6 -d -j addr show "$nic" | jq -r '.[].addr_info[] | if .scope == "global" then .local else empty end')"
+			ipv6_scope_global="$(ip -6 -d -j addr show "$nic" | jq -r '.[] | select(length > 0) | .addr_info[] | if .scope == "global" then .local else empty end');"
 		fi
 	done