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
chmod +x script_file
cat > /home/chroot/chroot_script.sh << "EOF"<br />#!/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"
cat > /usr/bin/tazchroot << "EOF"<br />#!/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
It looks like you're new here. If you want to get involved, click one of these buttons!