[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#681016: [release.debian.org] unblock: dotlrn/2.5.0+dfsg-8



Hi,

I have uploaded the new version containing the fix for the new RC bug
previously mentioned to svn, and asked for upload to t-p-u to my
sponsor[1].

About the bug and the fix, the problem was that /etc/dotlrn/config.tcl
was being modified by debconf on the install and, as it's marked as a
conffile, on the upgrade is detected as modified by the user (even if
that's not the case).

The fix consists in using another file (/etc/dotlrn/config.local)
containing the local config values, managed bu ucf and modified by
debconf on the install, and import these values from the original
config.tcl file. Also, the preinst script tries to revert the config.tcl
to its primordial state so it's not detected as modified on the upgrade.

Please let me know if you need more information or there is a problem.
Attached debdiff between 2.5.0+dfsg6 (version in testing) and 2.5.0
+dfsg-6+wheezy2 (the new version) for
your convenience.

Thank you very much for your time, and sorry for any inconvenience.

[1]
http://lists.alioth.debian.org/pipermail/pkg-tcltk-devel/2012-October/002102.html

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,21 @@
+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 <hromojaro@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 <hromojaro@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,27 @@
 				/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, managed by debconf.
+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
+            ucf --debconf-ok $localconfigtmp $localconfig || cp -f $localconfigtmp $localconfig
+            ucfr dotlrn $localconfig
+            chmod 640 $localconfig
+            chown www-data:www-data $localconfig
+            rm -f $localconfigtmp
+        fi
 
 		# Install plpgsql on database and enable compatibility options
 		dbuser=$dba_name
@@ -205,6 +220,8 @@
 
 #DEBHELPER#
 
+db_stop
+
 exit 0
 
 
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
+        # Start aolserver after removal
+        [ -f /etc/init.d/aolserver4 ] && invoke-rc.d aolserver4 start
 	;;
 
 	remove)
@@ -30,6 +33,8 @@
 		db_version 2.0
 
 		rm -rf /usr/share/dotlrn
+        # Start aolserver after removal
+        [ -f /etc/init.d/aolserver4 ] && invoke-rc.d aolserver4 start
 	;;
 
        	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,39 @@
+#!/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
+        # 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

Reply to: