[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Chroot woody setup in 15 minutes



On 17 Oct 2000, Ben Gertzfield wrote:

> >>>>> "Joey" == Joey Hess <joeyh@debian.org> writes:
> 
>     Daniel> I absent-mindedly compiled lbreakout against the X4
>     Daniel> libraries.  Doh!  The obvious solution is to install a
>     Daniel> clean build system (which I probably ought to do
>     Daniel> anyway..), but I have a number of course deadlines and
>     Daniel> midterms this week and can't get to it immediately :(
> 
>     Joey> Someone else has probably already volenteered (hard to tell
>     Joey> when you're reading mail offline), but I thought I'd
>     Joey> volenteer and also point out that it takes about 15 minutes
>     Joey> to set up a base chroot system you can cleanly build
>     Joey> anything in.
> 
> Joey is right. Doing a chroot woody setup really does only take
> about 15 minutes. Here's some rough notes on what I had to do
> to set one up on my potato box; I did GIMP builds there with no
> problems.
> 
> 1) download base2_2.tgz
> 2) as root, untar in safe place (homedir, /usr/local/woody, whatever)
> 3) as root, chroot /usr/local/woody /bin/sh
> 4) mount proc -t proc /proc
> 5) put name servers in /etc/resolv.conf
> 6) put the REAL machine name in /etc/hostname. run hostname -F /etc/hostname. Copy /etc/hosts from real machine.
> 7) edit /etc/apt/sources.list, change stable to unstable, comment-out security.debian.org
> 8) use *dselect* to Update and install build-essential.. removing tetex packages and emacs20 and doc-linux-text is helpful to reduce size -- for some reason dpkg-dev won't install with apt, but dselect is ok

Once you get the chroot configured with apt, the following script is helpful
to automate the above(allows for easy start/stop, and keeps the chroot in a
semi-updated state with the host).

---
#!/bin/sh -e
if [ -e /etc/init.d/$(basename $0) ]; then
	# starting inside chroot
	hostname -F /etc/hostname
	exec /bin/sh --login
else
	# starting outside the chroot
	dir=$(dirname $0)
	files="/etc/resolv.conf /etc/hosts /etc/hostname"
	for f in $files; do
		cp $f $dir/$f
	done
	mount proc -t proc $dir/proc
	chroot $dir /etc/init.d/$(basename $0)
	umount $dir/proc
fi
---

The file can be named anything, but it must exist in $chroot_base/etc/init.d/.


----BEGIN GEEK CODE BLOCK----
Version: 3.12
GCS d- s: a-- c+++ UL++++ P+ L++++ !E W+ M o+ K- W--- !O M- !V PS--
PE++ Y+ PGP++ t* 5++ X+ tv b+ D++ G e h*! !r z?
-----END GEEK CODE BLOCK-----
----BEGIN PGP INFO----
Adam Heath <doogie@debian.org>        Finger Print | KeyID
67 01 42 93 CA 37 FB 1E    63 C9 80 1D 08 CF 84 0A | DE656B05 PGP
AD46 C888 F587 F8A3 A6DA  3261 8A2C 7DC2 8BD4 A489 | 8BD4A489 GPG
-----END PGP INFO-----



Reply to: