Bug#821484: freedombox-setup: PHP 7.0 Transition

2016-05-12 Thread James Valleroy
On Wed, 11 May 2016 20:20:05 +0530 Sunil Mohan Adapa 
wrote:
> Attached is patch I prepared as discussed. This patch to the postinst
> script will disable php5 and enable php7.0 module. This rule is applied
> when upgrading from version less than or equal to 0.9. It is not
> applied when doing a fresh install.

I've applied this patch.



signature.asc
Description: OpenPGP digital signature


Bug#821484: freedombox-setup: PHP 7.0 Transition

2016-05-11 Thread Sunil Mohan Adapa
Attached is patch I prepared as discussed.  This patch to the postinst
script will disable php5 and enable php7.0 module.  This rule is applied
when upgrading from version less than or equal to 0.9.  It is not
applied when doing a fresh install.

I believe that after applying this patch, we need to make a new release
0.9.1 to fix the php migration issue.

I have tested as follows: I have taken a fresh 0.7.2 image and upgraded
to latest sid.  I can see that php7 is not installed.  Then after
installing the deb package with this patch included, php7 got installed
and freedombox has successfully switch the enabled version of php to
php7.  I have tested shaarli, tt-rss (reported #824029), roundcube
(needs update to 1.2beta for php7 support).

-- 
Sunil
From 619a2c55e56a65b87e9f006cc7e3385e52d0d3c3 Mon Sep 17 00:00:00 2001
From: Sunil Mohan Adapa 
Date: Wed, 11 May 2016 14:14:45 +0530
Subject: [PATCH] When upgrading from < 0.9 enable php7

When upgrading from a version less then 0.9 and if php5 is enabled (not
disabled by user for any reason) then disable php5 and enable php7.0
module (php7.0 conflicts with php5).

Hack around the problem that apache maintainer scripts don't allow
disabling a module during postinst configure phase.
---
 debian/freedombox-setup.postinst | 19 +++
 1 file changed, 19 insertions(+)

diff --git a/debian/freedombox-setup.postinst b/debian/freedombox-setup.postinst
index 5351b6e..533824d 100644
--- a/debian/freedombox-setup.postinst
+++ b/debian/freedombox-setup.postinst
@@ -20,6 +20,25 @@ if dpkg --compare-versions "$2" le "0.0.23" &&
 rmdir /var/freedombox
 fi
 
+# Enable php7.0 Apache module when upgrading from olders version to
+# 0.9.1 or above
+if [ -e /usr/share/apache2/apache2-maintscript-helper ] ; then
+. /usr/share/apache2/apache2-maintscript-helper
+
+if dpkg --compare-versions "$2" le-nl "0.9" ; then
+if apache2_has_module php5 ; then
+# XXX: Hack around maintainer script refusing to disable a
+# module during configure
+method="$APACHE2_MAINTSCRIPT_METHOD"
+APACHE2_MAINTSCRIPT_METHOD="remove"
+apache2_invoke dismod php5
+APACHE2_MAINTSCRIPT_METHOD="$method"
+
+apache2_invoke enmod php7.0
+fi
+fi
+fi
+
 # Setup motd
 if [ "$1" = "configure" ] && [ -f /etc/motd ] && [ ! -L /etc/motd ] ; then
 mkdir -p /etc/update-motd.d
-- 
2.8.1



signature.asc
Description: OpenPGP digital signature