[Pkg-tcltk-commits] r1306 - in dotlrn/tags: . 2.5.0+dfsg-6+wheezy2/debian 2.5.0+dfsg-6+wheezy2/debian/patches

geox-guest at alioth.debian.org geox-guest at alioth.debian.org
Mon Oct 1 23:00:21 UTC 2012


Author: geox-guest
Date: 2012-10-01 23:00:21 +0000 (Mon, 01 Oct 2012)
New Revision: 1306

Added:
   dotlrn/tags/2.5.0+dfsg-6+wheezy2/
   dotlrn/tags/2.5.0+dfsg-6+wheezy2/debian/dotlrn.preinst
Modified:
   dotlrn/tags/2.5.0+dfsg-6+wheezy2/debian/README.Debian
   dotlrn/tags/2.5.0+dfsg-6+wheezy2/debian/changelog
   dotlrn/tags/2.5.0+dfsg-6+wheezy2/debian/control
   dotlrn/tags/2.5.0+dfsg-6+wheezy2/debian/patches/config.dpatch
   dotlrn/tags/2.5.0+dfsg-6+wheezy2/debian/postinst
   dotlrn/tags/2.5.0+dfsg-6+wheezy2/debian/postrm
Log:
* 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.



Modified: dotlrn/tags/2.5.0+dfsg-6+wheezy2/debian/README.Debian
===================================================================
--- dotlrn/tags/2.5.0+dfsg-6+wheezy1/debian/README.Debian	2012-08-22 13:31:23 UTC (rev 1296)
+++ dotlrn/tags/2.5.0+dfsg-6+wheezy2/debian/README.Debian	2012-10-01 23:00:21 UTC (rev 1306)
@@ -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
 ----------------------------------------
 

Modified: dotlrn/tags/2.5.0+dfsg-6+wheezy2/debian/changelog
===================================================================
--- dotlrn/tags/2.5.0+dfsg-6+wheezy1/debian/changelog	2012-08-22 13:31:23 UTC (rev 1296)
+++ dotlrn/tags/2.5.0+dfsg-6+wheezy2/debian/changelog	2012-10-01 23:00:21 UTC (rev 1306)
@@ -1,3 +1,14 @@
+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 at 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

Modified: dotlrn/tags/2.5.0+dfsg-6+wheezy2/debian/control
===================================================================
--- dotlrn/tags/2.5.0+dfsg-6+wheezy1/debian/control	2012-08-22 13:31:23 UTC (rev 1296)
+++ dotlrn/tags/2.5.0+dfsg-6+wheezy2/debian/control	2012-10-01 23:00:21 UTC (rev 1306)
@@ -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

Added: dotlrn/tags/2.5.0+dfsg-6+wheezy2/debian/dotlrn.preinst
===================================================================
--- dotlrn/tags/2.5.0+dfsg-6+wheezy2/debian/dotlrn.preinst	                        (rev 0)
+++ dotlrn/tags/2.5.0+dfsg-6+wheezy2/debian/dotlrn.preinst	2012-10-01 23:00:21 UTC (rev 1306)
@@ -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

Modified: dotlrn/tags/2.5.0+dfsg-6+wheezy2/debian/patches/config.dpatch
===================================================================
--- dotlrn/tags/2.5.0+dfsg-6+wheezy1/debian/patches/config.dpatch	2012-08-22 13:31:23 UTC (rev 1296)
+++ dotlrn/tags/2.5.0+dfsg-6+wheezy2/debian/patches/config.dpatch	2012-10-01 23:00:21 UTC (rev 1306)
@@ -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

Modified: dotlrn/tags/2.5.0+dfsg-6+wheezy2/debian/postinst
===================================================================
--- dotlrn/tags/2.5.0+dfsg-6+wheezy1/debian/postinst	2012-08-22 13:31:23 UTC (rev 1296)
+++ dotlrn/tags/2.5.0+dfsg-6+wheezy2/debian/postinst	2012-10-01 23:00:21 UTC (rev 1306)
@@ -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,11 +149,28 @@
 				/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
 		dbpass=$dba_password
@@ -205,6 +220,8 @@
 
 #DEBHELPER#
 
+db_stop
+
 exit 0
 
 

Modified: dotlrn/tags/2.5.0+dfsg-6+wheezy2/debian/postrm
===================================================================
--- dotlrn/tags/2.5.0+dfsg-6+wheezy1/debian/postrm	2012-08-22 13:31:23 UTC (rev 1296)
+++ dotlrn/tags/2.5.0+dfsg-6+wheezy2/debian/postrm	2012-10-01 23:00:21 UTC (rev 1306)
@@ -15,20 +15,17 @@
 	purge)
 		. /usr/share/debconf/confmodule
 		db_version 2.0
-
-		rm -rf /usr/share/dotlrn
-        rm -rf /etc/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.tcl
-            ucf --purge /etc/dotlrn/dotlrn.sh
+            ucf --purge /etc/dotlrn/config.local
         fi
         if which ucfr >/dev/null; then
-            ucfr --purge dotlrn /etc/dotlrn/config.tcl
-            ucfr --purge dotlrn /etc/dotlrn/dotlrn.sh
+            ucfr --purge dotlrn /etc/dotlrn/config.local
         fi
-		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 -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)
@@ -36,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)




More information about the Pkg-tcltk-commits mailing list