nALFS feature request

timothy bauscher timothy at foce.eiomail.com
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`" = "" ];
then
    useradd ...;
fi


-- 
tab
timothy(at)foce.eiomail.com  www.linuxfromscratch.org

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



More information about the alfs-discuss mailing list