slitaz-arm rev 23

Add flavors support
author Christophe Lincoln <pankso@slitaz.org>
date Mon Mar 03 02:19:21 2014 +0100 (2014-03-03)
parents 0d3ac2d779e6
children 0074518df282
files sat
line diff
     1.1 --- a/sat	Mon Mar 03 01:13:12 2014 +0100
     1.2 +++ b/sat	Mon Mar 03 02:19:21 2014 +0100
     1.3 @@ -2,7 +2,7 @@
     1.4  #
     1.5  # Sat - SliTaz ARM Tool
     1.6  #
     1.7 -# Copyright (C) 2012 SliTaz ARM - BSD License
     1.8 +# Copyright (C) 2012-2014 SliTaz ARM - BSD License
     1.9  # Author: Christophe Lincoln <pankso@slitaz.org>
    1.10  #
    1.11  . /lib/libtaz.sh
    1.12 @@ -15,6 +15,7 @@
    1.13  initramfs="slitaz-arm.$init"
    1.14  packages=$work/packages
    1.15  distro=$work/distro
    1.16 +flavors=$work/flavors
    1.17  # http://mirror.slitaz.org/packages/cooking/arm/
    1.18  mirror="http://cook.slitaz.org/cross/arm/packages/"
    1.19  
    1.20 @@ -26,6 +27,7 @@
    1.21  
    1.22  $(boldify "Commands:")
    1.23    gen        Generate a distro cpio/gzip initramfs
    1.24 +  flavors    List and give info about flavors
    1.25    clean      Clean up the work directory
    1.26    vdisk      Create a virtual disk to be used by Qemu
    1.27    emu        Emulate the distro with qemu-system-arm
    1.28 @@ -37,6 +39,7 @@
    1.29    --work=    Path to work dir with packages and rootfs
    1.30    --size=    Specify optional vdisk size (default 20Mb)
    1.31    --init=    Specify the initramfs compression: gz bz2 xz
    1.32 +  --flavor=  Generate specified SliTaz ARM flavor
    1.33  
    1.34  EOT
    1.35  }
    1.36 @@ -67,26 +70,40 @@
    1.37  	gen)
    1.38  		time=$(date +%s)
    1.39  		check_root
    1.40 -		rm -rf $distro slitaz-arm.xz
    1.41 +		rm -rf $distro $initramfs
    1.42  		mkdir -p $distro
    1.43 +		
    1.44 +		# Get --flavor= packages lists
    1.45 +		if [ "$flavor" ]; then
    1.46 +			echo -n "Getting $flavor packages.list..."
    1.47 +			cp -f $flavors/$flavor/packages.list .
    1.48 +			status
    1.49 +		fi
    1.50  
    1.51 -		# Packages. Dep install is not well handled by tazpkg/spk actually.
    1.52 -		# So simply install all packages and don't resolve deps.
    1.53 +		# Packages
    1.54 +		rm -f $work/packages.full
    1.55  		if [ -f "packages.list" ]; then
    1.56  			for pkg in $(cat $packages.list)
    1.57  			do
    1.58  				IFS="|"
    1.59  				grep "^$pkg |" $work/mirror/packages.desc | while read pkg version desc
    1.60  				do
    1.61 -					echo ${pkg}-${version}.tazpkg | sed s'/ //'g
    1.62 +					echo ${pkg}-${version}-arm.tazpkg | sed s'/ //'g \
    1.63 +						>> $work/packages.full
    1.64  				done
    1.65  				unset IFS
    1.66  			done
    1.67 -			exit 0
    1.68 +			cd ${work}/mirror
    1.69  		else
    1.70 -		[ ! -d "$packages" ] && echo "Missing: $packages" && exit 1
    1.71 -		cd $packages
    1.72 -		for pkg in $packages/*.tazpkg
    1.73 +			[ ! -d "$packages" ] && echo "Missing: $packages" && exit 1
    1.74 +			echo -n "Using packages directory..."
    1.75 +			cd $packages && ls -1 > $work/packages.full
    1.76 +			status
    1.77 +		fi
    1.78 +		
    1.79 +		# Deps install is not well handled by tazpkg/spk actually.
    1.80 +		# So simply install all packages and don't resolve deps.
    1.81 +		for pkg in $(cat $work/packages.full)
    1.82  		do
    1.83  			pkgdir=$(basename $pkg .tazpkg)
    1.84  			db=$distro/var/lib/tazpkg
    1.85 @@ -100,7 +117,6 @@
    1.86  			md5sum $(basename $pkg) >> $db/installed.md5
    1.87  			status
    1.88  		done
    1.89 -		fi
    1.90  
    1.91  		# Install spk if requested. Spk multiarch support must be tested
    1.92  		if [ "$spk" ]; then
    1.93 @@ -167,10 +183,21 @@
    1.94  		echo "Build time  : ${time}s"
    1.95  		echo -n "Distro size : "
    1.96  		cd $work && du -sh $initramfs | awk '{print $1}' ;;
    1.97 +		
    1.98 +	flavors)
    1.99 +		echo ""
   1.100 +		echo -n "Flavor" && indent 16 "Packages"
   1.101 +		separator
   1.102 +		for flavor in $(ls $flavors)
   1.103 +		do
   1.104 +			pkgs=$(cat $flavors/$flavor/packages.list | wc -l)
   1.105 +			echo -n "$flavor" && indent 16 "$pkgs"
   1.106 +		done
   1.107 +		echo "" ;;
   1.108  	
   1.109  	clean)
   1.110  		check_root
   1.111 -		for r in distro linux-arm *.*z spk; do
   1.112 +		for r in distro linux-arm slitaz-arm.*z spk packages.*; do
   1.113  			echo -n "Cleaning: $r"
   1.114  			rm -rf $work/$r && status
   1.115  		done ;;