Re: Help wanted for packaging postgresql application
On Sun, May 25, 2003 at 09:56:04PM +0200, Andreas Tille wrote:
> I want to package GnuMed which is a Python application accessing
> PostgreSQL server.
> It comes with a Python bootstrap routine. That means the postinst script
> would need a working Python and PostgreSQL server installed.
> I think I would solve this by a simple check whether Python and PostgreSQL
> are working. If not I would use a Debconf message to tell the user, what
> to do after installation of all prerequsites is done. If there is any
> better way to accomplish this I would be happy for hints.
For python, you only need to declare Depends: python to ensure that python
is installed and configured when your postinst runs.
postgresql is more complex, because (presumably) you want to allow for a
remote database. If so, you must prompt the user for the hostname,
authentication information, etc. and fail if you are unable to connect to
it. If you only support a local database, you can just depend on
postgresql-server or whatever is appropriate.
> The bootstrap routine creates a postgres user where the user is asked for
> a password. I would like to ask via debconf for the password. Is there
> any method to access the debconf database with Python? Currently I have
> the plan to use a shell procedure to create a temporary configfile via
> tempfile which stores the password in plain for the installation time.
> This config file is read by the bootstrap method. This is no way I would
> be really happy about but for the time beeing (regarding to the alpha
> status of the programm it is not yet used in production) it would do the
> trick until I would find a better solution. Hints are welcome here.
I believe someone is working on a python debconf interface, but I do not
know its status. You can probably find out with some searching and email.
If you store the password in a temporary file, make sure that you do it
securely, using e.g. $(tempfile -m 0600) so that it is created with O_EXCL
and secure permissions before you try to put any data into it.
> This ends in
> psql: FATAL: IDENT authentication failed for user "mytestuser"
> Now I would llike to know the following two things:
> 1. How to change the postgresql configuration in a way which just
> adds minimum off additional rights?
> 2. How to accomplish this change?
Presumably you use a GRANT command as in ANSI SQL92. The specifics may be
slightly different for postgresql's unix socket authentication; I am not so
familiar with it.