[Pkg-rrfw-general] Some notes about postinst script

Jurij Smakov jurij@wooyd.org
Mon, 21 Jun 2004 21:25:02 -0400 (EDT)


Hi,

Here are some random thoughts on RRFW postinst script, mostly for myself,
but comments are, of course, welcome :-).

Things we need to do in postinst:

* Check for 'rrfw' group and user, and create those if necessary.
  It seems like we need to Pre-Depend on 'adduser' package for that, even
  though I do not completely understand why is a normal dependency
  insufficient. There is a bit of a discussion on that topic in a thread
  starting at [0], conclusion is that generally pre-depending on higher
  priority packages should be fine. Per policy, it needs to be discussed
  on debian-devel anyway. Creation of group and user should be done
  using something like:

  addgroup --quiet --system rrfw > /dev/null
  adduser --quiet --system rrfw > /dev/null
  addgroup --quiet rrfw rrfw

  We may check for existence of the user/group using 'getent', however if
  adduser/addgroup will just exit if it already exists. Without check,
  however, we will not be able to tell, whether adduser/addgroup exited
  with a nonzero code due to the fact, that it already exists, or because
  there is some other error.
  Interesting question is whether user/group should be deleted on purge.
  There has been a little discussion about it at [1], but there is no
  consensus: argument for not removing is that any files left on the
  system with uid/gid of removed user/group will be later accessible if
  the uid/gid is later reused. Argument for removal is basically 'purge is
  a purge', and everything created must be cleaned. In the end it seems
  like it's up to the maintainer, since policy does not regulate it.

* Configure apache.
  As RRFW does not produce any static HTML, it seems like it's completely
  useless without apache/apache2 installed. So we have to depend on it and
  add support for RRFW in apache. As RRFW's Apache2Handler.pm uses
  Apache::ParseFormData, which is not packaged, we can only provide apache
  version 1 support ATM. With apache there is a curious dependency
  problem: RRFW requires apache and mod_perl, which may be satisfied by
  installing EITHER apache/apache-ssl + libapache-mod-perl OR apache-perl.
  After some heavy thinking I came up with the Depends: line like this:

  Depends: apache | apache-ssl | apache-perl, libapache-mod-perl | apache-perl

  which seems to do The Right Thing (tm), but is pretty ugly :-). And with
  apache2 support it will become a hell, so probably one has to think in
  advance about splitting the package into rrfw-common and apache-version-
  dependent packages rrfw-apache and rrfw-apache2.
  Configuration may be accomplished by putting a config snippet into
  /etc/$apachedir/conf.d directory. Since it's a variable location, a
  static config file cannot be shipped, so we have to ship it somewhere
  and later either copy or symlink it into the place in postinst,
  preprocessing it with ucf (ucf is one more thing to depend on). Here
  everything should be carefully considered to achieve idempotency.

* Fix ownership and permissions.
  Need to do more reading/testing to understand what's necessary. Since
  the files are going to be written by apache, which runs under www-data.
  Hopefully, just chowning the files/directories to which apache is
  supposed to write to rrfw:rrwf and adding the www-data to 'rrfw' group
  will do the trick.

* Configure log rotation, if necessary. Details to come.

* Install the init script. Ditto.

[0] http://lists.debian.org/debian-devel/2003/10/msg01243.html
[1] http://lists.debian.org/debian-devel/2004/05/msg01151.html

Jurij Smakov                                        jurij@wooyd.org
Key: http://www.wooyd.org/pgpkey/                   KeyID: C99E03CC