non fedora-usermgmt user creation

Enrico Scholz enrico.scholz at informatik.tu-chemnitz.de
Tue Mar 7 18:55:59 UTC 2006


ville.skytta at iki.fi (Ville Skyttä) writes:

>> >               http://ensc.de/fedora/macros.fedora-usermgmt
>> > 
>> > This should ease the creation of packages supporting both the plain
>> > shadow-utils and the fedora-usermgmt methods.
>> 
>> Something like that would be very beneificial, IMO, and should hopefully 
>> satisfy anyone unhappy with the current situation.
>
> If this stuff really must exist in the first place, the above is kind of
> a step in the right direction.  However, I'm not at all happy with the
> build nor install time dependencies on fedora-usermgmt and I think they
> can be easily avoided.

I really do not understand the problems with the Requires: or BuildRequires:

1. We are speaking about packages for Fedora Extras; it is absolutely ok
   that a Fedora Extras package (build)requires another Fedora Extras
   package.

2. 'fedora-usermgmt' is only a very small package which does not add
   new dependencies. It behaves exactly like a plain 'useradd' without
   explicit activation.

3. Would it be really a problem to maintain another spec-file? Fedora
   Extras forces you already to maintain one spec-file per Fedora Core
   version.


> Something like the below should work without any macro magic or unusual
> dependencies.  It assumes that fedora-{user,group}add would be modified
> to be command line compatible with the normal useradd/groupadd.
>
>     # Note lowest common dependency: no fedora-useradd or mgmt here
>     Requires(pre): /usr/sbin/useradd

This would not work well with vanilla installations because you can not
tell an installation order there. Therefore, 'fedora-usermgmt' must be a
Requires(...):


>     %pre
>     f=$(test -x /usr/sbin/fedora-useradd && echo fedora-)
>     # fedora-useradd transforms 126 to another value according to local 
>     # config and then passes the new value with -u to plain useradd, or
>     # if fedora-useradd is not installed, we obviously invoke plain
>     # useradd directly with -u 126
>     /usr/sbin/${f}useradd -r -u 126 ...

The '-u 126' would be wrong here because accordingly LSB you should not
assign static uids in this range.


>     %pre
>     f=$(test -x /usr/sbin/fedora-useradd && echo fedora-)
>     # fedora-useradd grabs 126 from the environment, transforms it
>     # to another value according to local config and calls plain useradd
>     # using -u and the new value, or if fedora-useradd is not installed,
>     # plain useradd will be invoked without -u
>     FU_UID_HINT=126 /usr/sbin/${f}useradd -r ... # no -u in these args

I really dislike such complicated scriptlets. They may appear simple but
will cause mysterious failures (e.g. because of the bug[1] above).



Enrico


Footnotes: 
[1]  the 'f=$(test -x /usr/sbin/fedora-useradd && echo fedora-)' will make
     the scriptlet (and install transaction) fail when fedora-usermgmt is
     not installed. Should be written as

     | f=$(test ! -x /usr/sbin/fedora-useradd || echo fedora-)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 482 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/fedora-extras-list/attachments/20060307/173b0343/attachment.sig>


More information about the fedora-extras-list mailing list