slitaz-modular rev 122

mkiso.sh: Replaced tazwok with my-cookutils scripts. Added better support for BACKUP_ALL option so it will only get the lastest packages and sources instead of just copying everything in packages and source folder.
author Christopher Rogers <slaxemulator@gmail.com>
date Wed Jun 29 01:12:25 2011 +0000 (2011-06-29)
parents 78ea816433c4
children 828711dd2cc6
files mkiso.sh
line diff
     1.1 --- a/mkiso.sh	Wed Jun 29 01:08:28 2011 +0000
     1.2 +++ b/mkiso.sh	Wed Jun 29 01:12:25 2011 +0000
     1.3 @@ -1,7 +1,7 @@
     1.4  #!/bin/bash
     1.5  
     1.6 -. /etc/slitaz/slitaz.conf 
     1.7 -. /etc/slitaz/tazwok.conf 
     1.8 +. /etc/slitaz/slitaz.conf
     1.9 +. /etc/slitaz/cook.conf
    1.10  
    1.11  QUIET="y"
    1.12  FORCE="y"
    1.13 @@ -46,10 +46,11 @@
    1.14  KEY_FILES="init liblinuxlive linuxrc"
    1.15  CLEAN_MODULES_DIR="no"
    1.16  CLEAN_INITRAMFS="no"
    1.17 -PACKAGES_REPOSITORY="$LOCAL_REPOSITORY/packages"
    1.18 -INCOMING_REPOSITORY="$LOCAL_REPOSITORY/packages-incoming"
    1.19 -SOURCES_REPOSITORY="$LOCAL_REPOSITORY/src"
    1.20 -HG_LIST="cookutils flavors flavors-stable slitaz-base-files slitaz-boot-scripts slitaz-configs slitaz-dev-tools slitaz-doc slitaz-doc-wiki-data slitaz-forge slitaz-modular slitaz-pizza slitaz-tools ssfs tazlito tazpanel tazpkg tazusb tazweb tazwok website wok-tiny wok-undigest"
    1.21 +LOCAL_REPOSITORY="$SLITAZ"
    1.22 +PACKAGES_REPOSITORY="$PKGS"
    1.23 +INCOMING_REPOSITORY="$INCOMING"
    1.24 +SOURCES_REPOSITORY="$SRC"
    1.25 +HG_LIST="cookutils flavors flavors-stable slitaz-base-files slitaz-boot-scripts slitaz-configs slitaz-dev-tools slitaz-doc slitaz-doc-wiki-data slitaz-forge slitaz-modular slitaz-pizza slitaz-tools ssfs tazlito tazpanel tazpkg tazusb tazweb tazwok website wok wok-tiny wok-undigest"
    1.26  MY_HG_LIST="my-cookutils wok-tank"
    1.27  MY_HG_URL="https://bitbucket.org/godane"
    1.28  
    1.29 @@ -326,13 +327,20 @@
    1.30  				sed -i "s|$pkg||g" $ISODIR/packages-installed.list
    1.31  			fi
    1.32  		done
    1.33 -		tazwok gen-cooklist $ISODIR/packages-installed.list > $ISODIR/cookorder.list
    1.34 -		[ -f $INCOMING_REPOSITORY/wok-wanted.txt ] || tazwok gen-wok-db --WOK=$WOK
    1.35 -		
    1.36 +		cook gen-cooklist $ISODIR/packages-installed.list > $ISODIR/cookorder.list
    1.37 +		[ -f $CACHE/fullco ] || cook gen-wok-db $WOK
    1.38 +		cookorder=$ISODIR/cookorder.list
    1.39 +		[ "$BACKUP_ALL" = "yes" ] && cookorder=$CACHE/fullco
    1.40  		CACHE_REPOSITORY="$CACHE_DIR/$(cat /etc/slitaz-release)/packages"
    1.41  
    1.42 -		cat $ISODIR/cookorder.list | grep -v "^#" | while read pkg; do
    1.43 -			rwanted=$(grep $'\t'$pkg$ $INCOMING_REPOSITORY/wok-wanted.txt | cut -f 1)
    1.44 +		cat $cookorder | grep -v "^#" | while read pkg; do
    1.45 +			[ -f "$WOK/$pkg/receipt" ] || continue
    1.46 +			unset rwanted pkg_VERSION incoming_pkg_VERSION cache_pkg_VERSION
    1.47 +			rwanted=$(grep $'\t'$pkg$ $CACHE/wok-wanted | cut -f 1)
    1.48 +			if [ -f $PROFILE/list/backupall.banned ]; then
    1.49 +				[ "$BACKUP_ALL" = "yes" ] && \
    1.50 +					[ $(grep -l "^$pkg$" $PROFILE/list/backupall.banned) ] && continue
    1.51 +			fi
    1.52  			pkg_VERSION="$(grep -m1 -A1 ^$pkg$ $PACKAGES_REPOSITORY/packages.txt | \
    1.53  				tail -1 | sed 's/ *//')"
    1.54  			incoming_pkg_VERSION="$(grep -m1 -A1 ^$pkg$ $INCOMING_REPOSITORY/packages.txt | \
    1.55 @@ -340,6 +348,10 @@
    1.56  			cache_pkg_VERSION="$(grep -m1 -A1 ^$pkg$ $LOCALSTATE/packages.txt | \
    1.57  					tail -1 | sed 's/ *//')"
    1.58  			for wanted in $rwanted; do
    1.59 +				if [ -f $PROFILE/list/backupall.banned ]; then
    1.60 +					[ "$BACKUP_ALL" = "yes" ] && \
    1.61 +						[ $(grep -l "^$wamted$" $PROFILE/list/backupall.banned) ] && continue
    1.62 +				fi
    1.63  				if [ -f $INCOMING_REPOSITORY/$wanted-$incoming_pkg_VERSION.tazpkg ]; then
    1.64  					ln -sf $INCOMING_REPOSITORY/$wanted-$incoming_pkg_VERSION.tazpkg $PKGISO_DIR/$wanted-$incoming_pkg_VERSION.tazpkg
    1.65  				elif [ -f $PACKAGES_REPOSITORY/$wanted-$pkg_VERSION.tazpkg ]; then
    1.66 @@ -359,22 +371,23 @@
    1.67  		done
    1.68  		
    1.69  		if [ "$SRC_PKG" = "yes" ]; then
    1.70 -			cat $ISODIR/cookorder.list | grep -v "^#" | while read pkg; do
    1.71 +			cat $cookorder | grep -v "^#" | while read pkg; do
    1.72 +				[ -f "$WOK/$pkg/receipt" ] || continue
    1.73  				[ $(grep ^$pkg$ $PROFILE/list/srcpkg.banned) ] && continue
    1.74  				for i in $(grep -l "^SOURCE=\"$pkg\"" $WOK/*/receipt); do
    1.75  					unset SOURCE TARBALL WANTED PACKAGE VERSION COOK_OPT WGET_URL
    1.76  					unset pkg_VERSION incoming_pkg_VERSION cache_pkg_VERSION src_pkg src_ver 
    1.77 -					source $i
    1.78 +					#source $i
    1.79  					src_pkg=$(grep ^PACKAGE= $WOK/$pkg/receipt | cut -d "=" -f 2 | sed -e 's/"//g')
    1.80  					src_ver=$(grep ^VERSION= $WOK/$pkg/receipt | cut -d "=" -f 2 | sed -e 's/"//g')
    1.81  					[ "$VERSION" = "$src_ver" ] || continue
    1.82 -					pkg_VERSION="$(grep -m1 -A1 ^$PACKAGE$ $PACKAGES_REPOSITORY/packages.txt | \
    1.83 +					pkg_VERSION="$(grep -m1 -A1 ^$src_pkg$ $PACKAGES_REPOSITORY/packages.txt | \
    1.84  						tail -1 | sed 's/ *//')"
    1.85 -					incoming_pkg_VERSION="$(grep -m1 -A1 ^$PACKAGE$ $INCOMING_REPOSITORY/packages.txt | \
    1.86 +					incoming_pkg_VERSION="$(grep -m1 -A1 ^$src_pkg$ $INCOMING_REPOSITORY/packages.txt | \
    1.87  						tail -1 | sed 's/ *//')"
    1.88 -					cache_pkg_VERSION="$(grep -m1 -A1 ^$PACKAGE$ $LOCALSTATE/packages.txt | \
    1.89 +					cache_pkg_VERSION="$(grep -m1 -A1 ^$src_pkg$ $LOCALSTATE/packages.txt | \
    1.90  						tail -1 | sed 's/ *//')"
    1.91 -					rwanted=$(grep $'\t'$PACKAGE$ $INCOMING_REPOSITORY/wok-wanted.txt | cut -f 1)
    1.92 +					rwanted=$(grep $'\t'$src_pkg$ $CACHE/wok-wanted | cut -f 1)
    1.93  					
    1.94  					for wanted in $rwanted; do
    1.95  						if [ -f $INCOMING_REPOSITORY/$wanted-$incoming_pkg_VERSION.tazpkg ]; then
    1.96 @@ -398,7 +411,7 @@
    1.97  		fi
    1.98  		
    1.99  		[ -f $LOG/packages-gen-list.log ] && rm -f $LOG/packages-gen-list.log
   1.100 -		[ -d $PKGISO_DIR ] && tazwok gen-list $PKGISO_DIR | tee -a $LOG/packages-gen-list.log
   1.101 +		[ -d $PKGISO_DIR ] && cook pkgdb $PKGISO_DIR | tee -a $LOG/packages-gen-list.log
   1.102  	fi
   1.103  	
   1.104  }
   1.105 @@ -409,26 +422,32 @@
   1.106  		[ -d $SOURCES_REPOSITORY ] || mkdir -p $SOURCES_REPOSITORY
   1.107  		[ -d $SRCISO_DIR ] && rm -r $SRCISO_DIR
   1.108  		mkdir -p $SRCISO_DIR
   1.109 -		cat $ISODIR/cookorder.list | grep -v "^#"| while read pkg; do
   1.110 -			#rwanted=$(grep $'\t'$pkg$ $INCOMING_REPOSITORY/wok-wanted.txt | cut -f 1)
   1.111 -			for i in $(ls $WOK/$pkg/receipt); do
   1.112 -				unset SOURCE TARBALL WANTED PACKAGE VERSION COOK_OPT WGET_URL KBASEVER
   1.113 -				source $i
   1.114 -				#{ [ ! "$TARBALL" ] || [ ! "$WGET_URL" ] ; } && continue
   1.115 -				[ "$WGET_URL" ] || continue
   1.116 -				if [ ! -f "$SOURCES_REPOSITORY/$TARBALL" ] && \
   1.117 -					[ ! -f "$SOURCES_REPOSITORY/${SOURCE:-$PACKAGE}-${KBASEVER:-$VERSION}.tar.lzma" ]; then
   1.118 -					tazwok get-src $PACKAGE --nounpack
   1.119 -					if [ -f "$SOURCES_REPOSITORY/$TARBALL" ]; then
   1.120 -						ln -sf $SOURCES_REPOSITORY/$TARBALL $SRCISO_DIR/$TARBALL
   1.121 -					elif [ -f "$SOURCES_REPOSITORY/${SOURCE:-$PACKAGE}-${KBASEVER:-$VERSION}.tar.lzma" ]; then
   1.122 -						ln -sf $SOURCES_REPOSITORY/${SOURCE:-$PACKAGE}-${KBASEVER:-$VERSION}.tar.lzma $SRCISO_DIR/${SOURCE:-$PACKAGE}-${KBASEVER:-$VERSION}.tar.lzma
   1.123 -					fi
   1.124 -				else
   1.125 -					[ -f "$SOURCES_REPOSITORY/$TARBALL" ] && ln -sf $SOURCES_REPOSITORY/$TARBALL $SRCISO_DIR/$TARBALL
   1.126 -					[ -f "$SOURCES_REPOSITORY/${SOURCE:-$PACKAGE}-${KBASEVER:-$VERSION}.tar.lzma" ] && ln -sf $SOURCES_REPOSITORY/${SOURCE:-$PACKAGE}-${KBASEVER:-$VERSION}.tar.lzma $SRCISO_DIR/${SOURCE:-$PACKAGE}-${KBASEVER:-$VERSION}.tar.lzma
   1.127 +		cookorder=$ISODIR/cookorder.list
   1.128 +		[ "$BACKUP_ALL" = "yes" ] && cookorder=$CACHE/fullco
   1.129 +		[ -f $LOG/cook-getsrc.log ] && rm -rf $LOG/cook-getsrc.log
   1.130 +		cat $cookorder | grep -v "^#"| while read pkg; do
   1.131 +			if [ -f $PROFILE/list/backupall.banned ]; then
   1.132 +				[ "$BACKUP_ALL" = "yes" ] && \
   1.133 +					[ $(grep -l "^$pkg$" $PROFILE/list/backupall.banned) ] && continue
   1.134 +			fi
   1.135 +			unset SOURCE TARBALL WANTED PACKAGE VERSION COOK_OPT WGET_URL KBASEVER
   1.136 +			[ -f $WOK/$pkg/receipt ] || continue
   1.137 +			source $WOK/$pkg/receipt
   1.138 +			[ "$TARBALL" ] || continue
   1.139 +			#{ [ ! "$TARBALL" ] || [ ! "$WGET_URL" ] ; } && continue
   1.140 +			[ "$WGET_URL" ] || continue
   1.141 +			if [ -f "$SOURCES_REPOSITORY/${SOURCE:-$PACKAGE}-${KBASEVER:-$VERSION}.tar.lzma" ]; then
   1.142 +				ln -sf $SOURCES_REPOSITORY/${SOURCE:-$PACKAGE}-${KBASEVER:-$VERSION}.tar.lzma $SRCISO_DIR/${SOURCE:-$PACKAGE}-${KBASEVER:-$VERSION}.tar.lzma
   1.143 +			elif [ -f "$SOURCES_REPOSITORY/$TARBALL" ]; then
   1.144 +				ln -sf $SOURCES_REPOSITORY/$TARBALL $SRCISO_DIR/$TARBALL
   1.145 +			else
   1.146 +				cook $PACKAGE --getsrc | tee -a $LOG/cook-getsrc.log
   1.147 +				if [ -f "$SOURCES_REPOSITORY/$TARBALL" ]; then
   1.148 +					ln -sf $SOURCES_REPOSITORY/$TARBALL $SRCISO_DIR/$TARBALL
   1.149 +				elif [ -f "$SOURCES_REPOSITORY/${SOURCE:-$PACKAGE}-${KBASEVER:-$VERSION}.tar.lzma" ]; then
   1.150 +					ln -sf $SOURCES_REPOSITORY/${SOURCE:-$PACKAGE}-${KBASEVER:-$VERSION}.tar.lzma $SRCISO_DIR/${SOURCE:-$PACKAGE}-${KBASEVER:-$VERSION}.tar.lzma
   1.151  				fi
   1.152 -			done
   1.153 +			fi
   1.154  		done
   1.155  		cd $SRCISO_DIR
   1.156  		info "Make md5sum file for sources"
   1.157 @@ -438,14 +457,6 @@
   1.158  	
   1.159  }
   1.160  
   1.161 -backup_all()
   1.162 -{
   1.163 -	if [ "${BACKUP_ALL}" = "yes" ]; then
   1.164 -		[ -d $SRCISO_DIR ] || ln -sf $SOURCES_REPOSITORY $SRCISO_DIR
   1.165 -		[ -d $PKGISO_DIR ] || ln -sf $PACKAGES_REPOSITORY $PKGISO_DIR
   1.166 -	fi
   1.167 -}
   1.168 -
   1.169  # _mksquash dirname
   1.170  _mksquash () {
   1.171      if [ ! -d "$1" ]; then
   1.172 @@ -543,8 +554,6 @@
   1.173  		backup_src
   1.174  	fi
   1.175  	
   1.176 -	backup_all
   1.177 -	
   1.178  	info "====> Making bootable image"
   1.179  
   1.180  	# Sanity checks