Wednesday, November 30, 2022

Re: some issues with sogo 5.7.1 in 7.2

On 2022/11/30 00:38, Giovanni Bechis wrote:
> SCRIPTS = cas-proxy-validate.py sql-update-2.2.17_to_2.3.0.sh \
> sql-update-3.2.10_to_4.0.0.sh sql-update-2.2.17_to_2.3.0-mysql.sh \
> sql-update-3.2.10_to_4.0.0-mysql.sh sql-update-3.0.0-to-combined.sh \
> - sql-update-3.0.0-to-combined-mysql.sh updates.php
> + sql-update-3.0.0-to-combined-mysql.sh sql-update-5.5.1_to_5.6.0.sh updates.php

I don't use sogo, but this doesn't seem the most sensible way to
handle the scripts. In most cases it's better to use wildcards
rather than try to maintain a list in the port Makefile, they nearly
always get out of sync sooner or later.

Also sql-update-5.5.1_to_5.6.0.sh has #!/bin/bash, this is patched
in *some* of the other sql-update scripts, and the pkg-readme tells
you to use bash in some cases but not others. It's very inconsistent.

How about installing all of Scripts/sql-update-*.sh and run them
through sed -i 's,#!/bin/bash,#!${LOCALBASE}/bin/bash,'? If some of the
old ones are not useful they could be @comment'ed to reduce mess, but
that seems an easier way of keeping track of new files.

Index: Makefile
===================================================================
RCS file: /cvs/ports/www/sogo/Makefile,v
retrieving revision 1.102
diff -u -p -r1.102 Makefile
--- Makefile 8 Nov 2022 11:17:20 -0000 1.102
+++ Makefile 30 Nov 2022 12:25:23 -0000
@@ -1,7 +1,7 @@
COMMENT = web based groupware server

VERSION = 5.7.1
-REVISION = 1
+REVISION = 2
DISTNAME = SOGo-${VERSION}
PKGNAME = sogo-${VERSION}

@@ -35,7 +35,8 @@ LIB_DEPENDS += archivers/libzip \
security/oath-toolkit \
www/sope>=${VERSION}
RUN_DEPENDS += sope-postgres-*|sope-mysql-*:www/sope,-postgres \
- archivers/zip
+ archivers/zip \
+ shells/bash

CONFIGURE_STYLE = simple dest
CONFIGURE_ARGS += --gsmake=`gnustep-config --variable=GNUSTEP_MAKEFILES` \
@@ -49,17 +50,14 @@ MAKE_FLAGS += libGDLContentStore_INTERF
SOGOLIBDIR = lib/GNUstep/Frameworks/SOGo.framework/Versions/${LIBSOGo_VERSION}
SUBST_VARS += SOGOLIBDIR VARBASE

-SCRIPTS = cas-proxy-validate.py sql-update-2.2.17_to_2.3.0.sh \
- sql-update-3.2.10_to_4.0.0.sh sql-update-2.2.17_to_2.3.0-mysql.sh \
- sql-update-3.2.10_to_4.0.0-mysql.sh sql-update-3.0.0-to-combined.sh \
- sql-update-3.0.0-to-combined-mysql.sh updates.php
-
post-install:
${INSTALL_DATA_DIR} ${PREFIX}/share/doc/sogo
-.for _s in ${SCRIPTS}
- ${INSTALL_SCRIPT} -c -o ${SHAREOWN} -g ${SHAREGRP} \
- ${WRKSRC}/Scripts/${_s} ${PREFIX}/share/doc/sogo/${_s}
-.endfor
+ cd ${WRKSRC}/Scripts; ${INSTALL_SCRIPT} \
+ -c -o ${SHAREOWN} -g ${SHAREGRP} \
+ cas-proxy-validate.py updates.php sql-update*.sh \
+ ${PREFIX}/share/doc/sogo/
+ sed -i 's,#!/bin/bash,#!${LOCALBASE}/bin/bash,' \
+ ${PREFIX}/share/doc/sogo/sql-update*.sh

do-test:
cd ${WRKSRC}/Tests/Integration && ${MAKE_PROGRAM} && ./teststrings.sh
Index: patches/patch-Scripts_sql-update-2_2_17_to_2_3_0-mysql_sh
===================================================================
RCS file: patches/patch-Scripts_sql-update-2_2_17_to_2_3_0-mysql_sh
diff -N patches/patch-Scripts_sql-update-2_2_17_to_2_3_0-mysql_sh
--- patches/patch-Scripts_sql-update-2_2_17_to_2_3_0-mysql_sh 11 Mar 2022 20:11:01 -0000 1.3
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,41 +0,0 @@
---- Scripts/sql-update-2.2.17_to_2.3.0-mysql.sh.orig Wed Sep 16 20:41:29 2015
-+++ Scripts/sql-update-2.2.17_to_2.3.0-mysql.sh Fri Oct 23 09:40:35 2015
-@@ -1,4 +1,4 @@
--#!/bin/bash
-+#!/bin/sh
-
- set -e
-
-@@ -11,15 +11,19 @@ set -e
- defaultusername=$USER
- defaulthostname=127.0.0.1
- defaultdatabase=$USER
--indextable=$(sogo-tool dump-defaults -f /etc/sogo/sogo.conf | awk -F\" '/ OCSFolderInfoURL =/ {print $2}' | awk -F/ '{print $NF}')
-+if [ -f /etc/sogo/sogo.conf ];then
-+ indextable=$(sogo-tool dump-defaults -f /etc/sogo/sogo.conf | awk -F\" '/ OCSFolderInfoURL =/ {print $2}' | awk -F/ '{print $NF}')
-+else
-+ indextable=$(sogo-tool dump-defaults | awk -F\" '/ OCSFolderInfoURL =/ {print $2}' | awk -F/ '{print $NF}')
-+fi
- if [ -z "$indextable" ]; then
- echo "Couldn't fetch OCSFolderInfoURL value, aborting" >&2
- exit 1
- fi
-
--read -p "Username ($defaultusername): " username
--read -p "Hostname ($defaulthostname): " hostname
--read -p "Database ($defaultdatabase): " database
-+read username?"Username ($defaultusername): "
-+read hostname?"Hostname ($defaulthostname): "
-+read database?"Database ($defaultdatabase): "
-
- if [ -z "$username" ]
- then
-@@ -38,7 +42,7 @@ then
-
- sqlscript=""
-
--function adjustSchema() {
-+adjustSchema() {
- oldIFS="$IFS"
- IFS=" "
- part1="`echo -e \"ALTER TABLE $table MODIFY c_partstates mediumtext;\\n\"`";
Index: patches/patch-Scripts_sql-update-2_2_17_to_2_3_0_sh
===================================================================
RCS file: patches/patch-Scripts_sql-update-2_2_17_to_2_3_0_sh
diff -N patches/patch-Scripts_sql-update-2_2_17_to_2_3_0_sh
--- patches/patch-Scripts_sql-update-2_2_17_to_2_3_0_sh 11 Mar 2022 20:11:01 -0000 1.3
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,41 +0,0 @@
---- Scripts/sql-update-2.2.17_to_2.3.0.sh.orig Wed Sep 16 20:41:29 2015
-+++ Scripts/sql-update-2.2.17_to_2.3.0.sh Fri Oct 23 09:40:24 2015
-@@ -1,4 +1,4 @@
--#!/bin/bash
-+#!/bin/sh
-
- set -e
- # This script only works with PostgreSQL
-@@ -11,15 +11,19 @@ defaultusername=$USER
- defaulthostname=localhost
- defaultdatabase=$USER
- #indextable=sogo_folder_info
--indextable=$(sogo-tool dump-defaults -f /etc/sogo/sogo.conf | awk -F\" '/ OCSFolderInfoURL =/ {print $2}' | awk -F/ '{print $NF}')
-+if [ -f /etc/sogo/sogo.conf ];then
-+ indextable=$(sogo-tool dump-defaults -f /etc/sogo/sogo.conf | awk -F\" '/ OCSFolderInfoURL =/ {print $2}' | awk -F/ '{print $NF}')
-+else
-+ indextable=$(sogo-tool dump-defaults | awk -F\" '/ OCSFolderInfoURL =/ {print $2}' | awk -F/ '{print $NF}')
-+fi
- if [ -z "$indextable" ]; then
- echo "Couldn't fetch OCSFolderInfoURL value, aborting" >&2
- exit 1
- fi
-
--read -p "Username ($defaultusername): " username
--read -p "Hostname ($defaulthostname): " hostname
--read -p "Database ($defaultdatabase): " database
-+read username?"Username ($defaultusername): "
-+read hostname?"Hostname ($defaulthostname): "
-+read database?"Database ($defaultdatabase): "
-
- if [ -z "$username" ]
- then
-@@ -36,7 +40,7 @@ fi
-
- sqlscript=""
-
--function adjustSchema() {
-+adjustSchema() {
- oldIFS="$IFS"
- IFS=" "
- part1="`echo -e \"ALTER TABLE $table ALTER COLUMN c_partstates TYPE TEXT;\\n\"`";
Index: patches/patch-Scripts_sql-update-3_2_10_to_4_0_0-mysql_sh
===================================================================
RCS file: patches/patch-Scripts_sql-update-3_2_10_to_4_0_0-mysql_sh
diff -N patches/patch-Scripts_sql-update-3_2_10_to_4_0_0-mysql_sh
--- patches/patch-Scripts_sql-update-3_2_10_to_4_0_0-mysql_sh 11 Mar 2022 20:11:01 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,66 +0,0 @@
-Index: Scripts/sql-update-3.2.10_to_4.0.0-mysql.sh
---- Scripts/sql-update-3.2.10_to_4.0.0-mysql.sh.orig
-+++ Scripts/sql-update-3.2.10_to_4.0.0-mysql.sh
-@@ -1,4 +1,4 @@
--#!/bin/bash
-+#!/bin/sh
-
- set -e
-
-@@ -12,16 +12,24 @@ set -e
- defaultusername=$USER
- defaulthostname=127.0.0.1
- defaultdatabase=sogo
--indextable=$(sogo-tool dump-defaults -f /etc/sogo/sogo.conf | awk -F\" '/ OCSFolderInfoURL =/ {print $2}' | awk -F/ '{print $NF}')
-+if [ -f /etc/sogo/sogo.conf ];then
-+ indextable=$(sogo-tool dump-defaults -f /etc/sogo/sogo.conf | awk -F\" '/ OCSFolderInfoURL =/ {print $2}' | awk -F/ '{print $NF}')
-+else
-+ indextable=$(sogo-tool dump-defaults | awk -F\" '/ OCSFolderInfoURL =/ {print $2}' | awk -F/ '{print $NF}')
-+fi
- if [ -z "$indextable" ]; then
- echo "Couldn't fetch OCSFolderInfoURL value, aborting" >&2
- exit 1
- fi
--storeurl=$(sogo-tool dump-defaults -f /etc/sogo/sogo.conf | awk -F\" '/ OCSStoreURL =/ {print $2}' | awk -F/ '{print $NF}')
-+if [ -f /etc/sogo/sogo.conf ];then
-+ storeurl=$(sogo-tool dump-defaults -f /etc/sogo/sogo.conf | awk -F\" '/ OCSStoreURL =/ {print $2}' | awk -F/ '{print $NF}')
-+else
-+ storeurl=$(sogo-tool dump-defaults | awk -F\" '/ OCSStoreURL =/ {print $2}' | awk -F/ '{print $NF}')
-+fi
-
--read -p "Username ($defaultusername): " username
--read -p "Hostname ($defaulthostname): " hostname
--read -p "Database ($defaultdatabase): " database
-+read username?"Username ($defaultusername): "
-+read hostname?"Hostname ($defaulthostname): "
-+read database?"Database ($defaultdatabase): "
-
- if [ -z "$username" ]
- then
-@@ -40,7 +48,7 @@ fi
-
- sqlscript=""
-
--function growUserProfile() {
-+growUserProfile() {
- oldIFS="$IFS"
- IFS=" "
- part="`echo -e \"ALTER TABLE sogo_user_profile MODIFY c_defaults LONGTEXT;\\n\"`";
-@@ -50,7 +58,7 @@ function growUserProfile() {
- IFS="$oldIFS"
- }
-
--function growMailInContactsQuick() {
-+growMailInContactsQuick() {
- oldIFS="$IFS"
- IFS=" "
- part="`echo -e \"ALTER TABLE $table MODIFY c_mail text;\\n\"`";
-@@ -58,7 +66,7 @@ function growMailInContactsQuick() {
- IFS="$oldIFS"
- }
-
--function addCertificateInContactsQuick() {
-+addCertificateInContactsQuick() {
- oldIFS="$IFS"
- IFS=" "
- part="`echo -e \"ALTER TABLE $table ADD c_hascertificate INT4 DEFAULT 0;\\n\"`";
Index: patches/patch-Scripts_sql-update-3_2_10_to_4_0_0_sh
===================================================================
RCS file: patches/patch-Scripts_sql-update-3_2_10_to_4_0_0_sh
diff -N patches/patch-Scripts_sql-update-3_2_10_to_4_0_0_sh
--- patches/patch-Scripts_sql-update-3_2_10_to_4_0_0_sh 11 Mar 2022 20:11:01 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,57 +0,0 @@
-Index: Scripts/sql-update-3.2.10_to_4.0.0.sh
---- Scripts/sql-update-3.2.10_to_4.0.0.sh.orig
-+++ Scripts/sql-update-3.2.10_to_4.0.0.sh
-@@ -1,4 +1,4 @@
--#!/bin/bash
-+#!/bin/sh
-
- set -e
-
-@@ -10,16 +10,24 @@ set -e
- defaultusername=$USER
- defaulthostname=localhost
- defaultdatabase=sogo
--indextable=$(sogo-tool dump-defaults -f /etc/sogo/sogo.conf | awk -F\" '/ OCSFolderInfoURL =/ {print $2}' | awk -F/ '{print $NF}')
-+if [ -f /etc/sogo/sogo.conf ];then
-+ indextable=$(sogo-tool dump-defaults -f /etc/sogo/sogo.conf | awk -F\" '/ OCSFolderInfoURL =/ {print $2}' | awk -F/ '{print $NF}')
-+else
-+ indextable=$(sogo-tool dump-defaults | awk -F\" '/ OCSFolderInfoURL =/ {print $2}' | awk -F/ '{print $NF}')
-+fi
- if [ -z "$indextable" ]; then
- echo "Couldn't fetch OCSFolderInfoURL value, aborting" >&2
- exit 1
- fi
--storeurl=$(sogo-tool dump-defaults -f /etc/sogo/sogo.conf | awk -F\" '/ OCSStoreURL =/ {print $2}' | awk -F/ '{print $NF}')
-+if [ -f /etc/sogo/sogo.conf ];then
-+ storeurl=$(sogo-tool dump-defaults -f /etc/sogo/sogo.conf | awk -F\" '/ OCSStoreURL =/ {print $2}' | awk -F/ '{print $NF}')
-+else
-+ storeurl=$(sogo-tool dump-defaults | awk -F\" '/ OCSStoreURL =/ {print $2}' | awk -F/ '{print $NF}')
-+fi
-
--read -p "Username ($defaultusername): " username
--read -p "Hostname ($defaulthostname): " hostname
--read -p "Database ($defaultdatabase): " database
-+read username?"Username ($defaultusername): "
-+read hostname?"Hostname ($defaulthostname): "
-+read database?"Database ($defaultdatabase): "
-
- if [ -z "$username" ]
- then
-@@ -36,7 +44,7 @@ fi
-
- sqlscript=""
-
--function growMailInContactsQuick() {
-+growMailInContactsQuick() {
- oldIFS="$IFS"
- IFS=" "
- part="`echo -e \"ALTER TABLE $table ALTER COLUMN c_mail TYPE TEXT;\\n\"`";
-@@ -44,7 +52,7 @@ function growMailInContactsQuick() {
- IFS="$oldIFS"
- }
-
--function addCertificateInContactsQuick() {
-+addCertificateInContactsQuick() {
- oldIFS="$IFS"
- IFS=" "
- part="`echo -e \"ALTER TABLE $table ADD c_hascertificate INT4 DEFAULT 0;\\n\"`";
Index: pkg/PLIST
===================================================================
RCS file: /cvs/ports/www/sogo/pkg/PLIST,v
retrieving revision 1.54
diff -u -p -r1.54 PLIST
--- pkg/PLIST 8 Nov 2022 11:17:20 -0000 1.54
+++ pkg/PLIST 30 Nov 2022 12:25:23 -0000
@@ -2869,12 +2869,26 @@ lib/sogo/
share/doc/pkg-readmes/${PKGSTEM}
share/doc/sogo/
share/doc/sogo/cas-proxy-validate.py
+share/doc/sogo/sql-update-1.2.2_to_1.3.0-mysql.sh
+share/doc/sogo/sql-update-1.2.2_to_1.3.0.sh
+share/doc/sogo/sql-update-1.3.11_to_1.3.12-mysql.sh
+share/doc/sogo/sql-update-1.3.11_to_1.3.12.sh
+share/doc/sogo/sql-update-1.3.16_to_1.3.17-mysql.sh
+share/doc/sogo/sql-update-1.3.16_to_1.3.17.sh
+share/doc/sogo/sql-update-1.3.3_to_1.3.4-mysql.sh
+share/doc/sogo/sql-update-1.3.3_to_1.3.4.sh
+share/doc/sogo/sql-update-101_to_102.sh
+share/doc/sogo/sql-update-2.0.4b_to_2.0.5-mysql.sh
share/doc/sogo/sql-update-2.2.17_to_2.3.0-mysql.sh
share/doc/sogo/sql-update-2.2.17_to_2.3.0.sh
+share/doc/sogo/sql-update-20070724.sh
+share/doc/sogo/sql-update-20070822.sh
+share/doc/sogo/sql-update-20080303.sh
share/doc/sogo/sql-update-3.0.0-to-combined-mysql.sh
share/doc/sogo/sql-update-3.0.0-to-combined.sh
share/doc/sogo/sql-update-3.2.10_to_4.0.0-mysql.sh
share/doc/sogo/sql-update-3.2.10_to_4.0.0.sh
+share/doc/sogo/sql-update-5.5.1_to_5.6.0.sh
share/doc/sogo/updates.php
share/examples/login.conf.d/sogod
@sample ${SYSCONFDIR}/login.conf.d/sogod
Index: pkg/README
===================================================================
RCS file: /cvs/ports/www/sogo/pkg/README,v
retrieving revision 1.25
diff -u -p -r1.25 README
--- pkg/README 19 Sep 2022 07:01:08 -0000 1.25
+++ pkg/README 30 Nov 2022 12:25:23 -0000
@@ -109,8 +109,8 @@ server {
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
- proxy_buffer_size 4k;
- proxy_buffers 4 32k;
+ proxy_buffer_size 64k;
+ proxy_buffers 8 64k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
client_max_body_size 50m;
@@ -221,8 +221,9 @@ Upgrade SOGo from < 2.3.0
==========================
With version 2.3.0, the database schema needs to be extended.

-Run one of the following scripts as the SOGo system user _sogo. Choose the
-script based on your database backend. The scripts will ask you for the database credentials.
+Run one of the following scripts as the SOGo system user _sogo.
+Choose the script based on your database backend.
+The scripts will ask you for the database credentials.

# su _sogo "${TRUEPREFIX}/share/doc/sogo/sql-update-2.2.17_to_2.3.0.sh"
# su _sogo "${TRUEPREFIX}/share/doc/sogo/sql-update-2.2.17_to_2.3.0-mysql.sh"
@@ -232,19 +233,19 @@ Upgrade SOGo from < 3.0.0
With version 3.X you can update the database schema to the optional
9-table model. The conversion is not required, and you should only do it
when you are sure you know what you are doing.
-The scripts require you have configured sogo via /etc/sogo/sogo.conf,
-as well as they have to run with bash. You might install bash manually.
+The scripts require you have configured sogo via /etc/sogo/sogo.conf.
Use at your own risk.

-# su _sogo "${TRUEPREFIX}/bin/bash ${TRUEPREFIX}/share/doc/sogo/sql-update-3.0.0-to-combined.sh"
-# su _sogo "${TRUEPREFIX}/bin/bash ${TRUEPREFIX}/share/doc/sogo/sql-update-3.0.0-to-combined-mysql.sh"
+# su _sogo "${TRUEPREFIX}/share/doc/sogo/sql-update-3.0.0-to-combined.sh"
+# su _sogo "${TRUEPREFIX}/share/doc/sogo/sql-update-3.0.0-to-combined-mysql.sh"

Upgrade SOGo from < 4.0.0
=========================
Updating SOGo from version 3.X to 4.X requires an update of the database schema.

-Run one of the following scripts as the SOGo system user _sogo. Choose the
-based on your database backend. The scripts will ask you for the database credentials.
+Run one of the following scripts as the SOGo system user _sogo.
+Choose the script based on your database backend.
+The scripts will ask you for the database credentials.

# su _sogo "${TRUEPREFIX}/share/doc/sogo/sql-update-3.2.10_to_4.0.0.sh"
# su _sogo "${TRUEPREFIX}/share/doc/sogo/sql-update-3.2.10_to_4.0.0-mysql.sh"

No comments:

Post a Comment