tazwok rev 407 4.3

Improve chroot configuration
author Antoine Bodin <gokhlayeh@slitaz.org>
date Fri Mar 04 06:23:07 2011 +0100 (2011-03-04)
parents 30d672e10274
children e1a89abb78b9
files TODO tazwok
line diff
     1.1 --- a/TODO	Fri Mar 04 06:01:31 2011 +0100
     1.2 +++ b/TODO	Fri Mar 04 06:23:07 2011 +0100
     1.3 @@ -13,9 +13,9 @@
     1.4  
     1.5  [ ] Removing check for $UNDIGEST in scan() subfunctions - define how theses functions should act before
     1.6  [ ] Don't check for repository used into update_packages_db() & erase_packages_info(); define this before.
     1.7 -[ ] Don't mount all theses /home/slitaz/... directories when chrooting: one is enough!
     1.8 +[*] Don't mount all theses /home/slitaz/... directories when chrooting: one is enough!
     1.9  [ ] Move files related to cooking env from packages to packages-incoming (just before releasing the beta)
    1.10 -[ ] Use variables for most used files
    1.11 +[*] Use variables for most used files
    1.12  	[*] cook-order.txt; wok-wanted.txt/wok-depends.txt of reference repository
    1.13  	[*] cooklist, commit, broken, blocked
    1.14  [ ] Rename wok-wanted.txt/wok-depends.txt to simply depends.txt/wanted.txt
     2.1 --- a/tazwok	Fri Mar 04 06:01:31 2011 +0100
     2.2 +++ b/tazwok	Fri Mar 04 06:23:07 2011 +0100
     2.3 @@ -2272,11 +2272,19 @@
     2.4  	cat > $LOCAL_REPOSITORY/tazchroot.conf << EOF
     2.5  # Tazchroot configuration file - created by tazwok.
     2.6  
     2.7 -# Default chroot path
     2.8 +# Local repository definition.
     2.9  SLITAZ_DIR=$SLITAZ_DIR
    2.10  SLITAZ_VERSION=$SLITAZ_VERSION
    2.11 -$( [ "$undigest" ] && echo "undigest=$undigest" )
    2.12 -LOCAL_REPOSITORY=$SLITAZ_DIR/$(if [ "$undigest" ]; then echo '$undigest'; else echo '$SLITAZ_VERSION'; fi)
    2.13 +LOCAL_REPOSITORY=$SLITAZ_DIR/${undigest:-$SLITAZ_VERSION}
    2.14 +${USE_ONLINE_PKG:+USE_ONLINE_PKG=$USE_ONLINE_PKG}
    2.15 +${undigest:+undigest=$undigest}
    2.16 +${ref_USE_ONLINE_PKG:+ref_USE_ONLINE_PKG=$ref_USE_ONLINE_PKG}
    2.17 +
    2.18 +# Chroot path.
    2.19 +# You can use a chroot into /tmp if it's mounted in RAM
    2.20 +# to speed-up the process, be sure you have a free GB.
    2.21 +# (minimal chroot is like 150~200MB, can be a lot more during cook)
    2.22 +# chroot_dir=/tmp/chroot-${undigest:-$SLITAZ_VERSION}
    2.23  chroot_dir=\$LOCAL_REPOSITORY/chroot
    2.24  
    2.25  # Default scripts path (theses scripts are added in the
    2.26 @@ -2284,7 +2292,7 @@
    2.27  script_dir=/usr/lib/slitaz/chroot-scripts/tazwok
    2.28  
    2.29  # List of directories to mount.
    2.30 -list_dir="$(for dir in packages wok src packages-incoming log flavors iso clean-wok; do echo $LOCAL_REPOSITORY/$dir; done)
    2.31 +list_dir="$LOCAL_REPOSITORY
    2.32  $SLITAZ_LOG$( [ "$undigest" ] && echo -e "\n$SLITAZ_DIR/$SLITAZ_VERSION/packages" )"
    2.33  
    2.34  create_chroot()
    2.35 @@ -2300,8 +2308,10 @@
    2.36  	sed -e "s~^SLITAZ_DIR=.*~SLITAZ_DIR=\$SLITAZ_DIR~" \\
    2.37  		-e "s/^SLITAZ_VERSION=.*/SLITAZ_VERSION=\$SLITAZ_VERSION/" \\
    2.38  		-i \$chroot_dir/etc/slitaz/slitaz.conf
    2.39 +	echo "\$SLITAZ_VERSION" > /etc/slitaz-release
    2.40  $( [ "$undigest" ] && echo '	echo "undigest='"$undigest"'" >> $chroot_dir/etc/slitaz/tazwok.conf')
    2.41  	sed 's/LC_ALL/LC_ALL=POSIX/' -i \$chroot_dir/etc/profile
    2.42 +
    2.43  	# The build bot may run in a sandbox: link sandbox lockfile
    2.44  	ln -s \$LOCAL_REPOSITORY/sandbox/proc/1 \$chroot_dir/proc/1
    2.45  }
    2.46 @@ -2309,11 +2319,22 @@
    2.47  mount_chroot()
    2.48  {
    2.49  	cp -a /etc/resolv.conf \$chroot_dir/etc/resolv.conf
    2.50 -	echo "\$LOCAL_REPOSITORY/packages" > \$chroot_dir\$LOCALSTATE/mirror
    2.51 +	$( if [ "$USE_ONLINE_PKG" ]; then
    2.52 +		echo '	echo "$USE_ONLINE_PKG" > $chroot_dir$LOCALSTATE/mirror'
    2.53 +	else
    2.54 +		echo '	echo $LOCAL_REPOSITORY/packages" > $chroot_dir$LOCALSTATE/mirror'
    2.55 +	fi
    2.56 +	)
    2.57  	mkdir -p \$chroot_dir\$LOCALSTATE/undigest/\${LOCAL_REPOSITORY##*/}-incoming
    2.58  	echo "\$LOCAL_REPOSITORY/packages-incoming" > \$chroot_dir\$LOCALSTATE/undigest/\${LOCAL_REPOSITORY##*/}-incoming/mirror
    2.59 -$( [ "$undigest" ] && echo '	mkdir -p $chroot_dir$LOCALSTATE/undigest/$SLITAZ_VERSION
    2.60 -	echo "$SLITAZ_DIR/$SLITAZ_VERSION/packages" > $chroot_dir$LOCALSTATE/undigest/$SLITAZ_VERSION/mirror' )
    2.61 +	$( [ "$undigest" ] || continue
    2.62 +	echo '	mkdir -p $chroot_dir$LOCALSTATE/undigest/$SLITAZ_VERSION'
    2.63 +	if [ "$ref_USE_ONLINE_PKG" ]; then
    2.64 +		echo '	echo "$ref_USE_ONLINE_PKG" > $chroot_dir$LOCALSTATE/undigest/$SLITAZ_VERSION/mirror'
    2.65 +	else
    2.66 +		echo '	echo "$ref_LOCAL_REPOSITORY/packages" > $chroot_dir$LOCALSTATE/undigest/$SLITAZ_VERSION/mirror'
    2.67 +	fi
    2.68 +	)
    2.69  	echo -e "\${LOCAL_REPOSITORY##*/}-incoming\nmain" > \$chroot_dir\$LOCALSTATE/priority
    2.70  	mount -t proc proc \$chroot_dir/proc
    2.71  	mount -t sysfs sysfs \$chroot_dir/sys