[Dbconfig-common-devel] dbconfig-common/dpkg common,1.9,1.10 config,1.8,1.9 postrm,1.2,1.3
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-serv5643/dpkg
Modified Files:
common config postrm
Log Message:
- not quite the next version, but close.
- added initial "back" support in debconf, still needs some testing
- forgot to purge ucf files in package purge
- added a THANKS file :)
- removed a no longer needed file
Index: common
===================================================================
RCS file: /cvsroot/dbconfig-common/dbconfig-common/dpkg/common,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- common 3 Mar 2005 22:28:15 -0000 1.9
+++ common 14 Mar 2005 01:42:41 -0000 1.10
@@ -234,7 +234,7 @@
# dbc_dbtype: type of underlying database to use
# this exists primarily to let dbconfig-common know what database
-# type to use when a package supports multiple database types. if this
+# type to use when a package supports multiple database types.
# don't change this value unless you know for certain that this
# package supports multiple database types
dbc_dbtype="$dbc_chosen_dbtype"
Index: config
===================================================================
RCS file: /cvsroot/dbconfig-common/dbconfig-common/dpkg/config,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- config 25 Feb 2005 05:57:04 -0000 1.8
+++ config 14 Mar 2005 01:42:41 -0000 1.9
@@ -3,44 +3,43 @@
###
dbc_go(){
- local db happy default_dbtype host newhost port oldhosts authmethod_user authmethod_admin do_config need_adminpw need_userpw f _preconf_list _s _t
+ local db happy default_dbtype host newhost port oldhosts authmethod_user authmethod_admin do_config need_adminpw need_userpw f _preconf_list _s _t STATE
. /usr/share/dbconfig-common/dpkg/common
dbc_config $@
- if [ "$dbc_command" = "configure" -o "$dbc_command" = "reconfigure" ];
+ db_capb backup
+
+ # only do this on install/reconfigure
+ if [ "$dbc_command" != "configure" -a "$dbc_command" != "reconfigure" ];
then
- ##
- ## register all the dbconfig-common questions
- ##
- dbc_register_debconf
+ return 0
+ fi
- # no, first check to see that we're upgrading from a previous
- # version that didn't have dbc support. if so, return
- # immediately. otherwise, onward!
- # XXX this does not yet work
- if [ "$dbc_first_version" ]; then
- if dpkg --compare-versions "$dbc_oldversion" le "$dbc_not_before" ]; then
- return 0;
- fi
- fi
+ ##
+ ## register all the dbconfig-common questions
+ ##
+ dbc_register_debconf
- # first, ask if they want our help at all (pre-seed if already defined)
+ STATE=1
+ while true; do
+ case "$STATE" in
+ # state 1 - ask if they want our help at all
+ 1)
if [ "$dbc_install" ]; then
db_set $dbc_package/dbconfig-install "$dbc_install"
fi
db_input medium $dbc_package/dbconfig-install || true
- db_go || true
+ ;;
+ # state 2 - quit if they don't want help, else multidb support part 1
+ 2)
db_get $dbc_package/dbconfig-install
if [ "$RET" != "true" ]; then
return 0;
fi
-
- ###
- ### multi dbtype support section
- ###
- # check to see if there's an answer in debconf
+
+ # check to see if there's a dbtype answer already in debconf
db_get $dbc_package/database-type && dbc_prompted_dbtype="$RET"
-
+
# if the dbtype is hardcoded (using config.mysql, etc), use that
if [ "$dbc_hardcoded_dbtype" ]; then
dbc_dbtype=$dbc_hardcoded_dbtype
@@ -54,7 +53,7 @@
# if the package supports multiple dbtypes, help them pick one
if [ "$dbc_dbtypes" ]; then
- # loop through all available dbtypes
+ # loop through all available dbtypes
for db in $dbc_all_supported_dbtypes; do
# check to see $db is supported
dbc_detect_dbtype $db
@@ -78,22 +77,23 @@
db_subst $dbc_package/database-type database_types "$dbc_dbtypes"
db_set $dbc_package/database-type "$default_dbtype"
db_input high $dbc_package/database-type || true
- db_go || true
+ fi
+ ;;
+ # state 3 - multidb support part 2, pre-seeding, get conn. method
+ 3)
+ if [ "$dbc_dbtypes" ]; then
db_get $dbc_package/database-type
dbc_prompted_dbtype="$RET"
# now that we have a dbtype, reload common to set other defaults
dbc_config $@
fi
- ###
- ### end multi-db support section
- ###
# there's a bit more to do with client/server rdbms
if [ "$dbc_dbtype" = "mysql" -o "$dbc_dbtype" = "pgsql" ]; then
# if these haven't been specified, use defaults
if [ ! "$dbc_dbadmin" ]; then
- dbadmin="$dbc_default_admin";
+ dbc_dbadmin="$dbc_default_admin";
fi
if [ ! "$dbc_dbuser" ]; then
dbc_dbuser="$dbc_default_dbuser"
@@ -128,10 +128,10 @@
if [ "$dbc_ssl" = "true" -a "$dbc_dbtype" = "pgsql" ]; then
db_set $dbc_package/pgsql/method "tcp/ip + ssl"
fi
-
- # get the method (local socket, tcp/ip, tcp/ip + ssl)
db_input low $dbc_package/$dbc_dbtype/method || true
- db_go || true
+ ;;
+ # state 4 - do stuff based on the connection method
+ 4)
db_get $dbc_package/$dbc_dbtype/method && dbc_method="$RET"
# if package/method == tcp/ip or tcp/ip + ssl
@@ -153,7 +153,13 @@
db_subst $dbc_package/$dbc_dbtype/host hosts "$_preconf_list"
# choose from a list of remote hosts
db_input high $dbc_package/$dbc_dbtype/host || true
- db_go || true
+ fi
+ fi
+ ;;
+ # state 5 - get host / port info if necessary
+ 5)
+ if [ "$dbc_method" != "unix socket" ]; then
+ if [ "$_preconf_list" ]; then
db_get $dbc_package/$dbc_dbtype/host
host=$RET
fi
@@ -162,16 +168,16 @@
if [ ! "$host" -o "$host" = "new host" ]; then
# prompt them for a new hostname
db_input high $dbc_package/$dbc_dbtype/newhost || true
- db_go || true
+ fi
+ fi
+ ;;
+ # state 6 - do stuff based on host/port selection
+ 6)
+ if [ "$dbc_method" != "unix socket" ]; then
+ if [ ! "$host" -o "$host" = "new host" ]; then
db_get $dbc_package/$dbc_dbtype/newhost
newhost="$RET"
- # on what port?
- db_input low $dbc_package/$dbc_dbtype/port || true
- db_go || true
- db_get $dbc_package/$dbc_dbtype/port
- port=$RET
-
# add the new host to the existing list of hosts
db_metaget $dbc_package/$dbc_dbtype/host choices
oldhosts="$RET"
@@ -183,41 +189,36 @@
# need this set
db_set $dbc_package/$dbc_dbtype/newhost "$host"
fi
- fi
- # postgresql provides multiple auth types, and ssl
+ # on what port?
+ db_input low $dbc_package/$dbc_dbtype/port || true
+ fi
+ ;;
+ # state 7 - pgsql specific auth stuff, part 1
+ 7)
if [ "$dbc_dbtype" = "pgsql" ]; then
+ # postgresql provides multiple auth types, and ssl
# get the admin auth method
- db_input low $dbc_package/$dbc_dbtype/authmethod-admin || true
-
+ db_input low $dbc_package/pgsql/authmethod-admin || true
+ fi
+ ;;
+ # state 8 - pgsql auth stuff, part 2
+ 8)
+ if [ "$dbc_dbtype" = "pgsql" ]; then
# default the user auth method to the admin method
- db_go || true
- db_get $dbc_package/$dbc_dbtype/authmethod-admin
+ db_get $dbc_package/pgsql/authmethod-admin
authmethod_admin="$RET"
- db_set $dbc_package/$dbc_dbtype/authmethod-user "$authmethod_admin"
- db_input low $dbc_package/$dbc_dbtype/authmethod-user || true
- db_go || true
- db_get $dbc_package/$dbc_dbtype/authmethod-admin
+ db_set $dbc_package/pgsql/authmethod-user "$authmethod_admin"
+ db_input low $dbc_package/pgsql/authmethod-user || true
+ fi
+ ;;
+ # state 9 - pgsql auth part 3, admin/app user, dbname
+ 9)
+ if [ "$dbc_dbtype" = "pgsql" ]; then
+ db_get $dbc_package/pgsql/authmethod-user
authmethod_user="$RET"
- # if we're connecting to localhost and the method is
- # not ident, we need to change config.
- # no point in doing this for now
-# if [ ! "$dbc_dbserver" -o "$dbc_dbserver" = "localhost" ] && [ "$authmethod_user" != "ident" -o "$authmethod_admin" != "ident" ]; then
-# db_input high $dbc_package/$dbc_dbtype/changeconf || true
-#
-# # if they don't want us to muck with their
-# # config give them a pointer.
-# db_go || true
-# db_get $dbc_package/$dbc_dbtype/changeconf
-# do_config="$RET"
-#
-# if [ "$do_config" != "true" ]; then
-# db_input high $dbc_package/$dbc_dbtype/manualconf || true
-# fi
-# fi
-
# if we are using ident, we don't need passwords
if [ "$authmethod_admin" = "ident" ]; then
need_adminpw="false"
@@ -231,14 +232,12 @@
# who's the admin user (is there any reason to even ask this?)
# TODO: should there be a difference between the local and remote admin?
db_input low $dbc_package/$dbc_dbtype/admin-user || true
- dbc_dbadmin="$RET"
if [ "$need_adminpw" != "false" ]; then
dbc_dbadmpass=`dbc_get_admin_pass $dbc_package $dbc_dbtype`
fi
db_input low $dbc_package/$dbc_dbtype/app-user || true
- dbc_dbuser="$RET"
if [ "$need_userpw" != "false" ]; then
dbc_dbpass=`dbc_get_app_pass $dbc_package $dbc_dbtype`
@@ -246,7 +245,20 @@
# get the name of the database to use
db_input low $dbc_package/$dbc_dbtype/dbname || true
+ ;;
+ # * - end state
+ *)
+ break
+ ;;
+ esac
+ if db_go; then
+ STATE=$(($STATE + 1))
+ else
+ STATE=$(($STATE - 1))
+ fi
- db_go || true
- fi
+ if [ $STATE -lt 1 ]; then
+ exit 10
+ fi
+ done
}
Index: postrm
===================================================================
RCS file: /cvsroot/dbconfig-common/dbconfig-common/dpkg/postrm,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- postrm 25 Jan 2005 14:48:20 -0000 1.2
+++ postrm 14 Mar 2005 01:42:41 -0000 1.3
@@ -7,5 +7,6 @@
if [ "$dbc_command" = "purge" ]; then
rm -f /etc/dbconfig-common/$dbc_package.conf || true
+ ucf -p "/etc/dbconfig-common/$dbc_package.conf" || true
fi
}