[Dbconfig-common-changes] [dbconfig-common] r362 - in trunk: . debian dpkg

Sean Finney seanius at alioth.debian.org
Sat Dec 9 10:56:07 CET 2006


tags 397089 pending
thanks

Author: seanius
Date: 2006-12-09 10:56:07 +0100 (Sat, 09 Dec 2006)
New Revision: 362

Modified:
   trunk/dbconfig-load-include
   trunk/debian/changelog
   trunk/dpkg/config
Log:
d-l-i return status fix

Modified: trunk/dbconfig-load-include
===================================================================
--- trunk/dbconfig-load-include	2006-11-27 19:01:38 UTC (rev 361)
+++ trunk/dbconfig-load-include	2006-12-09 09:56:07 UTC (rev 362)
@@ -145,6 +145,7 @@
 fi
 
 inputfile=$1
+rv=0
 
 if [ ! "$inputfile" ]; then
 	echo "error: you must specify an inputfile" >&2
@@ -237,8 +238,9 @@
 
 exec)
 	sh -c $inputfile
+	rv="$?"
 ;;
 
 esac
 
-exit 0
+exit $rv

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog	2006-11-27 19:01:38 UTC (rev 361)
+++ trunk/debian/changelog	2006-12-09 09:56:07 UTC (rev 362)
@@ -2,8 +2,11 @@
 
   * NOT RELEASED YET
   * remove some "-a" and "-o" bashisms while i'm thinking about it.
+  * dbconfig-load-include now returns the exit status of the "exec"
+    format (where the output is based on running a script), if appropriate.
+    thanks to Matt Brown for the patch (closes: #397089).
 
- -- sean finney <seanius at copelandia.yale-house.net>  Sat, 11 Nov 2006 18:01:08 +0100
+ -- sean finney <seanius at debian.org>  Sat, 09 Dec 2006 10:55:53 +0100
 
 dbconfig-common (1.8.29) unstable; urgency=medium
 

Modified: trunk/dpkg/config
===================================================================
--- trunk/dpkg/config	2006-11-27 19:01:38 UTC (rev 361)
+++ trunk/dpkg/config	2006-12-09 09:56:07 UTC (rev 362)
@@ -61,11 +61,21 @@
 		db_set $dbc_package/internal/reconfiguring true
 	fi
 
+	##
+	## start new dbc upgrade section
+	##
+	# if there is a previously existing version already installed
+	# *and* the maintainer has provided the first version that used
+	# dbconfig-common *and*  this version is newer than the
+	# previously installed version... do the dbc import stuff.
+	if [ "$migrating" ]; then
+		dbc_migrate
+	fi
+
 	# and start our beautiful state-machine
-	# we start in STATE=1 (install_question) in all but two situations:
-	#	- we're migrating from a previous non-dbc version
+	# we start in STATE=1 (install_question) in all but one situation:
 	#   - we're installing a frontend/readonly app
-	if [ ! "$migrating" ] && [ ! "$dbc_frontend" ]; then
+	if [ ! "$dbc_frontend" ]; then
 		STATE=1
 	else
 		STATE=2
@@ -86,69 +96,6 @@
 		fi
 
 		##
-		## start new dbc upgrade section
-		##
-		# if there is a previously existing version already installed
-		# *and* the maintainer has provided the first version that used
-		# dbconfig-common *and*  this version is newer than the
-		# previously installed version... do the dbc import stuff.
-		if [ "$migrating" ]; then
-			# if dbc_load_include is set, determine the format
-			# and location of the old config file
-			if [ "$dbc_load_include" ]; then
-				iformat=`echo $dbc_load_include | cut -d: -f1`
-				ifile=`echo $dbc_load_include | cut -d: -f2-`
-			fi
-
-			##
-			## if they want to import settings from a previous 
-			## non-dbc version, do that and mark the questions
-			## skipped 
-			##
-			if [ "$ifile" ] && [ -f "$ifile" ]; then
-				dbc_logpart "migrating old settings into dbconfig-common: "
-				if [ "$dbc_debug" ]; then
-					dbc_debug "dbconfig-load-include $dbc_load_include_args -f $iformat $ifile"
-					dbconfig-load-include $dbc_load_include_args -f $iformat $ifile
-				fi
-				eval `dbconfig-load-include $dbc_load_include_args -f $iformat $ifile`
-				# if the dbtype is hardcoded, reset it no matter what
-				# dbconfig-load-include tells us
-				if [ "$dbc_hardcoded_dbtype" ]; then 
-					dbc_dbtype="$dbc_hardcoded_dbtype"
-				fi
-				
-				for f in database-type $dbc_dbtype/method db/dbname; do
-					db_fset $dbc_package/$f seen true || true
-				done
-				if echo "$dbc_authenticated_dbtypes" | grep -q "$dbc_dbtype"; then
-					for f in pgsql/authmethod-admin pgsql/authmethod-user $dbc_dbtype/admin-user db/app-user; do
-						db_fset $dbc_package/$f seen true || true
-					done
-					db_set $dbc_package/db/app-user "$dbc_dbuser"
-					db_set $dbc_package/$dbc_dbtype/app-pass "$dbc_dbpass"
-					db_set $dbc_package/password-confirm "$dbc_dbpass"
-				fi
-				if echo "$dbc_remote_dbtypes" | grep -q "$dbc_dbtype"; then
-					for f in remote/host remote/newhost remote/port ; do
-						db_fset $dbc_package/$f seen true || true
-					done
-					db_set $dbc_package/remote/host "$dbc_dbserver"
-					db_set $dbc_package/remote/newhost "$dbc_dbserver"
-					db_set $dbc_package/remote/port "$dbc_dbport"
-					if [ "$dbc_dbserver" ]; then
-						db_set $dbc_package/$dbc_dbtype/method "tcp/ip"
-					fi
-				fi
-
-				db_set $dbc_package/database-type $dbc_dbtype
-				db_set $dbc_package/db/dbname "$dbc_dbname"
-
-				dbc_logline "done"
-			fi
-		fi
-
-		##
 		## start multidb section
 		## 
 		# if the dbtype is hardcoded (using config.mysql, etc), use that
@@ -398,3 +345,73 @@
 	
 	db_set $dbc_package/internal/skip-preseed true
 }
+
+dbc_migrate() {
+
+	# if dbc_load_include is set, determine the format
+	# and location of the old config file
+	if [ "$dbc_load_include" ]; then
+		iformat=`echo $dbc_load_include | cut -d: -f1`
+		ifile=`echo $dbc_load_include | cut -d: -f2-`
+	fi
+
+	##
+	## if they want to import settings from a previous 
+	## non-dbc version, do that and mark the questions
+	## skipped 
+	##
+	if [ -z "$ifile" ] || [ ! -f "$ifile" ]; then
+		return
+	fi
+
+	dbc_logpart "migrating old settings into dbconfig-common: "
+	if [ "$dbc_debug" ]; then
+		dbc_debug "dbconfig-load-include $dbc_load_include_args -f $iformat $ifile"
+		dbconfig-load-include $dbc_load_include_args -f $iformat $ifile
+	fi
+	eval `dbconfig-load-include $dbc_load_include_args -f $iformat $ifile`
+	if [ "$?" != "0" ]; then
+		dbc_logline "failed"
+		return
+	fi
+
+	# the load script needs to return at least a database type
+	if [ -z "$dbc_dbtype" ]; then
+		dbc_logline "failed"
+		return
+	fi
+
+	# if the dbtype is hardcoded, reset it no matter what
+	# dbconfig-load-include tells us
+	if [ "$dbc_hardcoded_dbtype" ]; then 
+		dbc_dbtype="$dbc_hardcoded_dbtype"
+	fi
+	
+	for f in database-type $dbc_dbtype/method db/dbname; do
+		db_fset $dbc_package/$f seen true || true
+	done
+	if echo "$dbc_authenticated_dbtypes" | grep -q "$dbc_dbtype"; then
+		for f in pgsql/authmethod-admin pgsql/authmethod-user $dbc_dbtype/admin-user db/app-user; do
+			db_fset $dbc_package/$f seen true || true
+		done
+		db_set $dbc_package/db/app-user "$dbc_dbuser"
+		db_set $dbc_package/$dbc_dbtype/app-pass "$dbc_dbpass"
+		db_set $dbc_package/password-confirm "$dbc_dbpass"
+	fi
+	if echo "$dbc_remote_dbtypes" | grep -q "$dbc_dbtype"; then
+		for f in remote/host remote/newhost remote/port ; do
+			db_fset $dbc_package/$f seen true || true
+		done
+		db_set $dbc_package/remote/host "$dbc_dbserver"
+		db_set $dbc_package/remote/newhost "$dbc_dbserver"
+		db_set $dbc_package/remote/port "$dbc_dbport"
+		if [ "$dbc_dbserver" ]; then
+			db_set $dbc_package/$dbc_dbtype/method "tcp/ip"
+		fi
+	fi
+
+	db_set $dbc_package/database-type $dbc_dbtype
+	db_set $dbc_package/db/dbname "$dbc_dbname"
+
+	dbc_logline "done"
+}




More information about the Dbconfig-common-changes mailing list