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

Re: test if user exists in postinst

Radovan Garabik (2001-04-09 22:29:44 +0200) :

> What is the best way of testing (and adding) a new username in
> postinst?

,----[ man adduser ]
|    Add a system user
|        If  called  with  one non-option argument and the --system
|        option, adduser will add a system user. If an user with an
|        uid  in the system range (or if the uid is specified, with
|        that) does already exist, adduser will exist silently.

Which means you can test the return value of adduser: 0 means OK (user
created or already existing the way you're trying to create it), non-0
means problem creating.

  This is the method I'm using for the Sourceforge package, and it
seems to work exactly the expected way.

Roland Mas

Magic is one thing, and reflected-sound-of-underground-spirits is another.
  -- Twoflower, in The Colour of Magic (Terry Pratchett)

Reply to: