nALFS feature request

timothy bauscher timothy at
Wed May 15 14:07:15 PDT 2002

Neven Has <haski at sezampro.yu> spake:

> > what do you think about a possibility to check wether a user or
> group
> > exists and only make it if it does not exist, kinda like mkdir -p?

useradd and groupadd will not add a user or
a group which already exists.

> For this, we would have to add a separate element for useradd/groupadd
> and an option to do it.
> Or, you could use something like:
> <execute><command>
>     if [ "`grep ^lfs /etc/passwd`" = "" ] ; then
>         useradd -s /bin/bash -m &lfs-user;
>     fi
> </command></execute>
> There is probably a better way for the above (and it's not tested),
> but you get the idea... :)

what if you had a user named bolfsi? wouldn't the
above cause problems? i think this would be more
appropriate for checking if the user lfs exists:

if [ "`cut -d: -f1 /etc/passwd | grep -x lfs`" = "" ];
    useradd ...;


-*- "Share and Enjoy" || "Go stick your head in a pig" -*-
Unsubscribe: send email to listar at
and put 'unsubscribe alfs-discuss' in the subject header of the message

More information about the alfs-discuss mailing list