slitaz-dev-tools view tazchroot/tazchroot.conf @ rev 26

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