From fe75cb3940872d520938c2f9123db8257a210356 Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Tue, 24 Oct 2017 15:14:20 -0400 Subject: [PATCH] Make db port optional in update script Fixes #4323 --- Scripts/sql-update-3.0.0-to-combined-mysql.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Scripts/sql-update-3.0.0-to-combined-mysql.sh b/Scripts/sql-update-3.0.0-to-combined-mysql.sh index 7af9710b8..cd0d4e6c7 100755 --- a/Scripts/sql-update-3.0.0-to-combined-mysql.sh +++ b/Scripts/sql-update-3.0.0-to-combined-mysql.sh @@ -30,14 +30,15 @@ IFS=" " # Parse postgres connection string from OCSFolderInfoURL in sogo.conf set $(sogo-tool dump-defaults -f /etc/sogo/sogo.conf | awk -F\" '/ OCSFolderInfoURL =/ {print $2}' \ - | sed -n 's/\([^:]\+\):\/\/\([^:]\+\):\([^@]\+\)@\([^:]\+\):\([^/]\+\)\/\([^/]\+\)\/\([^/]\+\)/\1 \2 \3 \4 \5 \6 \7/p') + | sed -n 's/\([^:]\+\):\/\/\([^:]\+\):\([^@]\+\)@\([^:\/]\+\)\(:\([^/]\+\)\)\?\/\([^/]\+\)\/\([^/]\+\)/\1 \2 \3 \4 \7 \8 \6/p') + PROTOCOL=$1 USER=$2 PWD=$3 HOST=$4 -PORT=$5 -DB=$6 -TABLE=$7 +DB=$5 +TABLE=$6 +PORT=${7:-3306} if [ -z "$PROTOCOL" ] || [ -z "$USER" ] || [ -z "$HOST" ] || [ -z "$PORT" ] || [ -z "$DB" ] || [ -z "$TABLE" ]; then echo "ERROR: Failed to parse value of OCSFolderInfoURL in /etc/sogo/sogo.conf" 1>&2