[Dbconfig-common-changes] [dbconfig-common] r228 - in trunk: debian
dpkg
Sean Finney
seanius at costa.debian.org
Thu May 25 00:26:07 CEST 2006
Author: seanius
Date: 2006-05-24 22:26:06 +0000 (Wed, 24 May 2006)
New Revision: 228
Modified:
trunk/debian/changelog
trunk/dpkg/common
trunk/dpkg/postinst
trunk/dpkg/prerm
Log:
* more code consolidation, configfile-vs-debconf fixes, removal of some
obsolete code/templates.
Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog 2006-05-24 19:48:54 UTC (rev 227)
+++ trunk/debian/changelog 2006-05-24 22:26:06 UTC (rev 228)
@@ -12,6 +12,8 @@
user should authenticate for pgsql applications (closes: #368219).
* extra sanity check for a glob that might not expand in some circumstances,
from matt brown (closes: #368714).
+ * more code consolidation, configfile-vs-debconf fixes, removal of some
+ obsolete code/templates.
-- sean finney <seanius at debian.org> Wed, 24 May 2006 18:21:06 +0200
Modified: trunk/dpkg/common
===================================================================
--- trunk/dpkg/common 2006-05-24 19:48:54 UTC (rev 227)
+++ trunk/dpkg/common 2006-05-24 22:26:06 UTC (rev 228)
@@ -131,6 +131,15 @@
if [ -f $dbc_packageconfig ]; then
. $dbc_packageconfig
fi
+
+ # if dbserver is unset, that means localhost.
+ if [ -z "$dbc_dbserver" ] || [ "$dbc_dbserver" = "localhost" ]; then
+ # if the server is local, only allow connections from localhost
+ dbc_dballow="localhost"
+ else
+ # otherwise, only tell the remote database to allow from us
+ dbc_dballow=`hostname -f`
+ fi
}
###
Modified: trunk/dpkg/postinst
===================================================================
--- trunk/dpkg/postinst 2006-05-24 19:48:54 UTC (rev 227)
+++ trunk/dpkg/postinst 2006-05-24 22:26:06 UTC (rev 228)
@@ -23,19 +23,6 @@
###
if [ "$dbc_install" != "true" ]; then return 0; fi
- ###
- ### perform a few sanity checks on the data
- ###
-
- # if dbserver is unset, that means localhost.
- if [ -z "$dbc_dbserver" ] || [ "$dbc_dbserver" = "localhost" ]; then
- # if the server is local, only allow connections from localhost
- dbc_dballow="localhost"
- else
- # otherwise, only tell the remote database to allow from us
- dbc_dballow=`hostname -f`
- fi
-
# export the config file if it exists, for the scripts
if [ "$dbc_generate_include" ]; then
# strip the leading format string for convenience
Modified: trunk/dpkg/prerm
===================================================================
--- trunk/dpkg/prerm 2006-05-24 19:48:54 UTC (rev 227)
+++ trunk/dpkg/prerm 2006-05-24 22:26:06 UTC (rev 228)
@@ -2,7 +2,7 @@
### some global variables etc
###
dbc_go(){
- local need_admin_pw
+ local need_admin_pw dumpfile nowtime
. /usr/share/dbconfig-common/dpkg/common
dbc_debug "(prerm) dbc_go() $@"
@@ -29,35 +29,11 @@
fi
###
- ### get all the debconf settings we need
+ ### get all the settings we need
###
+ dbc_read_package_config
- # get the db server
- db_get $dbc_package/remote/host && dbc_dbserver="$RET"
-
- # get the name of the database created
- db_get $dbc_package/db/dbname && dbc_dbname="$RET"
-
- # get the admin user
- db_get $dbc_package/$dbc_dbtype/admin-user && dbc_dbadmin="$RET"
-
- # get the app user password
- db_get $dbc_package/$dbc_dbtype/app-pass && dbc_app_pass="$RET"
-
###
- ### perform a few sanity checks on the data
- ###
-
- # if dbserver is unset, that means localhost.
- if [ -z "$dbc_dbserver" ] || [ "$dbc_dbserver" = "localhost" ]; then
- # if the server is local, only allow connections from localhost
- dbc_dballow="localhost"
- else
- # otherwise, only tell the remote database to allow from us
- dbc_dballow=`hostname -f`
- fi
-
- ###
### ask the admin if the database should be purged
###
db_input high $dbc_package/purge || true
@@ -78,16 +54,18 @@
fi
# dump the database into a temporary file
- _dbc_now=`date +%Y-%m-%d-%H.%M`
- _dbc_dbfile=`mktemp /var/tmp/$dbc_package.$dbc_dbname.$_dbc_now.$dbc_dbtype.XXXXXX`
- # XXX error checking here
- echo dbconfig-common: dumping $dbc_dbtype database $dbc_dbname to $_dbc_dbfile >&2
- $dbc_dump_cmd > $_dbc_dbfile || dbc_remove_error "dumping database"
- echo dbconfig-common: dropping $dbc_dbtype database $dbc_dbname >&2
+ nowtime=`date +%Y-%m-%d-%H.%M`
+ dumpfile=`mktemp /var/tmp/$dbc_package.$dbc_dbname.$nowtime.$dbc_dbtype.XXXXXX`
+ if [ ! -f $dumpfile ]; then
+ dbc_remove_error "creating temporary file for database dump"
+ fi
+ dbc_logline "dbconfig-common: dumping $dbc_dbtype database $dbc_dbname to $_dbc_dbfile"
+ $dbc_dump_cmd > $dumpfile || dbc_remove_error "dumping database"
+ dbc_logline "dbconfig-common: dropping $dbc_dbtype database $dbc_dbname"
$dbc_dropdb_cmd || dbc_remove_error "dropping database"
[ "$dbc_tried_again" ] && return 0
- echo dbconfig-common: revoking privileges for user $dbc_dbuser on $dbc_dbname > /dev/stderr
+ dbc_logline "dbconfig-common: revoking privileges for user $dbc_dbuser on $dbc_dbname"
$dbc_dropuser_cmd
fi
fi
More information about the Dbconfig-common-changes
mailing list