cvs commit: ALFS/profiles/LFS/chapter05 addinguser.xml

Kevin P. Fleming kpfleming at
Mon Jan 26 18:26:50 PST 2004

jamie at wrote:

>    <stage name="Adding lfs user">
>   -	<execute command="id -u &lfs-user; &> /dev/null || useradd -s /bin/bash -m &lfs-user;" />
>   +	<execute command="id -u &lfs-user; &> /dev/null || useradd -s /bin/bash -m -k /dev/null &lfs-user;" />
>    	<execute command="echo &lfs-user;:&lfs-password; | chpasswd" />

Here's something I ran into in my own profile... the chpasswd command is 
always run, even if the &lfs-user; user already existed. Given the 
current lack of <if>/<then> in nALFS, the only way I could fix this was 
to modify the first <execute> to use this as the command (watch the line 
wrapping, this is all one line):

id -u &lfs-user; &> /dev/null || (useradd -s /bin/bash -m &lfs-user; 
&& echo &lfs-user;:&lfs-password; | chpasswd)

This is pretty ugly, but I couldn't find an easier way to do it.

More information about the alfs-log mailing list