nALFS feature request

Neven Has haski at sezampro.yu
Wed May 15 14:40:46 PDT 2002


On Wed, May 15, 2002 at 05:07:15PM -0400, timothy bauscher wrote:
> > > 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.

Yeah, but they will exit with an error. I think that's what Raphael
wanted to avoid. But you have a point, since:

    <execute>
        <command>useradd</command>
        <param>-s /bin/bash</param>
        <param>-m</param>
        <param>&lfs-user;</param>
        <param>|| true</param>
    </execute>

can be used for that.

Brendan Taylor suggested that "|| true", AFAICF (could find ;).

> > <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 don't think it would, because of that ^. But it would, if there is
a user "lfser". :) So I think:

    grep '^lfs:' /etc/passwd

would work (where lfs should be &lfs-user; in general).


Neven

-- 
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