On Fri, Nov 02, 2001 at 04:23:54PM +0100, Tollef Fog Heen wrote: > In order to ensure that the list user exists in the system password > tables, I need to check that, using the functions in libnss, so > grepping /etc/{passwd,group} doesn't work. > So, I use the following: > if ! python -c 'import grp; print pwd.getgrnam("list")' > /dev/null 2>&1 ; then > for checking that the group exists. I have a similar line for > checking that the list user exists. (I am not really sure why those > are in the preinst instead of the postinst, but I guess they are for > historical reasons and it has a function). > This is well, but I need to have it discussed on -devel, according to > policy, before I add that Pre-Depend. So, unless anybody tells me > that it is wrong and I should do it in some other way, I will add that > Pre-Depend. More straightforward than using python is to use the 'getent' command, provided by libc6. $ getent group list list:x:38: $ libc6 is not an essential package (and the package name is different on different architectures), but it's a pre-dependency of other essential packages, which should be close enough. Steve Langasek postmodern programmer
Attachment:
pgpBMXmxTXYjF.pgp
Description: PGP signature