Hi, I have fixed the postinst permission issue, the postrm aolserver call and now the local config modifications are authoritative and debconf values are overwritten with them at the beginning of the config script.
debdiff between testing version (2.5.0+dfsg6) and this new one (2.5.0 +dfsg-6+wheezy3) is attached. I have chosen to send the debdiff before asking for upload to t-p-u this time, so I don't have to bother my sponsor. I guess it's better for all, but please let me know if I am wrong. Once the changes are accepted, i will ask him for upload to t-p-u and notify here afterwards. Thanks again for your time and sorry for any inconvenience. Kind regards, Héctor
diff -u dotlrn-2.5.0+dfsg/debian/control dotlrn-2.5.0+dfsg/debian/control --- dotlrn-2.5.0+dfsg/debian/control +++ dotlrn-2.5.0+dfsg/debian/control @@ -14,7 +14,7 @@ Architecture: all Depends: ${misc:Depends}, aolserver4-daemon (>= 4.5.1-11), aolserver4-nspostgres, aolserver4-nssha1, postgresql-client, adduser, tclthread (>= 1:2.6.5-3), tcllib, tcl (>= 8.4), wwwconfig-common, debconf, xotcl, - aolserver4-xotcl, imagemagick, zip, unzip, tdom (>= 0.8.3~20080525) + aolserver4-xotcl, imagemagick, zip, unzip, tdom (>= 0.8.3~20080525), ucf Suggests: postgresql, daemontools, daemontools-run Description: e-learning portal system based on OpenACS dotLRN is a complete Learning Management System that integrates course diff -u dotlrn-2.5.0+dfsg/debian/changelog dotlrn-2.5.0+dfsg/debian/changelog --- dotlrn-2.5.0+dfsg/debian/changelog +++ dotlrn-2.5.0+dfsg/debian/changelog @@ -1,3 +1,29 @@ +dotlrn (2.5.0+dfsg-6+wheezy3) testing-proposed-updates; urgency=low + + * Fixed aolserver restart call in postrm. + * Fixed config.local permissions in postinst. + * Importing old config.tcl or config.local database settings. + + -- Hector Romojaro <hromoj...@dia.uned.es> Thu, 25 Oct 2012 14:07:09 +0200 + +dotlrn (2.5.0+dfsg-6+wheezy2) testing-proposed-updates; urgency=low + + * Fixed local config management. Closes: #688435 + - Updated README.Debian + - Autogenerated config.local file with database + local settings. + - Added dotlrn.preinst file with a fix for old + postinst modified config.tcl. + + -- Hector Romojaro <hromoj...@dia.uned.es> Sat, 29 Sep 2012 01:12:07 +0200 + +dotlrn (2.5.0+dfsg-6+wheezy1) testing-proposed-updates; urgency=low + + * Fixed call to ucf on postrm. (#677060). For details about why this + is fixed at testing-proposed-updates, please see #681016. + + -- Hector Romojaro <hromoj...@dia.uned.es> Wed, 22 Aug 2012 13:45:03 +0200 + dotlrn (2.5.0+dfsg-6) unstable; urgency=low * Updated Dutch translation. Closes: #660229 diff -u dotlrn-2.5.0+dfsg/debian/postinst dotlrn-2.5.0+dfsg/debian/postinst --- dotlrn-2.5.0+dfsg/debian/postinst +++ dotlrn-2.5.0+dfsg/debian/postinst @@ -60,8 +60,6 @@ # Read debconf and edit the config file accordingly get_config - db_stop - exec 0<&1 # Care about the repository repository=/var/lib/dotlrn @@ -151,10 +149,32 @@ /etc/init.d/postgresql reload fi fi - # Modify config.tcl with debconf values - dbuser=$dbu_name - dbpass=$dbu_password - sed -i "/^ set db_host/,/^ set db_user/d;s/## Debconf changes (DO NOT EDIT BYHAND) ##/&\n set db_host $dbserver\n set db_password \"$dbpass\"\n set db_port \"5432\"\n set db_user $dbuser/" /etc/dotlrn/config.tcl + + # Create /etc/dotlrn/config.local file with debconf + # values, and manage with ucf. + # Create file + localconfigtmp=$(mktemp) + localconfig="/etc/dotlrn/config.local" + cat > $localconfigtmp <<EOF +# Local dotLRN database settings. +db_host=${dbserver} +db_password=${dbu_password} +db_port=5432 +db_user=${dbu_name} +EOF + # Install file + if [ -d /etc/dotlrn -a -f $localconfigtmp ]; then + previous_localconfig=false + if [ -f $localconfig ]; then previous_localconfig=true; fi + ucf --debconf-ok $localconfigtmp $localconfig || cp -f $localconfigtmp $localconfig + ucfr dotlrn $localconfig + # Set permissions only if there is no previous config.local file. + if ! $previous_localconfig; then + chmod 640 $localconfig + chown root:www-data $localconfig + fi + rm -f $localconfigtmp + fi # Install plpgsql on database and enable compatibility options dbuser=$dba_name @@ -205,6 +225,8 @@ #DEBHELPER# +db_stop + exit 0 diff -u dotlrn-2.5.0+dfsg/debian/config dotlrn-2.5.0+dfsg/debian/config --- dotlrn-2.5.0+dfsg/debian/config +++ dotlrn-2.5.0+dfsg/debian/config @@ -6,6 +6,31 @@ db_version 2.0 db_capb backup +# Manage old configuration. +if [ -f /etc/dotlrn/config.tcl.old_version ] || [ -f /etc/dotlrn/config.local ]; then + + # Previous or equal to 2.5.0+dfsg-6+wheezy1 + if [ -f /etc/dotlrn/config.tcl.old_version ]; then + old_configfile=$(mktemp) + # Retrieve old values + sed -n '/## Debconf changes/,/## End Debconf/p;' /etc/dotlrn/config.tcl.old_version | sed 's/^[ \t]*set\ //;/^\#/d;s/db_host/db_host=/;s/db_password/db_password=/;s/db_user/db_user=/;s/=[ \t]*/=/;' > $old_configfile + fi + + # After 2.5.0+dfsg-6+wheezy1 + if [ -f /etc/dotlrn/config.local ]; then + old_configfile=/etc/dotlrn/config.local + fi + + # Feed debconf with them + db_set dotlrn/db_host $(grep "^db_host" $old_configfile | sed s/^db_host=//) + db_set dotlrn/dbu_name $(grep "^db_user" $old_configfile | sed s/^db_user=//) + db_set dotlrn/dbu_password "$(grep "^db_password" $old_configfile | sed 's/^db_password=//;s/\"//g')" + db_set dotlrn/dbu_confirm "$(grep "^db_password" $old_configfile | sed 's/^db_password=//;s/\"//g')" + + # Delete old files if needed + if [ -f /etc/dotlrn/config.tcl.old_version ]; then rm -f /etc/dotlrn/config.tcl.old_version $old_configfile; fi +fi + # Reset passwords if reconfigure if [ "$1" = "reconfigure" ] ; then db_reset dotlrn/dba_password diff -u dotlrn-2.5.0+dfsg/debian/README.Debian dotlrn-2.5.0+dfsg/debian/README.Debian --- dotlrn-2.5.0+dfsg/debian/README.Debian +++ dotlrn-2.5.0+dfsg/debian/README.Debian @@ -29,6 +29,8 @@ The address and port that dotLRN will listen on can be configured in /etc/aolserver4/conf.d/dotlrn.sh. +Local database settings can be found in /etc/dotlrn/config.local. + - Grant dotLRN user access on PostgreSQL ---------------------------------------- diff -u dotlrn-2.5.0+dfsg/debian/postrm dotlrn-2.5.0+dfsg/debian/postrm --- dotlrn-2.5.0+dfsg/debian/postrm +++ dotlrn-2.5.0+dfsg/debian/postrm @@ -15,14 +15,17 @@ purge) . /usr/share/debconf/confmodule db_version 2.0 - - rm -rf /usr/share/dotlrn - ucf --purge /etc/dotlrn/config.tcl - ucf --purge /etc/dotlrn/dotlrn.sh - rm -rf /etc/dotlrn - rm -rf /var/lib/dotlrn - rm -f /etc/aolserver4/conf.d/dotlrn.tcl /etc/aolserver4/conf.d/dotlrn.sh - rm -rf /var/log/aolserver4/dotlrn + rm -rf /usr/share/dotlrn + rm -rf /etc/dotlrn /var/lib/dotlrn /var/log/aolserver4/dotlrn + if which ucf >/dev/null; then + ucf --purge /etc/dotlrn/config.local + fi + if which ucfr >/dev/null; then + ucfr --purge dotlrn /etc/dotlrn/config.local + fi + rm -f /etc/aolserver4/conf.d/dotlrn.tcl /etc/aolserver4/conf.d/dotlrn.sh + # Restart aolserver after removal, only if it's already running + [ -f /var/run/aolserver4/dotlrn.pid ] && invoke-rc.d aolserver4 restart ;; remove) @@ -30,6 +33,8 @@ db_version 2.0 rm -rf /usr/share/dotlrn + # Restart aolserver after removal, only if it's already running + [ -f /var/run/aolserver4/dotlrn.pid ] && invoke-rc.d aolserver4 restart ;; upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) diff -u dotlrn-2.5.0+dfsg/debian/patches/config.dpatch dotlrn-2.5.0+dfsg/debian/patches/config.dpatch --- dotlrn-2.5.0+dfsg/debian/patches/config.dpatch +++ dotlrn-2.5.0+dfsg/debian/patches/config.dpatch @@ -5,9 +5,9 @@ ## DP: Adaptation of config.tcl and daemontools/run to debian install. @DPATCH@ -diff -urNad trunk~/etc/config.tcl trunk/etc/config.tcl ---- trunk~/etc/config.tcl 2009-03-31 19:14:52.000000000 +0200 -+++ trunk/etc/config.tcl 2009-10-16 20:36:07.000000000 +0200 +diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' 2.5.0+dfsg-6+wheezy2~/etc/config.tcl 2.5.0+dfsg-6+wheezy2/etc/config.tcl +--- 2.5.0+dfsg-6+wheezy2~/etc/config.tcl 2009-03-31 19:14:52.000000000 +0200 ++++ 2.5.0+dfsg-6+wheezy2/etc/config.tcl 2012-09-29 04:07:05.115210991 +0200 @@ -9,8 +9,10 @@ ###################################################################### @@ -42,19 +42,22 @@ #--------------------------------------------------------------------- # which database do you want? postgres or oracle -@@ -38,9 +40,8 @@ +@@ -38,9 +40,11 @@ if { $database eq "oracle" } { set db_password "mysitepassword" } else { - set db_host localhost - set db_port "" - set db_user $server -+## Debconf changes (DO NOT EDIT BYHAND) ## -+## End Debconf Changes ################### ++ # Defined in /etc/dotlrn/config.local ++ set db_host [exec grep "^db_host" /etc/dotlrn/config.local | sed s/^db_host=//] ++ set db_password [exec grep "^db_password" /etc/dotlrn/config.local | sed s/^db_password=//] ++ set db_port [exec grep "^db_port" /etc/dotlrn/config.local | sed s/^db_port=//] ++ set db_user [exec grep "^db_user" /etc/dotlrn/config.local | sed s/^db_user=//] } #--------------------------------------------------------------------- -@@ -85,6 +86,7 @@ +@@ -85,6 +89,7 @@ ns_param maxbackup 5 ns_param debug $debug # ns_param mailhost localhost @@ -62,7 +65,7 @@ # setting to Unicode by default # see http://dqd.com/~mayoff/encoding-doc.html -@@ -100,7 +102,7 @@ +@@ -100,7 +105,7 @@ ns_section ns/threads ns_param mutexmeter true ;# measure lock contention # The per-thread stack size must be a multiple of 8k for AOLServer to run under MacOS X @@ -71,7 +74,7 @@ # # MIME types. -@@ -569,7 +571,7 @@ +@@ -569,7 +574,7 @@ ns_param driver postgres ns_param datasource ${db_host}:${db_port}:${db_name} ns_param user $db_user @@ -80,7 +83,7 @@ } ns_section ns/db/pool/pool2 -@@ -588,7 +590,7 @@ +@@ -588,7 +593,7 @@ ns_param driver postgres ns_param datasource ${db_host}:${db_port}:${db_name} ns_param user $db_user @@ -89,7 +92,7 @@ } ns_section ns/db/pool/pool3 -@@ -607,7 +609,7 @@ +@@ -607,7 +612,7 @@ ns_param driver postgres ns_param datasource ${db_host}:${db_port}:${db_name} ns_param user $db_user @@ -98,7 +101,7 @@ } ns_section ns/server/${server}/db -@@ -621,12 +623,14 @@ +@@ -621,12 +626,14 @@ ns_section ns/server/${server}/modules ns_param nssock ${bindir}/nssock.so ns_param nslog ${bindir}/nslog.so @@ -114,7 +117,7 @@ # openacs versions earlier than 5.x requires nsxml # ns_param nsxml ${bindir}/nsxml.so -@@ -662,7 +666,7 @@ +@@ -662,7 +669,7 @@ } # nsthread library which should become standard in 5.3 @@ -123,14 +126,14 @@ if {[ns_info version] >= 4.5} { ns_limits set default -maxupload [ns_config ns/server/${server}/module/nssock maxinput] -@@ -673,3 +677,4 @@ +@@ -673,3 +680,4 @@ if {[ns_info version] >= 4.5} { ns_limits set default -maxupload [ns_config ns/server/${server}/module/nssock maxinput] } + -diff -urNad trunk~/etc/daemontools/run trunk/etc/daemontools/run ---- trunk~/etc/daemontools/run 2008-01-14 10:35:56.000000000 +0100 -+++ trunk/etc/daemontools/run 2009-10-16 20:39:39.000000000 +0200 +diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' 2.5.0+dfsg-6+wheezy2~/etc/daemontools/run 2.5.0+dfsg-6+wheezy2/etc/daemontools/run +--- 2.5.0+dfsg-6+wheezy2~/etc/daemontools/run 2008-01-14 10:35:56.000000000 +0100 ++++ 2.5.0+dfsg-6+wheezy2/etc/daemontools/run 2012-09-29 04:03:43.000000000 +0200 @@ -9,7 +9,12 @@ # see http://openacs.org/forums/message-view?message_id=176100 sleep 4 only in patch2: unchanged: --- dotlrn-2.5.0+dfsg.orig/debian/dotlrn.preinst +++ dotlrn-2.5.0+dfsg/debian/dotlrn.preinst @@ -0,0 +1,41 @@ +#!/bin/sh + +set -e + +case "$1" in + +install) + ;; + +upgrade) + # If we're upgrading from 2.5.0+dfsg-6+wheezy1 or earlier, we have to + # deal with config.tcl which was marked as a conffile and + # modified by postinst script. + # + # If the file was not modified by the user, then we can restore + # it to its initial state (before running postinst and modify it + # with debconf values) by deleting the modified lines. + # + # See Bug #688435 + # + if dpkg --compare-versions "$2" le "2.5.0+dfsg-6+wheezy1" + then + # First, make a copy so we can get the old config values + cp /etc/dotlrn/config.tcl /etc/dotlrn/config.tcl.old_version + # Reset config.tcl to its primordial state + sed -i '/set db_host/,/set db_user/d' /etc/dotlrn/config.tcl + fi + ;; + +abort-upgrade) + ;; + +*) + echo "preinst called with unknown argument '$1'" >&2 + exit 1 + ;; +esac + +#DEBHELPER# + +exit 0