Re: non fedora-usermgmt user creation

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

 



ville.skytta@xxxxxx (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-)

Attachment: pgpN1ILbwskck.pgp
Description: PGP signature

-- 
fedora-extras-list mailing list
fedora-extras-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/fedora-extras-list

[Index of Archives]     [Fedora General Discussion]     [Fedora Art]     [Fedora Docs]     [Fedora Package Review]     [Fedora Desktop]     [Big List of Linux Books]     [Yosemite Backpacking]     [KDE Users]

  Powered by Linux