chroot

Neven Has haski at sezampro.yu
Fri Jan 5 07:41:01 PST 2001


On Thu, Jan 04, 2001 at 11:56:20AM +0000, Bryan Dumm wrote:
> Anyways, let me know if anyone figures out more details about
> what we can/should do for chroot....

We have to be able to exit chroot while still running the backend. LFS require
that and in general we should allow it.

So instead of <chroot file="&LFS;"/> we should use (I prefer dir over file :) :

	<chroot dir="&LFS;">
		...
	</chroot>

I did a _quick test_ of the subroutine below and I think it works.

	sub chroot {
	        ($element, $e_element) = @_;
	        my $dir = $e_element->att('dir');

	        my $pid = fork;

	        if ($pid == 0) {
	                print "chrooting to $dir\n";
	                chroot $dir || print "Unable to chroot to $dir\n";
	                foreach ($e_element->children) {
	                        &{$_->gi} ($_->text, $_);
	                }
	                exit;
	        }

	        wait;
	}

Tell me what you think.

Neven







More information about the alfs-discuss mailing list