[Clfs-dev] [CLFS-DEV] Embedded Ticket-924

Kirk Terrell knjterrell at mybluelight.com
Mon Jul 15 07:18:51 PDT 2013


On 07/15/2013 03:30 AM, Andrew Bradford wrote:
> On Sat, Jul 13, 2013, at 10:09 AM, Kirk Terrell wrote:
>> I've been experimenting with doing the embedded build without creating a
>> clfs user, and minimizing the need for root access - I think I've
>> managed by doing the following:
>>
>> 	* create-dir/creatingbuilddir.html: Using sudo to create the working
>> directory and then changing ownership to user
>
> If you create the working directory in your normal /home directory, does
> that reduced the need for sudo and chowning here?  That's how OE or
> Buildroot do it.

I believe that is correct. I use sudo at three points: making the 
directory, changing the ownership, and downloading packages - i put them 
in /usr/src for use across multiple projects.


>
>> 	* Skip final-preps/addinguser.html
>>
>> 	* final-preps/settingenvironment.html:	Adding HOME=/mnt/clfs to the
>> .bashrc file, and writing it to $CLFS/.bashrc
>
> Are you modifying your own .bashrc file?  I don't think that's a good
> idea.  We should just source a .bashrc-like file that clears the entire
> env and then sets everything correctly like is done today for the clfs
> user.  After this point the env will not really that useful for things
> other than cross-building, but I think that's OK.  Maybe we can modify
> PS1 to show this is a special shell?


Good point I am not modifying my own .bashrc - usually. the sequence of 
commands would be

	export HOME=/mnt/clfs

	cat > ~/.bashrc << "EOF"
  	set +h
	umask 022
	CLFS=/mnt/clfs
	HOME=/mnt/clfs
	LC_ALL=POSIX
	PATH=${CLFS}/cross-tools/bin:/bin:/usr/bin
	export CLFS LC_ALL PATH
	EOF


	bash --rcfile /mnt/clfs/.bashrc   note: this replaces su - clfs

	As one executes the rest of the book one is creating a specialized 
environment for cross-building.

>
>> 	* Execute the remainder of the book from bash --rcfile $CLFS/.bashrc.
>
> I believe this will still execute /etc/profile first before using the
> given .bashrc.  Is that what we want?

	I'm no bash expert, but I think I'm invoking bash as a non-login shell, 
which executes .bashrc. By using the --rcfile I am specifying what 
.bashrc to use. Currently when I invoke bash --rcfile /mnt/clfs/.bashrc 
my PS1 comes up as

	\s-\v\$		- which is the default value for bash.

For my regular bash shell it is:

	\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\u@\h:\w\$

I like the idea of a specific PS1 to flag the user that they are in a 
special shell.
		

>
>> 	* cleanup/remove-files.html: Copy files to the ${CLFS}/build/final
>> directory.
>>
>> 	* cleanup/chowning.html: Use fakeroot to execute
>
> We'll need to add fakeroot as a dependency on the host but this is a
> very good use of fakeroot :)
>
>> 	* cleanup/copy-to-target.html: Use fakeroot - one has to do the
>> chowning and copy as one fakeroot session.
>>
>> Do you think this is worth pursuing further?
>
> Yes!
> I'm very interested in getting away from having a special user, mostly
> because it's a pain for me when I'm building more than one book at a
> time and keeping everything straight.  Plus, none of the other build
> tools seem to make a special user just for this.
>
> Thanks for the great work!
> -Andrew
>
>

Having definitely run into issues with keeping $CLFS/.bashrc straight 
between builds I am a big fan of Ticket-924.




____________________________________________________________
1 Odd spice that FIGHTS diabetes
Can this unusual "super spice" control your blood sugar and fight diabetes&#63
http://thirdpartyoffers.netzero.net/TGL3341/51e404d6d01ee4d12c63st01vuc



More information about the Clfs-dev mailing list