slitaz-modular rev 112

local-mirror: Add cook website option.
author Christopher Rogers <slaxemulator@gmail.com>
date Wed Jun 01 08:26:08 2011 +0000 (2011-06-01)
parents f3b8d996e7b9
children 41cd6454e504
files initramfs/usr/bin/local-mirror
line diff
     1.1 --- a/initramfs/usr/bin/local-mirror	Wed May 25 07:47:50 2011 +0000
     1.2 +++ b/initramfs/usr/bin/local-mirror	Wed Jun 01 08:26:08 2011 +0000
     1.3 @@ -7,9 +7,8 @@
     1.4  
     1.5  . /etc/local-mirror.conf
     1.6  
     1.7 +COMMAND="$1"
     1.8  VERSION="0.1"
     1.9 -COMMAND="$1"
    1.10 -
    1.11  usage() {
    1.12  	echo "$0 $VERSION"
    1.13  	echo "$0 [on|off|update-repos|tank-only|mirror-only]"
    1.14 @@ -23,9 +22,12 @@
    1.15  
    1.16  COOKORDER="$(find /mnt/live/mnt/* -name "cookorder.list" -maxdepth 1)"
    1.17  CUR_PWD="$PWD"
    1.18 +version="$(cat /etc/slitaz-release)"
    1.19  
    1.20 -[ -d $SLITAZ_DIR ] || mkdir -p $SLITAZ_DIR
    1.21 +[ -d $SLITAZ_DIR/$version ] || mkdir -p $SLITAZ_DIR/$version
    1.22  [ -d $SLITAZ_DIR/repos ] || ln -sf $REPOS_DIR $SLITAZ_DIR/repos
    1.23 +[ -d $SLITAZ_DIR/$version/packages ] || ln -sf $PKGDIR $SLITAZ_DIR/$version/packages
    1.24 +[ -d $SLITAZ_DIR/$version/src ] || ln -sf $SRCDIR $SLITAZ_DIR/$version/src
    1.25  [ -d $SLITAZ_DIR/repos ] && REPOS_DIR="$SLITAZ_DIR/repos"
    1.26  
    1.27  #repos folders for website
    1.28 @@ -148,19 +150,44 @@
    1.29  			[ -d $REPOS_DIR/slitaz-modular ] && ln -sf $REPOS_DIR/slitaz-modular $COOKING/slitaz-modular
    1.30  			echo -e "$MAIN_WWW_DIR/bb" | tazwok webserver on
    1.31  		;;
    1.32 +		cook)
    1.33 +			pwd=$(pwd)
    1.34 +			if [ -d $REPOS_DIR/my-cookutils ]; then
    1.35 +				cd $REPOS_DIR/my-cookutils
    1.36 +				if [ "$(hg branch)" != "testing" ]; then
    1.37 +					hg update testing
    1.38 +				fi
    1.39 +				make install
    1.40 +				cd $pwd
    1.41 +			fi
    1.42 +			echo "$PKGDIR" > $LOCALSTATE/mirror
    1.43 +			[ -d /var/www/cgi-bin/cooker ] && cp -a /var/www/cgi-bin/cooker $MAIN_WWW_DIR/cook
    1.44 +			if [ "$MKCHROOT" = "yes" ]; then
    1.45 +				tazdev gen-chroot $version
    1.46 +				[ -d $SLITAZ_DIR/$version/chroot ] && mkdir -p $SLITAZ_DIR/$version/chroot$(dirname $CRON_FILE)
    1.47 +				[ -d $SLITAZ_DIR/$version/chroot ] && echo "* */2 * * * /usr/bin/cooker" > $SLITAZ_DIR/$version/chroot${CRON_FILE}
    1.48 +				[ -d $SLITAZ_DIR/$version/chroot ] && echo "$SLITAZ_DIR/$version/packages" > $SLITAZ_DIR/$version/chroot${LOCALSTATE}/mirror
    1.49 +			fi
    1.50 +			[ -d $REPOS_DIR/wok-tank ] && ln -sf $REPOS_DIR/wok-tank $SLITAZ_DIR/$version/wok-hg
    1.51 +			#[ -d $REPOS_DIR/wok-tank ] && ln -sf $REPOS_DIR/wok-tank $SLITAZ_DIR/$version/wok
    1.52 +			[ -d $PKGDIR ] && ln -sf $PKGDIR $SLITAZ_DIR/$version/packages
    1.53 +		;;
    1.54  		pkgs)
    1.55  			[ -d $MAIN_WWW_DIR/pkgs ] || mkdir -p $MAIN_WWW_DIR/pkgs
    1.56 -		
    1.57 +			pwd=$(pwd)
    1.58 +			if [ -d $REPOS_DIR/slitaz-dev-tools/tazpkg-web ]; then
    1.59 +				cd $REPOS_DIR/slitaz-dev-tools/tazpkg-web
    1.60 +				make install
    1.61 +				cd $pwd
    1.62 +			fi
    1.63  			#[ -d /var/lib/tazpkg-web/style ] && cp -a /var/lib/tazpkg-web/style/* $MAIN_WWW_DIR/pkgs
    1.64  			#[ -f /var/lib/tazpkg-web/search.cgi ] && cp -a /var/lib/tazpkg-web/search.cgi $MAIN_WWW_DIR/pkgs
    1.65  			[ -d $REPOS_DIR/slitaz-dev-tools/tazpkg-web/style ] && cp -a $REPOS_DIR/slitaz-dev-tools/tazpkg-web/style/* $MAIN_WWW_DIR/pkgs
    1.66  			[ -f $REPOS_DIR/slitaz-dev-tools/tazpkg-web/search.cgi ] && cp -a $REPOS_DIR/slitaz-dev-tools/tazpkg-web/search.cgi $MAIN_WWW_DIR/pkgs
    1.67 -			[ -d $COOKING ] || mkdir -p $COOKING
    1.68 -			[ -d $STABLE ] || mkdir -p $STABLE
    1.69  			[ -d $REPOS_DIR/flavors ] && ln -sf $REPOS_DIR/flavors $COOKING/flavors
    1.70 -			[ -d $REPOS_DIR/flavors-stable ] && ln -sf $REPOS_DIR/flavors-stable $STABLE/flavors
    1.71 +			#[ -d $REPOS_DIR/flavors-stable ] && ln -sf $REPOS_DIR/flavors-stable $STABLE/flavors
    1.72  			#[ -d $COOKING/wok ] || ln -sf $REPOS_DIR/wok $COOKING/clean-wok
    1.73 -			[ -d $STABLE/clean-wok ] || ln -sf $REPOS_DIR/wok-stable $STABLE/clean-wok
    1.74 +			#[ -d $STABLE/clean-wok ] || ln -sf $REPOS_DIR/wok-stable $STABLE/clean-wok
    1.75  			if [ -f "/usr/bin/tazpkg-web" ]; then
    1.76  				tazpkg-web cooking
    1.77  				if [ ! $(grep -l "/usr/bin/tazpkg-web cooking" $CRON_FILE) ]; then
    1.78 @@ -250,6 +277,7 @@
    1.79  	
    1.80  		if [ ! $(grep -l 'contact = ' $REPOS_DIR/$repo/.hg/hgrc ) ]; then
    1.81  			[ "$repo" = "cookutils" ] && echo "contact = Christophe Lincoln" >> $REPOS_DIR/$repo/.hg/hgrc
    1.82 +			[ "$repo" = "my-cookutils" ] && echo "contact = Christopher Rogers" >> $REPOS_DIR/$repo/.hg/hgrc
    1.83  			[ "$repo" = "flavors" ] && echo "contact = Christophe Lincoln" >> $REPOS_DIR/$repo/.hg/hgrc
    1.84  			[ "$repo" = "flavors-stable" ] && echo "contact = Pascal Bellard" >> $REPOS_DIR/$repo/.hg/hgrc
    1.85  			[ "$repo" = "slitaz-base-files" ] && echo "contact = Pascal Bellard" >> $REPOS_DIR/$repo/.hg/hgrc
    1.86 @@ -278,6 +306,7 @@
    1.87  	
    1.88  		if [ ! $(grep -l 'description = ' $REPOS_DIR/$repo/.hg/hgrc) ]; then
    1.89  			[ "$repo" = "cookutils" ] && echo "description = Utils to cook SliTaz packages" >> $REPOS_DIR/$repo/.hg/hgrc
    1.90 +			[ "$repo" = "my-cookutils" ] && echo "description = More powerful version of cookutils" >> $REPOS_DIR/$repo/.hg/hgrc
    1.91  			[ "$repo" = "flavors" ] && echo "description = SliTaz Cooking flavors" >> $REPOS_DIR/$repo/.hg/hgrc
    1.92  			[ "$repo" = "flavors-stable" ] && echo "description = SliTaz Stable flavors" >> $REPOS_DIR/$repo/.hg/hgrc
    1.93  			[ "$repo" = "slitaz-base-files" ] && echo "description = SliTaz base files" >> $REPOS_DIR/$repo/.hg/hgrc
    1.94 @@ -320,8 +349,6 @@
    1.95  		for hostname in $ADDRESS; do 
    1.96  				if [ "$hostname" = "www.slitaz.org" ]; then
    1.97  					echo "$IP_ADDR $hostname slitaz.org" >> /etc/hosts
    1.98 -				elif [ "$hostname" = "bb.slitaz.org" ]; then
    1.99 -					echo "$IP_ADDR $hostname cook.slitaz.org" >> /etc/hosts
   1.100  				else
   1.101  					echo "$IP_ADDR $hostname" >> /etc/hosts
   1.102  				fi