On Sat, 01 Sep 2012 19:26:54 +0200, Salvatore Bonaccorso wrote:

>  1/ remove the file as conffile
> 
>  2/ In case the file does not yet exist generate the file as shiped
>     in the package.
> 
>  3/ If and only if dbc_install is set to true, then do the substitutions
>     on the configuration file as previously done.
> 
>  4/ If the update is from version <= 3.3.7-7.1 then it also needs to
>      substitute smarty_dir variable setting with
> 
>      smarty_dir              = "/usr/share/php/smarty3/"
> 
> But this needs also to handle the case then when the package is
> purged.

... and the problem is that half of the variables are not
automatically managed, and the other one not by plain debconf but by
dbconfig-common.

dbconfig-common's feature to generate include files would be nice to
use, but I have no idea how to include something in an ini-style file
...
(Actually, /etc/dbconfig-common/phpgacl.conf would already be usable.
Which is also not purged ...)

And it also doesn't help for the changed smarty_dir var ...


A workaround for this bug would be to change smarty_dir not in the
shipped conffile but to replace it in the postinst. While that would
make piuparts happy, the whole situation is quite messy ...

And I'm not sure it's enough because the replacing in the postinst
changes whitespace, although this could be fixed with a little perl:

#v+
diff -u phpgacl-3.3.7/debian/phpgacl.postinst 
phpgacl-3.3.7/debian/phpgacl.postinst
--- phpgacl-3.3.7/debian/phpgacl.postinst
+++ phpgacl-3.3.7/debian/phpgacl.postinst
@@ -33,14 +33,13 @@
                 dbc_dbtype="postgres"
             fi
 
-            cat $CONF | \
-                sed -e "s/^db_type.*/db_type = \"$dbc_dbtype\"/" |\
-                sed -e "s/^db_name.*/db_name = \"$dbc_dbname\"/" |\
-                sed -e "s/^db_host.*/db_host = \"$dbc_dbserver\"/" |\
-                sed -e "s/^db_user.*/db_user = \"$dbc_dbuser\"/" |\
-                sed -e "s/^db_password.*/db_password = \"$dbc_dbpass\"/" \
-                > $TMPFILE
-
+            perl -pi -e " \
+                s/^db_type(?<space>\s+)=.+$/db_type$+{space}= 
\"$dbc_dbtype\"/; \
+                s/^db_name(?<space>\s+)=.+$/db_name$+{space}= 
\"$dbc_dbname\"/; \
+                s/^db_host(?<space>\s+)=.+$/db_host$+{space}= 
\"$dbc_dbserver\"/; \
+                s/^db_user(?<space>\s+)=.+$/db_user$+{space}= 
\"$dbc_dbuser\"/; \
+                s/^db_password(?<space>\s+)=.+$/db_password$+{space}= 
\"$dbc_dbpass\"/; \
+            " $TMPFILE
#v-


Cheers,
gregor

-- 
 .''`.  Homepage: http://info.comodo.priv.at/ - OpenPGP key 0xBB3A68018649AA06
 : :' : Debian GNU/Linux user, admin, and developer  -  http://www.debian.org/
 `. `'  Member of VIBE!AT & SPI, fellow of the Free Software Foundation Europe
   `-   NP: Featuring The Dubliners, The Fureys And Davey Arthur Etc.: Night 
Ferry, The Fureys And Da

Attachment: signature.asc
Description: Digital signature

Reply via email to