[Dbconfig-common-devel] dbconfig-common/dpkg common,1.6,1.7 config,1.6,1.7 postinst,1.4,1.5
seanius@haydn.debian.org
seanius@haydn.debian.org
- Previous message: [Dbconfig-common-devel] dbconfig-common/debian/po de.po,1.3,1.4 templates.pot,1.5,1.6
- Next message: [Dbconfig-common-devel] dbconfig-common/doc dbapp-policy.html,1.4,1.5 dbconfig-common-design.html,1.3,1.4 dbconfig-common-using.html,1.4,1.5 dbconfig-common.html,1.4,1.5
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/dbconfig-common/dbconfig-common/dpkg
In directory haydn:/org/alioth.debian.org/chroot/home/users/seanius/tmp/cvs-serv26326/dpkg
Modified Files:
common config postinst
Log Message:
the next version is underway. i there's a bit more that needs to be
done, but there's been enough done that i want to get it into cvs
before i accidentally rm -rf something important.
as soon as i finish the support for include file generation, and give
everything a final go-through with testing, i'll make another upload
to experimental and an announcement to d-d.
Index: common
===================================================================
RCS file: /cvsroot/dbconfig-common/dbconfig-common/dpkg/common,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- common 4 Feb 2005 06:26:07 -0000 1.6
+++ common 23 Feb 2005 05:39:59 -0000 1.7
@@ -178,6 +178,12 @@
# get the database user pass
db_get $dbc_package/pgsql/app-pass && dbc_dbpass="$RET"
fi
+
+ # get whether or not they want to force SSL
+ db_get $dbc_package/pgsql/method && dbc_method="$RET"
+ if [ "$dbc_method" = "tcp/ip + ssl" ]; then
+ dbc_ssl="true"
+ fi
;;
esac
}
@@ -186,6 +192,7 @@
### dump package configuration to a config file
###
dbc_write_package_config(){
+ local iformat ofile
_dbc_sanity_check packageconfig || dbc_install_error
echo "dbconfig-common: writing config to $dbc_packageconfig" >&2
@@ -199,6 +206,10 @@
if [ "$dbc_chosen_dbtype" = '${database_type}' ]; then
dbc_chosen_dbtype=""
fi
+ # and a check for ssl
+ if [ "$dbc_method" = "tcp/ip + ssl" ]; then
+ dbc_ssl="true"
+ fi
cat << EOF > $dbc_packageconfig
# automatically generated by the maintainer scripts of $dbc_package
@@ -229,6 +240,11 @@
# the name of the user who we will use to connect to the database.
dbc_dbuser="$dbc_dbuser"
+# dbc_dbpass: database user password
+# the password to use with the above username when connecting
+# to a database, if one is required
+dbc_dbpass="$dbc_dbpass"
+
# dbc_dbserver: database host.
# leave unset to use localhost (or a more efficient local method
# if it exists).
@@ -248,6 +264,10 @@
## you can safely ignore all of these
##
+# dbc_ssl: should we require ssl?
+# set to "true" to require that connections use ssl
+dbc_ssl="$dbc_ssl"
+
# dbc_authmethod_admin: authentication method for admin
# dbc_authmethod_user: authentication method for dbuser
# see the section titled "AUTHENTICATION METHODS" in
@@ -260,7 +280,16 @@
##
EOF
- cp $dbc_packageconfig `mktemp -t dbconfig-foo.XXXXXX`
+ if [ "$dbc_generate_include" ]; then
+ if echo $dbc_generate_include | grep -q -E "^[^:]*:"; then
+ iformat=`echo $dbc_generate_include | cut -d: -f1`
+ ofile=`echo $dbc_generate_include | cut -d: -f2`
+ dbconfig-generate-include -a -f "$iformat" "$dbc_packageconfig" "$ofile"
+ else
+ dbc_error="maintainer did not properly set dbc_generate_include"
+ dbc_install_error "writing package config"
+ fi
+ fi
}
##
Index: config
===================================================================
RCS file: /cvsroot/dbconfig-common/dbconfig-common/dpkg/config,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- config 7 Feb 2005 14:17:03 -0000 1.6
+++ config 23 Feb 2005 05:39:59 -0000 1.7
@@ -14,6 +14,16 @@
##
dbc_register_debconf
+ # 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
+
# first, ask if they want our help at all (pre-seed if already defined)
if [ "$dbc_install" ]; then
db_set $dbc_package/dbconfig-install "$dbc_install"
@@ -22,10 +32,21 @@
db_go || true
db_get $dbc_package/dbconfig-install
if [ "$RET" != "true" ]; then
- exit 0;
+ return 0;
fi
###
+ ### pre-configured choices selection section
+ ###
+ # local _dsn
+ # for f in /etc/dbconfig-common/*.conf; do
+ # eval `dbconfig-generate-include -D _dsn $f | grep -v'^#'`
+ # add selection to set of choices
+ # done
+ # prompt for a pre-selected server, if at least one was found
+ # if they choose one, use it, else continue
+
+ ###
### multi dbtype support section
###
# check to see if there's an answer in debconf
@@ -115,14 +136,17 @@
if [ "$dbc_dbadmin" ]; then
db_set $dbc_package/$dbc_dbtype/admin-user "$dbc_dbadmin"
fi
+ 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
- db_get $dbc_package/$dbc_dbtype/method
+ db_get $dbc_package/$dbc_dbtype/method && dbc_method="$RET"
- # if package/method == tcp/ip
- if [ "$RET" != "unix socket" ]; then
+ # if package/method == tcp/ip or tcp/ip + ssl
+ if [ "$dbc_connection_method" != "unix socket" ]; then
# if no hosts have ever been selected,
# this would be set to '${hosts}' (literally)
db_metaget $dbc_package/$dbc_dbtype/host hosts
@@ -158,7 +182,7 @@
fi
fi
- # postgresql provides multiple auth types
+ # postgresql provides multiple auth types, and ssl
if [ "$dbc_dbtype" = "pgsql" ]; then
# get the admin auth method
db_input low $dbc_package/$dbc_dbtype/authmethod-admin || true
@@ -176,19 +200,20 @@
# if we're connecting to localhost and the method is
# not ident, we need to change config.
- 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
+ # 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
@@ -205,12 +230,12 @@
db_input low $dbc_package/$dbc_dbtype/admin-user || true
dbc_dbadmin="$RET"
- db_input low $dbc_package/$dbc_dbtype/app-user || true
- dbc_dbuser="$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`
Index: postinst
===================================================================
RCS file: /cvsroot/dbconfig-common/dbconfig-common/dpkg/postinst,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- postinst 4 Feb 2005 06:26:07 -0000 1.4
+++ postinst 23 Feb 2005 05:39:59 -0000 1.5
@@ -32,7 +32,6 @@
# if dbserver is unset, that means localhost.
if [ -z "$dbc_dbserver" ]; then
# if the server is local, only allow connections from localhost
- #dbc_dbserver="localhost"
dbc_dballow="localhost"
else
# otherwise, only tell the remote database to allow from us
@@ -50,23 +49,13 @@
###
### now, create the app user account
###
- $dbc_createuser_cmd
+ $dbc_createuser_cmd || dbc_install_error "creating user"
# that was easy, now, wasn't it? :)
- # check for errors
- if [ "$dbc_status" = "error" ]; then
- dbc_install_error "creating user"
- fi
-
###
### create the database
###
- $dbc_createdb_cmd
-
- # check for errors
- if [ "$dbc_status" = "error" ]; then
- dbc_install_error "creating database:"
- fi
+ $dbc_createdb_cmd || dbc_install_error "creating database:"
###
### populate the database
- Previous message: [Dbconfig-common-devel] dbconfig-common/debian/po de.po,1.3,1.4 templates.pot,1.5,1.6
- Next message: [Dbconfig-common-devel] dbconfig-common/doc dbapp-policy.html,1.4,1.5 dbconfig-common-design.html,1.3,1.4 dbconfig-common-using.html,1.4,1.5 dbconfig-common.html,1.4,1.5
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]