[Dbconfig-common-devel] dbconfig-common/dpkg common,1.11,1.12 config,1.10,1.11 prerm,1.4,1.5

seanius@haydn.debian.org seanius@haydn.debian.org


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

Modified Files:
	common config prerm 
Log Message:
consolidation of many mysql/pgsql templates into single templates, using
a new ${dbvendor} subst variable.  warning, this is not tested, so we
may be broken.


Index: common
===================================================================
RCS file: /cvsroot/dbconfig-common/dbconfig-common/dpkg/common,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- common	31 Mar 2005 03:54:37 -0000	1.11
+++ common	1 Apr 2005 23:52:47 -0000	1.12
@@ -33,10 +33,10 @@
 	dbc_standard_templates="database-type dbconfig-install dbconfig-upgrade dbconfig-remove password-confirm purge upgrade-backup passwords-do-not-match install-error upgrade-error remove-error"
 
 	# templates common to mysql database types
-	dbc_mysql_templates="mysql/dbname mysql/method mysql/host mysql/newhost mysql/app-user mysql/app-pass mysql/admin-user mysql/admin-pass mysql/port"
+	dbc_mysql_templates="mysql/dbname mysql/method remote/host mysql/newhost mysql/app-user mysql/app-pass mysql/admin-user mysql/admin-pass mysql/port"
 
 	# templates common to postgresql database types
-	dbc_pgsql_templates="pgsql/dbname pgsql/method pgsql/host pgsql/newhost pgsql/app-user pgsql/app-pass pgsql/admin-user pgsql/admin-pass pgsql/port pgsql/authmethod-admin pgsql/authmethod-user pgsql/changeconf pgsql/manualconf"
+	dbc_pgsql_templates="pgsql/dbname pgsql/method remote/host pgsql/newhost pgsql/app-user pgsql/app-pass pgsql/admin-user pgsql/admin-pass pgsql/port pgsql/authmethod-admin pgsql/authmethod-user pgsql/changeconf pgsql/manualconf"
 
 	# all dbtypes supported by dbconfig-common
 	dbc_all_supported_dbtypes="mysql pgsql"
@@ -76,6 +76,7 @@
 		dbc_register_templates="$dbc_standard_templates $dbc_mysql_templates"
 		dbc_default_admin="root"
 		dbc_default_dbuser=`echo $dbc_package | tr -d +.`;
+		dbc_dbvendor="MySQL"
 	;;
 	pgsql)
 		. /usr/share/dbconfig-common/internal/pgsql
@@ -90,6 +91,7 @@
 		dbc_default_admin="postgres"
 		dbc_default_dbuser=`echo $dbc_package | tr -d +-.`;
 		dbc_use_dbuser="false"
+		dbc_dbvendor="PostgreSQL"
 	;;
 	*)
 		dbc_register_templates="$dbc_standard_templates $dbc_mysql_templates $dbc_pgsql_templates"
@@ -145,13 +147,13 @@
 	_dbc_sanity_check dbtype || dbc_install_error
 
 	# get app user
-	db_get $dbc_package/$dbc_dbtype/app-user && dbc_dbuser="$RET"
+	db_get $dbc_packagedb/app-user && dbc_dbuser="$RET"
 
 	# get the db server
-	db_get $dbc_package/$dbc_dbtype/host && dbc_dbserver="$RET"
+	db_get $dbc_package/remote/host && dbc_dbserver="$RET"
 
 	# get the name of the database to be created
-	db_get $dbc_package/$dbc_dbtype/dbname && dbc_dbname="$RET"
+	db_get $dbc_packagedb/dbname && dbc_dbname="$RET"
 
 	# get the database administrator name
 	db_get $dbc_package/$dbc_dbtype/admin-user && dbc_dbadmin="$RET"
@@ -519,5 +521,8 @@
 		# perform some basic customizing substitutions
 		db_register dbconfig-common/$f $dbc_package/$f
 		db_subst $dbc_package/$f pkg $dbc_package
+		if [ "$dbc_dbvendor" ]; then
+			db_subst $dbc_package/$f dbvendor $dbc_dbvendor
+		fi
 	done
 }

Index: config
===================================================================
RCS file: /cvsroot/dbconfig-common/dbconfig-common/dpkg/config,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- config	17 Mar 2005 06:01:57 -0000	1.10
+++ config	1 Apr 2005 23:52:47 -0000	1.11
@@ -111,20 +111,20 @@
 			db_set $dbc_package/dbconfig-remove "$dbc_remove"
 		fi      
 		if [ "$dbc_dbuser" ]; then 
-			db_set $dbc_package/$dbc_dbtype/app-user "$dbc_dbuser"
+			db_set $dbc_packagedb/app-user "$dbc_dbuser"
 		fi      
 		if [ "$dbc_dbpass" ]; then 
 			db_set $dbc_package/$dbc_dbtype/app-pass "$dbc_dbpass"
 			db_fset $dbc_package/$dbc_dbtype/app-pass seen true
 		fi      
 		if [ "$dbc_dbname" ]; then 
-			db_set $dbc_package/$dbc_dbtype/dbname "$dbc_dbname"
+			db_set $dbc_packagedb/dbname "$dbc_dbname"
 		fi      
 		if [ "$dbc_dbserver" ]; then
-			db_set $dbc_package/$dbc_dbtype/host "$dbc_dbserver"
+			db_set $dbc_package/remote/host "$dbc_dbserver"
 		fi
 		if [ "$dbc_dbport" ]; then
-			db_set $dbc_package/$dbc_dbtype/port "$dbc_dbport"
+			db_set $dbc_packageremote/port "$dbc_dbport"
 		fi
 		if [ "$dbc_dbadmin" ]; then
 			db_set $dbc_package/$dbc_dbtype/admin-user "$dbc_dbadmin"
@@ -154,9 +154,9 @@
 			if [ "$_preconf_list" ]; then
 				_preconf_list=`echo $_preconf_list | sed -e 's/ /, /g'`
 				_preconf_list="new host, $_preconf_list"
-				db_subst $dbc_package/$dbc_dbtype/host hosts "$_preconf_list"
+				db_subst $dbc_package/remote/host hosts "$_preconf_list"
 				# choose from a list of remote hosts 
-				db_input high $dbc_package/$dbc_dbtype/host || true
+				db_input high $dbc_package/remote/host || true
 			fi
 		fi
 	;;
@@ -164,14 +164,15 @@
 	5)
 		if [ "$dbc_method" != "unix socket" ]; then
 			if [ "$_preconf_list" ]; then
-				db_get $dbc_package/$dbc_dbtype/host 
+				db_get $dbc_package/remote/host 
 				host=$RET
 			fi
 
 			# if they've chosen "new host" or the host list was empty
 			if [ ! "$host" -o "$host" = "new host" ]; then
 				# prompt them for a new hostname
-				db_input high $dbc_package/$dbc_dbtype/newhost || true
+				db_input high $dbc_packageremote/newhost || true
+				db_input high $dbc_packageremote/newhost || true
 			fi
 		fi
 	;;
@@ -179,23 +180,25 @@
 	6)
 		if [ "$dbc_method" != "unix socket" ]; then
 			if [ ! "$host" -o "$host" = "new host" ]; then
-				db_get $dbc_package/$dbc_dbtype/newhost 
+				db_get $dbc_packageremote/newhost 
+				db_get $dbc_packageremote/newhost 
 				newhost="$RET"
 
 				# add the new host to the existing list of hosts
-				db_metaget $dbc_package/$dbc_dbtype/host choices
+				db_metaget $dbc_package/remote/host choices
 				oldhosts="$RET"
-				db_subst $dbc_package/$dbc_dbtype/host hosts "$oldhosts, $newhost"
-				db_set $dbc_package/$dbc_dbtype/host "$newhost"
+				db_subst $dbc_package/remote/host hosts "$oldhosts, $newhost"
+				db_set $dbc_package/remote/host "$newhost"
 			else
 				# set the "newhost" to the selected host, because
 				# the second time through the configure script we'll
 				# need this set
-				db_set $dbc_package/$dbc_dbtype/newhost "$host"
+				db_set $dbc_packageremote/newhost "$host"
+				db_set $dbc_packageremote/newhost "$host"
 			fi
 
 			# on what port?
-			db_input low $dbc_package/$dbc_dbtype/port || true
+			db_input low $dbc_packageremote/port || true
 		fi
 	;;
 	# state 7 - pgsql specific auth stuff, part 1
@@ -241,14 +244,14 @@
 			dbc_dbadmpass=`dbc_get_admin_pass $dbc_package $dbc_dbtype`
 		fi
 
-		db_input low $dbc_package/$dbc_dbtype/app-user || true
+		db_input low $dbc_packagedb/app-user || true
 
 		if [ "$need_userpw" != "false" ]; then
 			dbc_dbpass=`dbc_get_app_pass $dbc_package $dbc_dbtype`
 		fi
 
 		# get the name of the database to use
-		db_input low $dbc_package/$dbc_dbtype/dbname || true
+		db_input low $dbc_packagedb/dbname || true
 	;;
 	# * - end state
 	*)

Index: prerm
===================================================================
RCS file: /cvsroot/dbconfig-common/dbconfig-common/dpkg/prerm,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- prerm	4 Feb 2005 06:26:07 -0000	1.4
+++ prerm	1 Apr 2005 23:52:47 -0000	1.5
@@ -31,10 +31,10 @@
 		###
 
 		# get the db server
-		db_get $dbc_package/$dbc_dbtype/host && dbc_dbserver="$RET"
+		db_get $dbc_package/remote/host && dbc_dbserver="$RET"
 
 		# get the name of the database created
-		db_get $dbc_package/$dbc_dbtype/dbname && dbc_dbname="$RET"
+		db_get $dbc_packagedb/dbname && dbc_dbname="$RET"
 
 		# get the admin user
 		db_get $dbc_package/$dbc_dbtype/admin-user && dbc_dbadmin="$RET"