slitaz-dev-tools annotate tazchroot/tazchroot.conf @ rev 29

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