Polkit useradd command question

Wayne Blaszczyk wblaszcz at bigpond.net.au
Thu Jul 1 02:30:34 PDT 2010


On 01/07/10 18:05, Nathan Coulson wrote:
> I noted that the book contained
> 
> groupadd -fg 27 polkituser &&
> useradd -c "Policy Kit Daemon User" -d /dev/null -u 27 \
>     -g polkituser -s /bin/false polkituser || [ $? == 9 ]
> 
> is the [? == 9] just to change the command to true if the useradd
> command fails?  I have not seen BLFS do this anywhere else.
> 
I must admit that I put this in.
It changes the exit status to true only if the command fails due to the
user account already existing. All other failures due to other reasons
should come back as false. This was put in for those of us that auto
script these instructions in the event that the package could be
re-installed without false failures.
The groupadd command has a -f switch which takes care of this problem in
a nicer way. Not sure why the useradd command hasn't got this option.
Wayne.



More information about the blfs-dev mailing list