Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
en:guides:chroot [2010/05/04 17:19] jozee |
en:guides:chroot [2010/09/24 21:17] linea |
||
---|---|---|---|
Line 5: | Line 5: | ||
===== With Tazdev ===== | ===== With Tazdev ===== | ||
- | Over time the SliTaz developers created tools for the automation of various tasks. The slitaz-dev-tools package provides the tazdev utility and its configuration file /etc/slitaz/tazdev.conf, it can create a chroot to use: | + | Over time the SliTaz developers created tools for the automation of various tasks. The slitaz-dev-tools package provides the tazdev utility and its configuration file /etc/slitaz/tazdev.conf; it can create a chroot to use: |
<code> | <code> | ||
Line 13: | Line 13: | ||
</code> | </code> | ||
- | By default the chroot is created in /home/slitaz/cooking/chroot and is slitaz-based. For more info and available commands you can use 'tazdev use' and/or take a look at the configuration file. | + | By default the chroot is created in ///home/slitaz/cooking/chroot// and is slitaz-based. For more info and available commands you can use 'tazdev usage' and/or take a look at the configuration file. |
===== Create the chroot ===== | ===== Create the chroot ===== | ||
- | <code>mkdir /home/chroot | + | <file> |
+ | #!/bin/sh | ||
+ | mkdir /home/chroot | ||
# You can mount a device to /home/chroot | # You can mount a device to /home/chroot | ||
# with mountbox or mount | # with mountbox or mount | ||
Line 25: | Line 27: | ||
tazpkg get-install tazpkg --root="/home/chroot" | tazpkg get-install tazpkg --root="/home/chroot" | ||
tazpkg get-install lzma --root="/home/chroot" | tazpkg get-install lzma --root="/home/chroot" | ||
- | mkdir /home/chroot/home/slitaz</code> | + | mkdir /home/chroot/home/slitaz</file> |
Note, you can keep these lines in a script file if needed. Just add #!/bin/sh to the first line and make executable with: | Note, you can keep these lines in a script file if needed. Just add #!/bin/sh to the first line and make executable with: | ||
- | <code>chmod +x script_file</code> | + | <code># chmod +x script_file</code> |
===== Add a script file to automate some actions ===== | ===== Add a script file to automate some actions ===== | ||
- | <code>cat > /home/chroot/chroot_script.sh << "EOF" | + | <code># cat > /home/chroot/chroot_script.sh << "EOF"</code> |
+ | <file> | ||
#!/bin/sh | #!/bin/sh | ||
/bin/sh --login | /bin/sh --login | ||
Line 41: | Line 44: | ||
EOF | EOF | ||
- | chmod +x "/home/chroot/chroot_script.sh"</code> | + | </file> |
+ | <code># chmod +x "/home/chroot/chroot_script.sh"</code> | ||
Note, /bin/sh --login logs you into the chrooted environment. The commands after that auto-remove any packages added when cooking on exit. You can hack this file to execute various automated actions when entering and exiting the chroot. | Note, /bin/sh --login logs you into the chrooted environment. The commands after that auto-remove any packages added when cooking on exit. You can hack this file to execute various automated actions when entering and exiting the chroot. | ||
Line 47: | Line 51: | ||
===== Add a script to mount and umount chroot ===== | ===== Add a script to mount and umount chroot ===== | ||
- | <code>cat > /usr/bin/tazchroot << "EOF" | + | <code># cat > /usr/bin/tazchroot << "EOF"</code> |
+ | <file> | ||
#!/bin/sh | #!/bin/sh | ||
cat /etc/resolv.conf > /home/chroot/etc/resolv.conf | cat /etc/resolv.conf > /home/chroot/etc/resolv.conf | ||
Line 72: | Line 77: | ||
fi | fi | ||
EOF | EOF | ||
- | chmod +x /usr/bin/tachroot</code> | + | </file> |
+ | <code># chmod +x /usr/bin/tazchroot</code> | ||
- | Note, this script mounts /home/slitaz in your chroot, so you can use tazwok as if it was in your normal environment. | + | Note, this script mounts ///home/slitaz// in your chroot, so you can use tazwok as if it was in your normal environment. |
---- | ---- |