On Fri Jun 06, 2003 at 06:11:08PM +0200, Buchan Milne wrote: > It's slightly off-topic, but since samba-3.0beta1 should be released > soon, I would like to compile packages on a few releases, and it would > be convenient to build in chroot (since my desktop has the space for a > few releases, and other build boxes are very slow ...). > > Could one of the enlightened (Vince, Olivier?) post a brief summary of > what needs to be done to be able to build in a chroot? Ideally it should > go in one of the wiki's ...
There is likely a better way than my method, but I only have to accomodate
one or two users. I just install whatever distrib I'm interested onto a
partition (the whole thing, no extra dirs) and then mount it as, for
example, /mnt/9.1
Then I have a script that does the chroot using sudo:
#!/usr/bin/env zsh
if [ -z "$SUDO_USER" ]; then
echo "$0 must be called from sudo"
exit 1
fi
[[ $UID == 0 || -n $TEST ]] || {
echo "You must be root or run $BASENAME via sudo"
exit 1;
}
/usr/sbin/chroot $1 su - $SUDO_USER
That script does the chroot and then dumps you in your homedir (ie. if I did
it as vdanen, I would end up in ~vdanen/ in the chroot). I have sudo setup
to mount /proc for the packages that require it mounted (MySQL comes to
mind).
There is likely a better way to do it... ie. a way to have certain things
running, like ssh, to respond to a certain port so you can ssh into a
"static" chroot. I've just never gotten around to doing anything like that
(I'd rather use UML, but just need to find the time to figure it out).
--
MandrakeSoft Security; http://www.mandrakesecure.net/
Online Security Resource Book; http://linsec.ca/
"lynx -source http://linsec.ca/vdanen.asc | gpg --import"
{FE6F2AFD : 88D8 0D23 8D4B 3407 5BD7 66F9 2043 D0E5 FE6F 2AFD}
pgp00000.pgp
Description: PGP signature
