Hi,

Well, you can write your code after the #DEBHELPER# token.. but I guess
this doesn't work for your use case?

Exactly. The use case is:

- create a system user
- chown a directory (e.g. for logs)
- start the service

The DEBHELPER token expands into too many tasks including starting the service which would fail if the directory does not have the correct permissions.

Do you have the same problem as Lars -
" move the `#DEBHELPER#` marker  to the top of the postinst script.
But this would lead to related services being restarted (via the other
debhelper snippets) before the directory permissions are configured. "

Yes - same problem.

Yeah that was the idea, but then I realized that writing in preinstall
doesn't work with this package design: the preinstall snippet will
call sysuser-helper which is not guaranteed to be installed yet :(

Ah, because it is an extra package.

The clearest solution to me would be to ship sysuser-helper with the debhelper package. That would make sure the needed helper script is already installed and can be called in DEBHELPER - voila!

So far I can think of the following:

1. The code can be written entirely in the preinstall but this defeats
  the idea of having the code in a separate binary (sysuser-helper) which
  has drawbacks like this bug but also has other advantages that I would
  like not to give up; maybe there can be a specific option to do this?

I also like the idea of putting the code to create a new user into a separate binary so that all packages which use this method can directly benefit from it.

2. dh-sysuser can grow an interface similar to systemd-tempfiles but
  less complex and specialized in changing mode and ownership to
  files and dirs and makes sure that the snippet in postinstall is run
  after the creation of the user (I'm not particularly eager to do
  this..)

This also sounds clever: If the control file for dh_sysuser also includes the optional information which files or directories should get chown'ed this task could also be taken over by the helper which then would guarantee the right order of execution.

In case 1. is not feasible, do you dislike 2? Would it work for your use
case?

I still think the best solution would be to include the helper script in debhelper. Then you would move creating the user in preinst. You could also add the chown of files and/or directories into postinst. Doing it this way should enable all package maintainers the maximum flexibility.

But for me options 1 and 2 would also work.

I neglected a bit this package during the last cycle, hopefully I'll
manage to do better in this cycle

Thank you for your work!

Cheers,

Christopher

--
======================================================
    Dipl.-Ing. Christopher Odenbach
    Zentrum fuer Informations- und Medientechnologien
    Universitaet Paderborn
    Raum N5.308
    odenb...@uni-paderborn.de
    Tel.: +49 5251 60 5315
======================================================

Attachment: smime.p7s
Description: Kryptografische S/MIME-Signatur

Reply via email to