[opensuse-packaging] To getent or not to getent
Heya, some packages in the openSUSE distribution do this (or equivalent) in their %post section: %post getent passwd user >/dev/null || useradd user || : darix says this is against policy (what a killer argument), but closely looking at what is happening, getent is just what is desired. If getent were not used, useradd would throw a warning whenever the user already exists, which would be the case on all upgrade attempts of such packages. So people slap in useradd user 2>/dev/null || : instead, but that hides real errors that do not stem from a preexisting user. So, with getent, one can check whether the user already exists and not call useradd if so; otherwise do create the user, and NOT drop any stderr messages. -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-packaging+help@opensuse.org
Am Fri, 1 Jul 2011 18:08:45 +0200 (CEST) schrieb Jan Engelhardt <jengelh@medozas.de>:
some packages in the openSUSE distribution do this (or equivalent) in their %post section:
%post getent passwd user >/dev/null || useradd user || :
darix says this is against policy (what a killer argument), but closely looking at what is happening, getent is just what is desired.
Just slap darix with the openSUSE Strategy page http://en.opensuse.org/openSUSE:Strategy#Community_and_People whenever he comes up with useless "policy" arguments :-) -- Stefan Seyfried "Dispatch war rocket Ajax to bring back his body!" -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-packaging+help@opensuse.org
On 07/01/2011 06:08 PM, Jan Engelhardt wrote:
darix says this is against policy (what a killer argument), but closely looking at what is happening, getent is just what is desired.
Please ask for the place where the "policy" is documented next time. :-) -- Best Regards / S pozdravom, Pavol RUSNAK SUSE LINUX, s.r.o openSUSE Boosters Team Lihovarska 1060/12 PGP 0xA6917144 19000 Praha 9 prusnak[at]opensuse.org Czech Republic -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-packaging+help@opensuse.org
participants (3)
-
Jan Engelhardt
-
Pavol Rusnak
-
Stefan Seyfried