tazlito rev 418

tazlito: setup_mirrors(): fix creating mirrors in the case of using in chroot
author Aleksej Bobylev <al.bobylev@gmail.com>
date Mon Mar 14 14:13:11 2016 +0200 (2016-03-14)
parents 9d0d7bf20e90
children b6fd50633850
files tazlito
line diff
     1.1 --- a/tazlito	Mon Mar 14 00:56:29 2016 +0200
     1.2 +++ b/tazlito	Mon Mar 14 14:13:11 2016 +0200
     1.3 @@ -31,7 +31,7 @@
     1.4  INSTALLED="$LOCALSTATE/installed"
     1.5  CACHE_DIR='/var/cache/tazpkg'
     1.6  MIRROR="$LOCALSTATE/mirror"
     1.7 -DEFAULT_MIRROR="http://mirror.slitaz.org/packages/$(cat /etc/slitaz-release)/"
     1.8 +DEFAULT_MIRROR="http://mirror1.slitaz.org/packages/$(cat /etc/slitaz-release)/"
     1.9  
    1.10  log='/var/log/tazlito.log'
    1.11  if [ $(id -u) -eq 0 ]; then
    1.12 @@ -1284,11 +1284,6 @@
    1.13  
    1.14  setup_mirrors() {
    1.15  	# Setup mirrors in plain system or in chroot (with variable root=)
    1.16 -	#
    1.17 -	# Note, difficulties exists in using local-filesystem-mirrors (when content
    1.18 -	# of the 'mirror' file is point to folder somewhere in the FS) inside chroot,
    1.19 -	# because mirror should be in the chroot too. We make local mirrors to be
    1.20 -	# accessible via http://localhost/... using built-in SliTaz web server.
    1.21  	local mirrorlist="$1" fresh repacked
    1.22  	local undigest="$root$LOCALSTATE/undigest" priority="$root$LOCALSTATE/priority"
    1.23  
    1.24 @@ -1305,11 +1300,9 @@
    1.25  	# Packages produced by CookUtils: on Tank or local, or repacked packages: highest priority
    1.26  	fresh='/home/slitaz/packages'
    1.27  	if [ -d "$fresh" ]; then
    1.28 -		# Make this mirror accessible using http://localhost/tazlito/fresh
    1.29 -		ln -s "$fresh" '/var/www/tazlito/fresh'
    1.30  		# Setup first undigest mirror
    1.31  		mkdir -p "$undigest/fresh"
    1.32 -		echo 'http://localhost/tazlito/fresh/' > "$undigest/fresh/mirror"
    1.33 +		echo "$fresh" > "$undigest/fresh/mirror"
    1.34  		echo 'fresh' >> "$priority"
    1.35  		# Rebuild mirror DB if needed
    1.36  		[ ! -e "$fresh/IDs" ] && tazpkg mkdb "$fresh" --forced --root=''
    1.37 @@ -1329,11 +1322,9 @@
    1.38  		# PACKAGES_REPOSITORY="$WORK_DIR/packages"
    1.39  		# It MAY or MAY NOT match /home/slitaz/packages, so here we setup second repository
    1.40  
    1.41 -		# Make this mirror accessible using http://localhost/tazlito/repacked
    1.42 -		ln -s "$repacked" '/var/www/tazlito/repacked'
    1.43  		# Setup second undigest mirror
    1.44  		mkdir -p "$undigest/repacked"
    1.45 -		echo 'http://localhost/tazlito/repacked/' > "$undigest/repacked/mirror"
    1.46 +		echo "$repacked" > "$undigest/repacked/mirror"
    1.47  		echo 'repacked' >> "$priority"
    1.48  		# Rebuild mirror DB if needed
    1.49  		[ ! -e "$repacked/IDs" ] && tazpkg mkdb "$repacked" --forced --root=''
    1.50 @@ -1356,9 +1347,8 @@
    1.51  
    1.52  	# Show list of mirrors
    1.53  	[ -f "$priority" ] && awk -vdb="$root$LOCALSTATE" '
    1.54 -	function show(num, name, url,   pad) {
    1.55 -		pad = substr("................................", 1, 32 - length(name));
    1.56 -		printf " %-1.1d. %s%s %-44.44s\n", num, name, pad, url;
    1.57 +	function show(num, name, url) {
    1.58 +		printf " %-1.1d. %32.32s %-44.44s\n", num, name " ...............................", url;
    1.59  	}
    1.60  	{
    1.61  		num++;