wok rev 5648

mirror-tools: may use local hg copy
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat May 29 13:32:42 2010 +0200 (2010-05-29)
parents b453ffcf59cd
children b84ff32e3457
files mirror-tools/stuff/usr/bin/mkpkgiso
line diff
     1.1 --- a/mirror-tools/stuff/usr/bin/mkpkgiso	Sat May 29 12:06:33 2010 +0200
     1.2 +++ b/mirror-tools/stuff/usr/bin/mkpkgiso	Sat May 29 13:32:42 2010 +0200
     1.3 @@ -5,7 +5,7 @@
     1.4  # Authors : Eric Joseph-Alexandre <erjo@slitaz.org>
     1.5  #	    Pascal Bellard <pascal.bellard@slitaz.org>
     1.6  
     1.7 -VERSION=0.8
     1.8 +VERSION=0.9
     1.9  
    1.10  PKG_VER=$1
    1.11  ROOT=/home/slitaz/iso
    1.12 @@ -42,12 +42,25 @@
    1.13  Usage: $(basename $0) <Version> 
    1.14  	[--boot [--auto-install] [--loram-detect]]|--webboot] [--filter]
    1.15  	[--wok] [--wok-stable] [--website] [--sources] [--dry-run]
    1.16 +       $(basename $0) update-hg <dir>
    1.17  Example:
    1.18  $(basename $0) cooking --boot --auto-install --loram-detect --filter --wok --website --sources
    1.19  EOT
    1.20  	exit 1
    1.21  fi
    1.22  
    1.23 +# Update hg repos
    1.24 +if [ "$PKG_VER" == "update-hg" ]; then
    1.25 +	for i in $1/* ; do
    1.26 +		[ -s $i/.hg/hgrc ] || continue
    1.27 +		cd $i
    1.28 +		hg pull
    1.29 +		hg update
    1.30 +		cd - > /dev/null
    1.31 +	done
    1.32 +	exit 1
    1.33 +fi
    1.34 +
    1.35  # Check if we provide a valide version
    1.36  if [ ! -d $REPOS ]; then
    1.37  	echo "Boooh! $PKG_VER is not a valid version."
    1.38 @@ -204,8 +217,12 @@
    1.39  get_from_hg()
    1.40  {
    1.41  echo -n "Adding $2"
    1.42 -wget -q -O - http://hg.slitaz.org/$1/archive/tip.tar.bz2 | tar xjf - -C $TEMP_DIR
    1.43 -mv $TEMP_DIR/$1-* $TEMP_DIR/$1
    1.44 +if [ -s /home/slitaz/$1/.hg/hgrc ]; then
    1.45 +	cp -a /home/slitaz/$1 $TEMP_DIR
    1.46 +else
    1.47 +	wget -q -O - http://hg.slitaz.org/$1/archive/tip.tar.bz2 | tar xjf - -C $TEMP_DIR
    1.48 +	mv $TEMP_DIR/$1-* $TEMP_DIR/$1
    1.49 +fi
    1.50  status
    1.51  echo "$(du -hs $TEMP_DIR/$1 | awk '{ print $1 }') used by $2."
    1.52  }