This is an old revision of the document!
Table of Contents
Chroot
I use a minimal chroot (tazwok + slitaz-toolchain) to verify build_deps of receipts. I build the chroot in my home USB in live session to save ram. I also use a script to remove all packages installed during cooking at exit, because I want to keep a minimal environnment for testing build_deps.
Create the chroot
mkdir /home/chroot # You can mount a device to /home/chroot # with mountbox or mount tazpkg get-install busybox --root="/home/chroot" echo "No" | tazpkg get-install bash --root="/home/chroot" tazpkg get-install slitaz-toolchain --root="/home/chroot" tazpkg get-install tazwok --root="/home/chroot" tazpkg get-install tazpkg --root="/home/chroot" tazpkg get-install lzma --root="/home/chroot" mkdir /home/chroot/home/slitaz
Note : you can keep theses lines in a script file if needed. Just add #!/bin/sh in first line and make executable with :
chmod +x script_file
Add a script file to automate some actions
cat > /home/chroot/chroot_script.sh << "EOF" #!/bin/sh /bin/sh --login for pkg in $(cat /var/log/tazpkg.log | grep -v Removed | sed 's/\(.*\)\(- Installed - \)\(.*\)\( (.*\)/\3/'); do echo "y" | tazpkg remove $pkg done rm /var/log/tazpkg.log EOF chmod +x "/home/chroot/chroot_script.sh"
Note: /bin/sh –login log you in the chrooted environnment. The commands after that line auto-remove packages added when cooking at exit. You can hack this file to execute various automated actions when entering and exiting chroot.
Add a script to mount and umount chroot
cat > /usr/bin/tazchroot << "EOF" #!/bin/sh cat /etc/resolv.conf > /home/chroot/etc/resolv.conf if [ ! -d "/home/chroot/proc/1" ]; then echo "Mounting virtual filesystems..." mount -t proc proc /home/chroot/proc mount -t sysfs sysfs /home/chroot/sys mount -t devpts devpts /home/chroot/dev/pts mount -t tmpfs shm /home/chroot/dev/shm mount /home/slitaz /home/chroot/home/slitaz chroot /home/chroot ./chroot_script.sh until [ "$ps" = "2" ]; do echo "Waiting for the end of all other chroot process..." ps=$(ps | grep `basename $0` | grep -v grep | grep -v basename | wc -l) sleep 1 done umount /home/chroot/home/slitaz umount /home/chroot/dev/shm umount /home/chroot/dev/pts umount /home/chroot/sys umount /home/chroot/proc else echo "The chroot is already mounted" fi EOF chmod +x /usr/bin/tachroot
Note : This script mount /home/slitaz in you're chroot, so you can use tazwok as if it is on you're normal environnment.