[Dbconfig-common-changes] dbconfig-common/dpkg common, 1.33, 1.34 config, 1.24, 1.25 postinst, 1.17, 1.18 prerm, 1.11, 1.12

seanius at haydn.debian.org seanius at haydn.debian.org
Mon Nov 7 20:21:31 CET 2005


Update of /cvsroot/dbconfig-common/dbconfig-common/dpkg
In directory haydn:/org/alioth.debian.org/chroot/home/users/seanius/tmp/cvs-serv25682/dpkg

Modified Files:
	common config postinst prerm 
Log Message:
1.8.7 ready. see changelog for details.


Index: common
===================================================================
RCS file: /cvsroot/dbconfig-common/dbconfig-common/dpkg/common,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- common	25 Aug 2005 13:43:03 -0000	1.33
+++ common	7 Nov 2005 19:21:27 -0000	1.34
@@ -30,7 +30,7 @@
 	### some internal variables
 	###
 	# templates common to all database types
-	dbc_standard_templates="database-type dbconfig-install dbconfig-upgrade dbconfig-remove password-confirm app-password-confirm purge upgrade-backup passwords-do-not-match install-error upgrade-error remove-error import-oldsettings"
+	dbc_standard_templates="database-type dbconfig-install dbconfig-upgrade dbconfig-remove password-confirm app-password-confirm purge upgrade-backup passwords-do-not-match install-error upgrade-error remove-error import-oldsettings performing_upgrade"
 
 	# templates common to mysql database types
 	dbc_mysql_templates="mysql/method remote/host remote/newhost mysql/app-pass mysql/admin-user mysql/admin-pass remote/port db/dbname db/app-user"
@@ -374,6 +374,9 @@
 dbc_install_error(){
 	echo "error encountered $1:" >&2
 	echo $dbc_error >&2
+	if [ "$_dbc_no_act" ]; then
+		return 0;
+	fi
 	db_fset $dbc_package/install-error seen false
 	db_subst $dbc_package/install-error error $dbc_error
 	db_input critical $dbc_package/install-error || true
@@ -413,6 +416,25 @@
 		dbc_tried_again="yes"
 	fi
 
+	if [ "$_dbc_on_error_option" = "ignore" ]; then
+		echo "dbconfig-common: $dbc_package $dbc_command: ignoring errors from here forwards" 2>&1
+		# XXX this would be better
+		_dbc_no_act="true"
+		dbc_checkuser_cmd=true
+		dbc_createdb_cmd=true
+		dbc_createuser_cmd=true
+		dbc_dbvendor=true
+		dbc_default_admin=true
+		dbc_default_dbuser=true
+		dbc_dropdb_cmd=true
+		dbc_dropuser_cmd=true
+		dbc_dump_cmd=true
+		dbc_register_templates=true
+		dbc_sqlexec_cmd=true
+		dbc_sqlfile_cmd=true
+		dbc_use_dbuser=true
+		return 0
+	fi
 }
 
 ##

Index: config
===================================================================
RCS file: /cvsroot/dbconfig-common/dbconfig-common/dpkg/config,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- config	10 Oct 2005 18:53:17 -0000	1.24
+++ config	7 Nov 2005 19:21:27 -0000	1.25
@@ -51,19 +51,16 @@
 		if [ "$dbc_load_include" ]; then
 			iformat=`echo $dbc_load_include | cut -d: -f1`
 			ifile=`echo $dbc_load_include | cut -d: -f2-`
-			if [ ! -f "$ifile" ]; then
-				return 0
-			fi
 		fi
 
 		if dpkg --compare-versions "$dbc_first_version" gt "$dbc_oldversion"; then
-			db_input high $dbc_package/import-oldsettings || true
 			##
 			## if they want to import settings from a previous 
 			## non-dbc version, do that and mark the questions
 			## skipped 
 			##
-			if [ "$dbc_load_include" ]; then
+			if [ "$dbc_load_include" ] && [ -f "$ifile" ]; then
+				db_input high $dbc_package/import-oldsettings || true
 				eval `dbconfig-load-include $dbc_load_include_args -f $iformat $ifile`
 				for f in database-type $dbc_dbtype/method remote/host remote/newhost remote/port pgsql/authmethod-admin pgsql/authmethod-user $dbc_dbtype/admin-user db/app-user db/dbname; do
 					db_fset $dbc_package/$f seen true || true

Index: postinst
===================================================================
RCS file: /cvsroot/dbconfig-common/dbconfig-common/dpkg/postinst,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- postinst	24 Aug 2005 23:37:12 -0000	1.17
+++ postinst	7 Nov 2005 19:21:27 -0000	1.18
@@ -2,7 +2,7 @@
 ### load up common variables and functions
 ###
 dbc_go(){
-	local prev_dbc_upgrade
+	local prev_dbc_upgrade importing_from_non_dbc
 	. /usr/share/dbconfig-common/dpkg/common
 	dbc_config $@
 	# read in debconf responses (which are seeded from the config)
@@ -41,56 +41,67 @@
 			export dbc_config_include
 		fi
 
-		###
-		### now, create the app user account
-		###
-		$dbc_createuser_cmd || dbc_install_error "creating user"
-		[ "$dbc_tried_again" ] && return 0
-
-		###
-		### create the database
-		###
-		$dbc_createdb_cmd || dbc_install_error "creating database"
-		[ "$dbc_tried_again" ] && return 0
-
-		###
-		### populate the database
-		###
-		# sqlfile is the file to use for installing the database, this is
-		dbc_sqlfile=$dbc_share/data/$dbc_package/install/$dbc_dbtype
-		dbc_sqlfile_adm=$dbc_share/data/$dbc_package/install-dbadmin/$dbc_dbtype
-		dbc_scriptfile=$dbc_share/scripts/$dbc_package/install/$dbc_dbtype
-		if [ -f "$dbc_scriptfile" ]; then
-			if ! sh -c "$dbc_scriptfile $*"; then
-				dbc_error="$dbc_scriptfile exited with non-zero status"
-				dbc_install_error "populating database"
-				[ "$dbc_tried_again" ] && return 0
+		# now, determine if we're upgrading from a non-dbc version.  if so,
+		# there's a bunch of stuff that we do NOT want to do
+		if [ "$dbc_first_version" ] && [ "$dbc_oldversion" ]; then
+			if dpkg --compare-versions "$dbc_first_version" gt "$dbc_oldversion"; then
+				importing_from_non_dbc="true"
 			fi
 		fi
-		
-		if [ -f "$dbc_sqlfile_adm" ]; then
-			$dbc_sqlfile_cmd $dbc_sqlfile_adm || dbc_install_error "populating database with administrative sql"
+
+		# don't perform the following block of code during upgrades
+		if [ ! "${importing_from_non_dbc}" ]; then
+			###
+			### now, create the app user account
+			###
+			$dbc_createuser_cmd || dbc_install_error "creating user"
 			[ "$dbc_tried_again" ] && return 0
-		fi
-		
-		if [ -f "$dbc_sqlfile" ]; then
-			_dbc_asuser="yes"
-			$dbc_sqlfile_cmd $dbc_sqlfile || dbc_install_error "populating database"
-			_dbc_asuser=""
+	
+			###
+			### create the database
+			###
+			$dbc_createdb_cmd || dbc_install_error "creating database"
 			[ "$dbc_tried_again" ] && return 0
-		fi
-
+	
+			###
+			### populate the database
+			###
+			# sqlfile is the file to use for installing the database, this is
+			dbc_sqlfile=$dbc_share/data/$dbc_package/install/$dbc_dbtype
+			dbc_sqlfile_adm=$dbc_share/data/$dbc_package/install-dbadmin/$dbc_dbtype
+			dbc_scriptfile=$dbc_share/scripts/$dbc_package/install/$dbc_dbtype
+			if [ -f "$dbc_scriptfile" ]; then
+				if ! sh -c "$dbc_scriptfile $*"; then
+					dbc_error="$dbc_scriptfile exited with non-zero status"
+					dbc_install_error "populating database"
+					[ "$dbc_tried_again" ] && return 0
+				fi
+			fi
+			
+			if [ -f "$dbc_sqlfile_adm" ]; then
+				$dbc_sqlfile_cmd $dbc_sqlfile_adm || dbc_install_error "populating database with administrative sql"
+				[ "$dbc_tried_again" ] && return 0
+			fi
+			
+			if [ -f "$dbc_sqlfile" ]; then
+				_dbc_asuser="yes"
+				$dbc_sqlfile_cmd $dbc_sqlfile || dbc_install_error "populating database"
+				_dbc_asuser=""
+				[ "$dbc_tried_again" ] && return 0
+			fi
+		fi	
 
 	# end install/reconfigure section
 
-	# begin upgrade section
-		if dpkg --compare-versions "$dbc_first_version" gt "$dbc_oldversion"; then
+		if [ "$importing_from_non_dbc" ]; then
 			if ! $dbc_checkuser_command; then
 				upgrade_error "importing dbconfig-settings"
 				[ "$dbc_tried_again" ] && return 0
 			fi
 		fi
 
+	# begin upgrade section
+
 		if [ "$dbc_oldversion" ]; then
 			# check for new upgrades in these two locations
 			_dbc_upgradedir=$dbc_share/data/$dbc_package/upgrade/$dbc_dbtype

Index: prerm
===================================================================
RCS file: /cvsroot/dbconfig-common/dbconfig-common/dpkg/prerm,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- prerm	19 May 2005 01:48:33 -0000	1.11
+++ prerm	7 Nov 2005 19:21:27 -0000	1.12
@@ -9,6 +9,14 @@
 
 	need_admin_pw="yup"
 
+	if [ "$dbc_command" = "upgrade" ]; then
+		###
+		### make a note that we're upgrading so that the soon-to-come
+		### postinst call won't try and recreate users, etc
+		###
+		db_set $dbc_package/performing_upgrade true
+	fi
+
 	if [ "$dbc_command" = "remove" ]; then
 		###
 		### ask the admin if we should help with removal




More information about the Dbconfig-common-changes mailing list