slitaz-dev-tools annotate tazchroot/tazchroot.conf @ rev 32
tazchroot: fix config file to not screw /dev/pts permissions
author | Antoine Bodin <gokhlayeh@slitaz.org> |
---|---|
date | Thu Mar 10 18:23:38 2011 +0100 (2011-03-10) |
parents | 5de4cfa5296c |
children | 7392e83f539c |
rev | line source |
---|---|
paul@31 | 1 # Tazchroot configuration file. |
paul@31 | 2 # Allows you to build a chrooted cooking environnment using the last |
paul@31 | 3 # available package version. |
slaxemulator@11 | 4 |
paul@31 | 5 # Use SliTaz version. |
slaxemulator@11 | 6 SLITAZ_VERSION=cooking |
slaxemulator@11 | 7 |
paul@31 | 8 # SLITAZ_DIR (it's mounted on chroot). |
slaxemulator@11 | 9 SLITAZ_DIR=/home/slitaz |
slaxemulator@11 | 10 |
paul@31 | 11 # Chroot path. |
gokhlayeh@25 | 12 chroot_dir=$SLITAZ_DIR/$SLITAZ_VERSION/sandbox |
gokhlayeh@25 | 13 |
paul@31 | 14 # Online repository path. |
paul@31 | 15 # Actually Pankso provides a mirror of packages being cooked on tank, |
paul@31 | 16 # waiting to have them on http://mirror.slitaz.org/packages/cooking |
gokhlayeh@25 | 17 MIRROR=http://people.slitaz.org/~pankso/packages/ |
slaxemulator@11 | 18 |
slaxemulator@11 | 19 # Default SliTaz paths. |
slaxemulator@11 | 20 LOCALSTATE=/var/lib/tazpkg |
slaxemulator@11 | 21 INSTALLED=$LOCALSTATE/installed |
slaxemulator@11 | 22 |
paul@31 | 23 # Webserver path. |
paul@31 | 24 # Defines where the webserver should be located. |
gokhlayeh@25 | 25 # You have to use the same setup inside & outside the chroot. |
gokhlayeh@25 | 26 # Here we use the default setup. |
paul@31 | 27 # The host system needs php installed to make it work. |
paul@31 | 28 # Uncomment the following line to use this option. |
gokhlayeh@29 | 29 WEBSERVER="/var/www/vhosts/bb" |
slaxemulator@11 | 30 |
paul@31 | 31 # Default scripts path (these scripts are added to the |
slaxemulator@11 | 32 # $chroot_dir/usr/bin and can be called with tazchroot script) |
slaxemulator@11 | 33 script_dir="/usr/lib/slitaz/chroot-scripts/tazchroot" |
slaxemulator@11 | 34 |
slaxemulator@11 | 35 # List of directories to mount. |
paul@31 | 36 # They are mounted to an equivalent location in the chroot. |
slaxemulator@11 | 37 # (one per line) |
gokhlayeh@25 | 38 list_dir="$SLITAZ_DIR |
gokhlayeh@25 | 39 $WEBSERVER" |
slaxemulator@11 | 40 |
slaxemulator@11 | 41 create_chroot() |
slaxemulator@11 | 42 { |
slaxemulator@11 | 43 # Warning message. |
paul@31 | 44 echo -en "\\033[1;31mWarning:\\033[0m this script is going to use another packages repository other \ |
paul@31 | 45 than the one you generally use. Please don't install packages until the chroot is created or it will \ |
paul@31 | 46 screw your main system. Don't continue to run this script if you're installing something. |
slaxemulator@11 | 47 |
gokhlayeh@26 | 48 Continue to run (type 'yes' to continue) ? " | fold -s; read answer |
slaxemulator@11 | 49 [ "$answer" = yes ] || exit |
slaxemulator@11 | 50 |
slaxemulator@11 | 51 if [ -f "$LOCALSTATE/priotity" ]; then |
slaxemulator@11 | 52 mv $LOCALSTATE/priotity $LOCALSTATE/priority.tmp-bak |
slaxemulator@11 | 53 fi |
slaxemulator@11 | 54 tazpkg add-undigest tmp.$SLITAZ_VERSION.mirror "$MIRROR" |
slaxemulator@11 | 55 echo "tmp.$SLITAZ_VERSION.mirror" > /var/lib/tazpkg/priority |
slaxemulator@11 | 56 tazpkg recharge |
slaxemulator@11 | 57 |
slaxemulator@11 | 58 # Install needed packages. |
gokhlayeh@29 | 59 mkdir -p $chroot_dir |
slaxemulator@11 | 60 tazpkg get-install busybox --root="$chroot_dir" |
slaxemulator@11 | 61 tazpkg get-install tazchroot --root="$chroot_dir" |
slaxemulator@11 | 62 tazpkg get-install tazpkg --root="$chroot_dir" |
gokhlayeh@29 | 63 tazpkg get-install tazwok --root="$chroot_dir" |
slaxemulator@11 | 64 tazpkg get-install libtaz --root="$chroot_dir" |
slaxemulator@11 | 65 |
slaxemulator@11 | 66 rm -r $LOCALSTATE/undigest/tmp.$SLITAZ_VERSION.mirror |
slaxemulator@11 | 67 if [ -f "$LOCALSTATE/priotity.tmp-bak" ]; then |
slaxemulator@11 | 68 mv -f $LOCALSTATE/priotity.tmp-bak $LOCALSTATE/priority |
slaxemulator@11 | 69 fi |
slaxemulator@11 | 70 tazpkg recharge |
slaxemulator@11 | 71 |
paul@31 | 72 echo -e "\\033[1;31mWarning:\\033[0m Your SliTaz repository configuration is now \ |
paul@31 | 73 back to a normal state." | fold -s |
slaxemulator@11 | 74 } |
slaxemulator@11 | 75 |
slaxemulator@11 | 76 mount_chroot() |
slaxemulator@11 | 77 { |
slaxemulator@11 | 78 # resolv.conf is needed to have network access into chroot. |
slaxemulator@11 | 79 cp -a /etc/resolv.conf "$chroot_dir/etc/resolv.conf" |
slaxemulator@11 | 80 |
slaxemulator@11 | 81 # Setup mirror for chroot. |
slaxemulator@11 | 82 echo "$MIRROR" > "$chroot_dir/var/lib/tazpkg/mirror" |
slaxemulator@11 | 83 |
slaxemulator@11 | 84 # Setup release. |
slaxemulator@11 | 85 echo "$SLITAZ_VERSION" > "$chroot_dir/etc/slitaz-release" |
slaxemulator@11 | 86 |
slaxemulator@11 | 87 # Webserver setup. |
gokhlayeh@29 | 88 if [ "$WEBSERVER" ]; then |
gokhlayeh@29 | 89 mkdir -p /usr/lib/slitaz |
gokhlayeh@29 | 90 [ -d /usr/share/slitaz/web-bb ] || [ -L /usr/share/slitaz/web-bb ] || |
gokhlayeh@29 | 91 ln -s $chroot_dir/usr/share/slitaz/web-bb /usr/share/slitaz/web-bb |
slaxemulator@11 | 92 |
paul@31 | 93 # Make tazwok act as if php/lighttpd were installed into the sandbox. |
gokhlayeh@29 | 94 mkdir -p $chroot_dir$INSTALLED/php |
gokhlayeh@29 | 95 mkdir -p $chroot_dir$INSTALLED/lighttpd |
gokhlayeh@29 | 96 fi |
gokhlayeh@29 | 97 |
paul@31 | 98 # Mount system directories. |
gokhlayeh@32 | 99 mount -o bind /proc $chroot_dir/proc |
gokhlayeh@32 | 100 mount -o bind /sys $chroot_dir/sys |
gokhlayeh@32 | 101 mount -o bind /dev/pts $chroot_dir/dev/pts |
gokhlayeh@32 | 102 mount -o bind /dev/shm $chroot_dir/dev/shm |
slaxemulator@11 | 103 |
slaxemulator@11 | 104 # Mount directories of LIST_DIR. |
slaxemulator@11 | 105 # Create them if needed to avoid errors. |
slaxemulator@11 | 106 for dir in $list_dir; do |
slaxemulator@11 | 107 mkdir -p $dir |
slaxemulator@11 | 108 mkdir -p $chroot_dir$dir |
slaxemulator@11 | 109 mount $dir $chroot_dir$dir |
slaxemulator@11 | 110 done |
slaxemulator@11 | 111 } |
slaxemulator@11 | 112 |
slaxemulator@11 | 113 umount_chroot() |
slaxemulator@11 | 114 { |
slaxemulator@11 | 115 # First umount directories of LIST_DIR. |
slaxemulator@11 | 116 for dir in $list_dir; do |
slaxemulator@11 | 117 umount $chroot_dir$dir |
slaxemulator@11 | 118 done |
slaxemulator@11 | 119 |
slaxemulator@11 | 120 # Then umount system directories. |
slaxemulator@11 | 121 umount $chroot_dir/dev/shm |
slaxemulator@11 | 122 umount $chroot_dir/dev/pts |
slaxemulator@11 | 123 umount $chroot_dir/sys |
slaxemulator@11 | 124 umount $chroot_dir/proc |
slaxemulator@11 | 125 } |