[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Help wanted for packaging postgresql application


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.

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.

For the next problem I have no real clue for a solution.  The
bootstrap method does access the database as the newly created user
this requires a change of the PostgreSQL configuration.  To make the
problem clear look at the following shell script:


   HASUSER=`echo "SELECT count(*) FROM pg_user WHERE usename = '"${TUSER}"'" | \
      psql template1 | \
      grep "^[[:space:]]*[0-9]\+" | \
      sed "s/^[[:space:]]*\([0-9]\+\)/\1/"`

   if [ $HASUSER -eq 0 ] ; then
           psql template1
      echo "User $TUSER exists."

   psql --username ${TUSER} --password template1 <<EOF
   SELECT COUNT(*) FROM pg_tables

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?

Kind regards


Reply to: