From a7f5d759bf220017b0184b2abd9e787068611ecd Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Mon, 29 Oct 2018 10:48:25 -0400 Subject: [PATCH] Improve Debian packages wrt Apache2 configuration --- packaging/debian/control | 3 +-- packaging/debian/rules | 2 +- packaging/debian/sogo.install | 2 +- packaging/debian/sogo.postinst | 16 ++++++++++++++-- packaging/debian/sogo.prerm | 12 ++++++++++++ 5 files changed, 29 insertions(+), 6 deletions(-) diff --git a/packaging/debian/control b/packaging/debian/control index 4a4afa920..bc1a5d28a 100644 --- a/packaging/debian/control +++ b/packaging/debian/control @@ -9,8 +9,7 @@ Package: sogo Section: web Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends}, sope4.9-libxmlsaxdriver, sope4.9-db-connector, gnustep-make, libcurl3 | libcurl4, zip, liblasso3 (>= 2.3.5) -Recommends: memcached -Suggests: nginx +Recommends: memcached, apache2 | nginx | httpd Description: a modern and scalable groupware SOGo is a groupware server built around OpenGroupware.org (OGo) and the SOPE application server with focus on scalability. diff --git a/packaging/debian/rules b/packaging/debian/rules index 17f91a73e..cac430f48 100755 --- a/packaging/debian/rules +++ b/packaging/debian/rules @@ -80,7 +80,7 @@ install-arch: build-arch install -D -m 644 Scripts/sogo-default debian/tmp/etc/default/sogo install -D -m 644 debian/sogo.overrides debian/tmp/usr/share/lintian/overrides/sogo - install -D -m 644 Apache/SOGo.conf debian/tmp/etc/apache2/conf.d/SOGo.conf + install -D -m 644 Apache/SOGo.conf debian/tmp/etc/apache2/conf-available/SOGo.conf install -D -m 644 Scripts/sogo.cron debian/tmp/etc/cron.d/sogo install -D -m 644 Scripts/logrotate debian/tmp/etc/logrotate.d/sogo install -d -m 750 debian/tmp/etc/sogo diff --git a/packaging/debian/sogo.install b/packaging/debian/sogo.install index ba044b824..e6de0eda6 100644 --- a/packaging/debian/sogo.install +++ b/packaging/debian/sogo.install @@ -1,4 +1,4 @@ -etc/apache2/conf.d/SOGo.conf +etc/apache2/conf-available/SOGo.conf etc/cron.d/sogo etc/default/sogo etc/logrotate.d/sogo diff --git a/packaging/debian/sogo.postinst b/packaging/debian/sogo.postinst index ef530dfc4..cba01a26f 100644 --- a/packaging/debian/sogo.postinst +++ b/packaging/debian/sogo.postinst @@ -41,10 +41,22 @@ the packaging system. Please check the list of database schema upgrade scripts inside /usr/share/doc/sogo/ and apply them if needed. -More details can be found in the Upgrading section in -http://sogo.nu/files/docs/SOGo%20Installation%20Guide.pdf +More details can be found in the Upgrading section: +https://sogo.nu/files/docs/SOGoInstallationGuide.html#_upgrading EOF + + # Apache 2.2 / 2.4 kungfu + COMMON_STATE=$(dpkg-query -f '${Status}' -W 'apache2.2-common' 2>/dev/null | awk '{print $3}' || true) + + if [ -e /usr/share/apache2/apache2-maintscript-helper ] ; then + . /usr/share/apache2/apache2-maintscript-helper + apache2_invoke enconf SOGo || exit $? + elif [ "$COMMON_STATE" = "installed" ] || [ "$COMMON_STATE" = "unpacked" ] ; then + if [ -d /etc/apache2/conf.d/ -a ! -e /etc/apache2/conf.d/SOGo.conf ]; then + ln -s ../conf-available/SOGo.conf /etc/apache2/conf.d/SOGo.conf + fi + fi ;; abort-upgrade|abort-remove|abort-deconfigure) diff --git a/packaging/debian/sogo.prerm b/packaging/debian/sogo.prerm index 914a28b5e..35f46aa4a 100644 --- a/packaging/debian/sogo.prerm +++ b/packaging/debian/sogo.prerm @@ -13,5 +13,17 @@ set -e # for details, see /usr/share/doc/packaging-manual/ #DEBHELPER# +if [ "$1" = "deconfigure" ] ; then + # Apache 2.2 / 2.4 kungfu + COMMON_STATE=$(dpkg-query -f '${Status}' -W 'apache2.2-common' 2>/dev/null | awk '{print $3}' || true) + + if [ -e /usr/share/apache2/apache2-maintscript-helper ] ; then + . /usr/share/apache2/apache2-maintscript-helper + apache2_invoke disconf SOGo || exit $? + elif [ "$COMMON_STATE" = "installed" ] || [ "$COMMON_STATE" = "unpacked" ] ; then + [ ! -L /etc/apache2/conf.d/SOGo.conf ] || rm /etc/apache2/conf.d/SOGo.conf + fi + +fi exit 0