SliTaz GNU/Linux official and community documentation wiki.
.png

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
en:guides:chroot [2010/03/19 21:22]
gokhlayeh Add chroot guide
en:guides:chroot [2010/09/24 21:17] (current)
linea
Line 1: Line 1:
 ====== Chroot ======= ====== Chroot =======
  
-This guide explain how to setup a chroot to cook packages in a separate ​environnment. The chroot can be build on a USB or HDD device to save RAM when using live session. There is also a script ​wich remove all packages installed during cooking ​at exit in order to keep the chroot light and check build_depends.+This guide explain how to setup a chroot to cook packages in a separate ​environment. The chroot can be built on a USB or HDD device to save RAM when using live session. There is also a script ​which removes any packages installed during cooking ​on exit in order to keep the chroot light and also checks the build_depends
 + 
 +===== 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: 
 + 
 +<​code>​ 
 +# tazpkg get-install slitaz-dev-tools 
 +# tazdev gen-chroot 
 +# tazdev chroot 
 +</​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 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 13: 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 theses ​lines in a script file if needed. Just add #​!/​bin/​sh ​in first line and make executable with : +Noteyou 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 29: 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 ​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.+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.
  
 ===== 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 47: Line 64:
  chroot /​home/​chroot ./​chroot_script.sh  chroot /​home/​chroot ./​chroot_script.sh
  until [ "​$ps"​ = "​2"​ ]; do  until [ "​$ps"​ = "​2"​ ]; do
- echo "​Waiting for the end of all other chroot ​process..."+ echo "​Waiting for the end of all other chroot ​processes..."
  ps=$(ps | grep `basename $0` | grep -v grep | grep -v basename | wc -l)  ps=$(ps | grep `basename $0` | grep -v grep | grep -v basename | wc -l)
  sleep 1  sleep 1
Line 60: 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. 
 + 
 +----  
 +\\ 
 +^  Page Review Section ​ ^^  
 +|Quality| Good  | 
 +|Review| Minor Updates ​ | 
 +|Priority| Medium | 
 +|Problems| add a [[http://​forum.slitaz.org|forum post link]]| 
 +|:::     | OR add a [[http://​labs.slitaz.org/​issues |lab issue tracker link ]]| 
 +|How to Improve| Suggest briefly| 
 +|::: |  |
  
-Note : This script mount /​home/​slitaz in you're chroot, so you can use tazwok as if it is on you're normal environnment.+\\ 
 +----
 
en/guides/chroot.1269030146.txt.gz · Last modified: 2010/07/08 17:17 (external edit)