On Mon, Apr 09, 2001 at 06:01:08PM -0400, Matt Zimmerman wrote: > > I am cleaning up my packages, and one improvement > > I want to add is that network daemon runs under its > > own UID, not nobody (as it was until now). > > > > What is the best way of testing (and adding) a new username > > in postinst? > > > > I am using something like this: > > if ! grep -q '^xtelld:' /etc/passwd; then > > adduser --quiet --system --no-create-home --disabled-password --home > > /tmp --gecos "xtell daemon" xtelld > > fi > > > > the test for already existing user is not ideal, since > > users can be stored somewhere else (ldap, nis,...) > > Try testing the exit code of 'id -u <user>'. That should work anywhere. > Or, rewrite your maintainer script in perl and use getpwnam().
Anything else that uses getpwnam() would work :) for example, exit code of `getent passwd <user>`. -- Digital Electronic Being Intended for Assassination and Nullification