Using bash allows us to have flexibility that sh does'nt give us

Features added by this change are:
Support singular/multiple platform builds - allows to build just the platform
  we care about, while the old behavior is still retained
Support ability to choose if build should stop proceeding if one of the build
  platforms stopped
Support ability to *not* update git, this is useful for development
 branches when folks are getting platform support ready
Support easy addition of platform configuration.
 Supporting a new ks is as easy as adding oneline as follows:
 build_name | ks file | build options
Easy scalability to MeeGo 1.2 release and beyond
 all we need to do is add to the bash array
Use get_opts like all good scripts - allows parameter ordering not important
Add a help text for usage for newbies like me :)

old usage:
scripts/create.sh ID REPOTYPE RELEASE

New usage:
scripts/create.sh -i ID -r RELEASE -R REPO

Signed-off-by: Nishanth Menon <[email protected]>
---
V2: rebased to master 2fd4d7f Enable SDK images and remove extra spaces
        git://gitorious.org/meego-os-base/image-configurations.git
V1: http://lists.meego.com/pipermail/meego-packaging/2010-November/245866.html

Note: the script is attached at the end of the patch for easier reviewability
 scripts/create.sh |  313 +++++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 243 insertions(+), 70 deletions(-)

diff --git a/scripts/create.sh b/scripts/create.sh
index d7cfdbe..34fefdc 100755
--- a/scripts/create.sh
+++ b/scripts/create.sh
@@ -1,88 +1,261 @@
-#!/bin/sh
+#!/bin/bash
 #
-#A simple script to batch generate all release-able images for MeeGo. 
+# A simple script to batch generate all release-able images for MeeGo.
 #
-#This script will check out all MeeGo Image Kickstart files and execute 
-#image generation based on repository type selected for all release-able 
images. 
+# This script will check out all MeeGo Image Kickstart files and execute
+# image generation based on repository type selected for all release-able
+# images.
 #
-# Written for MeeGo by Chris Ferron <[email protected]> based on 
an initial
-# effort buy Anas Nashif.
-
-
-ID=$1
-REPOTYPE=$2
-RELEASE=$3
+# Written for MeeGo by Chris Ferron <[email protected]> based on
+# an initial effort buy Anas Nashif.
+#
+# Modified by Nishanth Menon <[email protected]> for a bit more flexibility
 
-# Preparation Section
-#export http_proxy= http://XXX.XXX.XXX.XXX:XXXX/
+# Modifiable params
+# XXX: New platform build option is added here
+# Builds supported: These are organized as:
+# build_name | ks file | build options
+Build_Options=( \
+ "core-armv7l-n900|core/core-armv7l-n900.ks|-f raw --save-kernel  --arch 
armv7" \
+ "core-armv7l-madde-sysroot|SDK/core-armv7l-madde-sysroot.ks|--format=fs 
--package=tar.bz2 --run-mode=0 --arch=armv7l --save-kernel" \
+ "core-ia32-madde-sysroot.ks|SDK/core-ia32-madde-sysroot.ks|--format=fs 
--package=tar.bz2" \
+ "netboot-ia32 | netbook/netbook-ia32.ks |-f livecd" \
+ "netbook-ia32-qemu | SDK/netbook-ia32-qemu.ks | --format=raw 
--package=tar.bz2" \
+ "ivi-ia32|ivi/ivi-ia32.ks| -f livecd" \
+ "handset-ia32|handset/handset-ia32-mtf.ks| -f nand" \
+ "handset-ia32-mtf-devel|handset/handset-ia32-mtf-devel.ks|-f nand" \
+ "handset-armv7l-n900|handset/handset-armv7l-n900.ks| -f raw --save-kernel 
--arch=armv7l" \
+ "handset-armv7l-n900-devel|handset/handset-armv7l-n900-devel.ks| -f raw 
--save-kernel --arch=armv7l" \
+ "handset-ia32-pinetrail|handset/handset-ia32-pinetrail-mtf.ks| -f livecd" \
+ "handset-armv7l-qemu |SDK/handset-armv7l-qemu.ks|--format=raw 
--package=tar.bz2 --run-mode=0 --arch=armv7l --save-kernel"\
+ "handset-ia32-qemu|SDK/handset-ia32-qemu.ks| --format=raw --package=tar.bz2" \
+)
+# What releases do we support - and corresponding git branches
+Release_Name_ARRAY=( "MeeGo1.1" "Trunk" )
+Release_Branch_ARRAY=( "MeeGo1.1" "master" )
+# Repositories supported
+Repo_Name_Array=( "daily" "weekly" "preview")
 
-rm -f *.log
+usage(){
+       cat << USAGE >&2
+Error: $*
+Usage: $0 [-r release] -R repo [-i id] [-n] [-b build_name]
 
-if [ "$RELEASE" = "MeeGo1.1" ]; then
-   git checkout -f MeeGo1.1 
-elif [ "$RELEASE" = "Trunk" ]; then 
-   git checkout -f master
-else
-   git checkout -f master
-   echo "No release type given, default to Trunk. Current support is for Trunk 
and MeeGo1.1"
-fi
+Where:
+ -r release - release of MeeGo - ${Release_Name_ARRAY[*]} [Default: Trunk]
+ -R repo    - repo: ${Repo_Name_Array[*]} [Default: none]
+ -i ID     - ID of the build if you choose weekly build [Default: none]
+ -n         - Dont update git [Default: updates git to latest]
+ -f         - Stop if any mic creation failed [Default: false]
+ -b build_name - what images to build :  [Default: all - builds all]
+       $BuildNamesPrint
+       all
 
-git pull
+Example usage:
+Build a preview version of MeeGo1.1 release:
+ $0 -r MeeGo1.1 -R preview
+Build a daily version of MeeGo from Trunk:
+ $0 -r Trunk -R daily
+Choose a weekly build version:
+ $0 -r Trunk -R weekly -i 1.1.80.4.20101102.1
+Build a weekly build version for just N900 handset devel image:
+ $0 -r Trunk -R weekly -i 1.1.80.4.20101102.1 -b handset-armv7l-n900-devel
+Build a weekly build version for multiple N900 images:
+ $0 -r Trunk -R weekly -i 1.1.80.4.20101102.1 -b "handset-armv7l-n900-devel 
core-armv7l-n900"
 
-if [ "$REPOTYPE" = "1" ]; then
-  str="s/\...@build_id\@/$ID/"
-elif [ "$REPOTYPE" = "2" ]; then 
-  str="s/\...@build_id\@/preview/"
-elif [ "$REPOTYPE" = "3" ]; then 
-  str="s/\...@build_id\@/daily/" 
-else
- echo " Repository Type needs to be 1 for Weekly or 2 for Preview or 3 for 
Daily" 
- exit 1 
-fi
-
-find -name \*.ks -exec perl  -pi -e $str '{}' \;
+USAGE
+       exit 1
+}
 
 # mk_image expects at minimal, one arg- the first arg must be the path to the 
ks file.
 # all further args are passed through to 'mic create'
 # finally, a --release argument is automatically prepended.
 mk_image() {
-   local ks="$1";
-   shift
-   local name="meego-$(basename "$ks")"
-   name="${name%.ks}"
-   local dirname="$(dirname "$ks")"
-   rm -rf "${ID}/${dirname}/images/${name}"
-   mic create -c "$ks" --release="${ID}" "$@" 2>&1 | tee "${name}-${ID}.log"
-   if [ ! -d "${ID}/${dirname}/images/${name}" ]; then
-      echo "error: no ${ID}/${dirname}/images/${name} directory created"
-      return 1
-   fi
-   md5sum "${name}-${ID}.log" >> "${ID}/${dirname}/images/${name}/MANIFEST"
-   cp "${name}-${ID}.log" "$ID/${dirname}/images/${name}/"
+       local ks="$1";
+       shift
+       local name="meego-$(basename "$ks")"
+       name="${name%.ks}"
+       local dirname="$(dirname "$ks")"
+       rm -rf "${ID}/${dirname}/images/${name}"
+       mic create -c "$ks" --release="${ID}" "$@" 2>&1 | tee 
"${name}-${ID}.log"
+       if [ ! -d "${ID}/${dirname}/images/${name}" ]; then
+               echo "error: no ${ID}/${dirname}/images/${name} directory 
created"
+               return 1
+       fi
+       md5sum "${name}-${ID}.log" >> "${ID}/${dirname}/images/${name}/MANIFEST"
+       cp "${name}-${ID}.log" "$ID/${dirname}/images/${name}/"
+       return 0
 }
 
+# Defaults
+GIT_UPDATE=1
+RELEASE=Trunk
+STOP_FAIL=0
+
+BUILD_PLATFORMS=all
+idx=0
+BuildNames=""
+while [ $idx -lt ${#build_optio...@]} ]
+do
+       name=`echo "${Build_Options[$idx]}"|cut -d '|' -f1`
+       BuildNames="$BuildNames $name"
+       idx=$((idx + 1))
+done
+BuildNamesPrint=`echo $BuildNames|sed -e "s/ /\n\t/g"`
+
+# Drag the options in
+while getopts ":nfr:i:R:b:" opt; do
+       case $opt in
+       r) RELEASE=$OPTARG ;;
+       n) GIT_UPDATE=0 ;;
+       f) STOP_FAIL=1 ;;
+       i) ID=$OPTARG ;;
+       R) REPOTYPE=$OPTARG ;;
+       b) BUILD_PLATFORMS=$OPTARG ;;
+       \?)
+               usage "Invalid option: -$OPTARG"
+               exit 1
+               ;;
+       :)
+               usage "Option -$OPTARG requires an argument."
+               exit 1
+               ;;
+       esac
+done
+
+# Verify the RELEASE
+if [ ${#release_name_arr...@]} -ne ${#release_branch_arr...@]} ]; then
+       echo "OUCH! SOMEONE CORRUPTED THE ARRAYS!!! please report" >&2
+       exit 1
+fi
+idx=0
+orname=$RELEASE
+rname=`echo $RELEASE|tr 'A-Z' 'a-z'`
+RELEASE=""
+while [ $idx -lt ${#release_name_arr...@]} ]
+do
+       name=`echo "${Release_Name_ARRAY[$idx]}"|tr 'A-Z' 'a-z' `
+       if [ "$name" = "$rname" ]; then
+               RELEASE=${Release_Name_ARRAY[$idx]}
+               BRANCH=${Release_Branch_ARRAY[$idx]}
+               break;
+       fi
+       idx=$((idx + 1))
+done
+if [ -z "$RELEASE" ]; then
+       usage "Unknown Release '$orname' - supported:(${Release_Name_ARRAY[*]})"
+       exit 1
+fi
+
+# Verify Repo type
+idx=0
+orname=$REPOTYPE
+rname=`echo $REPOTYPE|tr 'A-Z' 'a-z'`
+REPOTYPE=""
+while [ $idx -lt ${#repo_name_arr...@]} ]
+do
+       name=`echo "${Repo_Name_Array[$idx]}"|tr 'A-Z' 'a-z' `
+       if [ "$name" = "$rname" ]; then
+               REPOTYPE=${Repo_Name_Array[$idx]}
+               break;
+       fi
+       idx=$((idx + 1))
+done
+if [ -z "$REPOTYPE" ]; then
+       usage "Unknown Repo '$orname' - supported:(${Repo_Name_Array[*]})"
+       exit 1
+fi
+
+# Special Check for ID if weekly build is selected
+if [ "$REPOTYPE" == "weekly"  -a -z "$ID" ]; then
+       usage "Weekly build selected without ID! please provide ID"
+       exit 1
+fi
+if [ "$REPOTYPE" != "weekly" -a -z "$ID" ]; then
+       ID="$RELEASE-$REPOTYPE"
+fi
+
+# Create the BUILDID
+str=""
+case $REPOTYPE in
+       weekly)  str="s/\...@build_id\@/$ID/";;
+       preview) str="s/\...@build_id\@/preview/";;
+       daily)   str="s/\...@build_id\@/daily/";;
+       *)
+               usage "errk.. !I should'nt be here"
+               exit 1;;
+esac
+
+# Check if we have a valid build platform
+if [ "$BUILD_PLATFORMS" = "all" ]; then
+       BUILD_PLATFORMS="$BuildNames"
+fi
+
+# Verify the build platforms before attempting builds!
+VALID_BUILD_PLATFORMS=""
+for build in $BUILD_PLATFORMS
+do
+       idx=0
+       bname=`echo $build|tr 'A-Z' 'a-z'`
+       valid=0
+       while [ $idx -lt ${#build_optio...@]} ]
+       do
+               name=`echo "${Build_Options[$idx]}"|cut -d '|' -f1`
+               lname=`echo $name|tr 'A-Z' 'a-z'`
+               if [ "$lname" = "$bname" ]; then
+                       valid=1
+                       break;
+               fi
+               idx=$((idx + 1))
+       done
+       if [ $valid -eq 1 ]; then
+               echo "$name is valid"
+               VALID_BUILD_PLATFORMS="$VALID_BUILD_PLATFORMS $name"
+       else
+               usage "Unknown build platform $build!"
+               exit 1
+       fi
+done
+
+# Time for action
+if [ $GIT_UPDATE -eq 1 ]; then
+       git checkout -f $BRANCH
+       git pull
+else
+       echo "WARNING: BUILDING WITHOUT GIT UPDATE!!!! - BEWARE OF STALE 
FILES!" >&2
+fi
+
+# Start build
+rm -f *.log
 
-#Core Image Section
-mk_image core/core-armv7l-n900.ks -f raw --save-kernel --arch armv7
-mk_image SDK/core-armv7l-madde-sysroot.ks --format=fs --package=tar.bz2 
--run-mode=0 --arch=armv7l --save-kernel
-mk_image SDK/core-ia32-madde-sysroot.ks --format=fs --package=tar.bz2
-
-#Netbook Image Section
-mk_image netbook/netbook-ia32.ks -f livecd
-mk_image SDK/netbook-ia32-qemu.ks --format=raw --package=tar.bz2
-
-#IVI Image Section
-mk_image ivi/ivi-ia32.ks -f livecd
-
-#Handset Image Section
-#mk_image handset/handset-ia32-aava-mtf.ks -f nand
-mk_image handset/handset-ia32-mtf.ks -f nand
-#mk_image handset/handset-ia32-aava-mtf-devel.ks -f nand
-mk_image handset/handset-ia32-mtf-devel.ks -f nand
-mk_image handset/handset-armv7l-n900.ks -f raw --save-kernel --arch=armv7l
-mk_image handset/handset-armv7l-n900-devel.ks -f raw --save-kernel 
--arch=armv7l
-mk_image handset/handset-ia32-pinetrail-mtf.ks -f livecd
-mk_image SDK/handset-armv7l-qemu.ks --format=raw --package=tar.bz2 
--run-mode=0 --arch=armv7l --save-kernel
-mk_image SDK/handset-ia32-qemu.ks --format=raw --package=tar.bz2
+for build in $VALID_BUILD_PLATFORMS
+do
+       idx=0
+       bname=`echo $build|tr 'A-Z' 'a-z'`
+       match=0
+       while [ $idx -lt ${#build_optio...@]} ]
+       do
+               name=`echo "${Build_Options[$idx]}"|cut -d '|' -f1`
+               lname=`echo $name|tr 'A-Z' 'a-z'`
+               if [ "$lname" = "$bname" ]; then
+                       match=1
+                       break;
+               fi
+               idx=$((idx + 1))
+       done
+       if [ $match -eq 1 ]; then
+               name=`echo "${Build_Options[$idx]}"|cut -d '|' -f1`
+               ks=`echo "${Build_Options[$idx]}"|cut -d '|' -f2`
+               options=`echo "${Build_Options[$idx]}"|cut -d '|' -f3`
+               # Lets modify the ks for this
+               sed -e "$str" -i $ks || usage "$ks: build replacement"\
+                       "failed!-please report" || exit 1
+               mk_image $ks $options
+               if [ $? -ne 0 -a "$STOP_FAIL" -eq 1 ]; then
+                       usage "build failed for $name"
+                       exit 1
+               fi
+       fi
+done
 
 exit 0
-- 
1.6.3.3
Inline posted for review (if patch is unreadable due to changes involved)
 #!/bin/bash
 #
 # A simple script to batch generate all release-able images for MeeGo.
 #
 # This script will check out all MeeGo Image Kickstart files and execute
 # image generation based on repository type selected for all release-able
 # images.
 #
 # Written for MeeGo by Chris Ferron <[email protected]> based on
 # an initial effort buy Anas Nashif.
 #
 # Modified by Nishanth Menon <[email protected]> for a bit more flexibility
 
 # Modifiable params
 # XXX: New platform build option is added here
 # Builds supported: These are organized as:
 # build_name | ks file | build options
 Build_Options=( \
  "core-armv7l-n900|core/core-armv7l-n900.ks|-f raw --save-kernel  --arch 
armv7" \
  "core-armv7l-madde-sysroot|SDK/core-armv7l-madde-sysroot.ks|--format=fs 
--package=tar.bz2 --run-mode=0 --arch=armv7l --save-kernel" \
  "core-ia32-madde-sysroot.ks|SDK/core-ia32-madde-sysroot.ks|--format=fs 
--package=tar.bz2" \
  "netboot-ia32 | netbook/netbook-ia32.ks |-f livecd" \
  "netbook-ia32-qemu | SDK/netbook-ia32-qemu.ks | --format=raw 
--package=tar.bz2" \
  "ivi-ia32|ivi/ivi-ia32.ks| -f livecd" \
  "handset-ia32|handset/handset-ia32-mtf.ks| -f nand" \
  "handset-ia32-mtf-devel|handset/handset-ia32-mtf-devel.ks|-f nand" \
  "handset-armv7l-n900|handset/handset-armv7l-n900.ks| -f raw --save-kernel 
--arch=armv7l" \
  "handset-armv7l-n900-devel|handset/handset-armv7l-n900-devel.ks| -f raw 
--save-kernel --arch=armv7l" \
  "handset-ia32-pinetrail|handset/handset-ia32-pinetrail-mtf.ks| -f livecd" \
  "handset-armv7l-qemu |SDK/handset-armv7l-qemu.ks|--format=raw 
--package=tar.bz2 --run-mode=0 --arch=armv7l --save-kernel"\
  "handset-ia32-qemu|SDK/handset-ia32-qemu.ks| --format=raw --package=tar.bz2" \
 )
 # What releases do we support - and corresponding git branches
 Release_Name_ARRAY=( "MeeGo1.1" "Trunk" )
 Release_Branch_ARRAY=( "MeeGo1.1" "master" )
 # Repositories supported
 Repo_Name_Array=( "daily" "weekly" "preview")
 
 usage(){
        cat << USAGE >&2
 Error: $*
 Usage: $0 [-r release] -R repo [-i id] [-n] [-b build_name]
 
 Where:
  -r release - release of MeeGo - ${Release_Name_ARRAY[*]} [Default: Trunk]
  -R repo    - repo: ${Repo_Name_Array[*]} [Default: none]
  -i ID     - ID of the build if you choose weekly build [Default: none]
  -n         - Dont update git [Default: updates git to latest]
  -f         - Stop if any mic creation failed [Default: false]
  -b build_name - what images to build :  [Default: all - builds all]
        $BuildNamesPrint
        all
 
 Example usage:
 Build a preview version of MeeGo1.1 release:
  $0 -r MeeGo1.1 -R preview
 Build a daily version of MeeGo from Trunk:
  $0 -r Trunk -R daily
 Choose a weekly build version:
  $0 -r Trunk -R weekly -i 1.1.80.4.20101102.1
 Build a weekly build version for just N900 handset devel image:
  $0 -r Trunk -R weekly -i 1.1.80.4.20101102.1 -b handset-armv7l-n900-devel
 Build a weekly build version for multiple N900 images:
  $0 -r Trunk -R weekly -i 1.1.80.4.20101102.1 -b "handset-armv7l-n900-devel 
core-armv7l-n900"
 
 USAGE
        exit 1
 }
 
 # mk_image expects at minimal, one arg- the first arg must be the path to the 
ks file.
 # all further args are passed through to 'mic create'
 # finally, a --release argument is automatically prepended.
 mk_image() {
        local ks="$1";
        shift
        local name="meego-$(basename "$ks")"
        name="${name%.ks}"
        local dirname="$(dirname "$ks")"
        rm -rf "${ID}/${dirname}/images/${name}"
        mic create -c "$ks" --release="${ID}" "$@" 2>&1 | tee 
"${name}-${ID}.log"
        if [ ! -d "${ID}/${dirname}/images/${name}" ]; then
                echo "error: no ${ID}/${dirname}/images/${name} directory 
created"
                return 1
        fi
        md5sum "${name}-${ID}.log" >> "${ID}/${dirname}/images/${name}/MANIFEST"
        cp "${name}-${ID}.log" "$ID/${dirname}/images/${name}/"
        return 0
 }
 
 # Defaults
 GIT_UPDATE=1
 RELEASE=Trunk
 STOP_FAIL=0
 
 BUILD_PLATFORMS=all
 idx=0
 BuildNames=""
 while [ $idx -lt ${#build_optio...@]} ]
 do
        name=`echo "${Build_Options[$idx]}"|cut -d '|' -f1`
        BuildNames="$BuildNames $name"
        idx=$((idx + 1))
 done
 BuildNamesPrint=`echo $BuildNames|sed -e "s/ /\n\t/g"`
 
 # Drag the options in
 while getopts ":nfr:i:R:b:" opt; do
        case $opt in
        r) RELEASE=$OPTARG ;;
        n) GIT_UPDATE=0 ;;
        f) STOP_FAIL=1 ;;
        i) ID=$OPTARG ;;
        R) REPOTYPE=$OPTARG ;;
        b) BUILD_PLATFORMS=$OPTARG ;;
        \?)
                usage "Invalid option: -$OPTARG"
                exit 1
                ;;
        :)
                usage "Option -$OPTARG requires an argument."
                exit 1
                ;;
        esac
 done
 
 # Verify the RELEASE
 if [ ${#release_name_arr...@]} -ne ${#release_branch_arr...@]} ]; then
        echo "OUCH! SOMEONE CORRUPTED THE ARRAYS!!! please report" >&2
        exit 1
 fi
 idx=0
 orname=$RELEASE
 rname=`echo $RELEASE|tr 'A-Z' 'a-z'`
 RELEASE=""
 while [ $idx -lt ${#release_name_arr...@]} ]
 do
        name=`echo "${Release_Name_ARRAY[$idx]}"|tr 'A-Z' 'a-z' `
        if [ "$name" = "$rname" ]; then
                RELEASE=${Release_Name_ARRAY[$idx]}
                BRANCH=${Release_Branch_ARRAY[$idx]}
                break;
        fi
        idx=$((idx + 1))
 done
 if [ -z "$RELEASE" ]; then
        usage "Unknown Release '$orname' - supported:(${Release_Name_ARRAY[*]})"
        exit 1
 fi
 
 # Verify Repo type
 idx=0
 orname=$REPOTYPE
 rname=`echo $REPOTYPE|tr 'A-Z' 'a-z'`
 REPOTYPE=""
 while [ $idx -lt ${#repo_name_arr...@]} ]
 do
        name=`echo "${Repo_Name_Array[$idx]}"|tr 'A-Z' 'a-z' `
        if [ "$name" = "$rname" ]; then
                REPOTYPE=${Repo_Name_Array[$idx]}
                break;
        fi
        idx=$((idx + 1))
 done
 if [ -z "$REPOTYPE" ]; then
        usage "Unknown Repo '$orname' - supported:(${Repo_Name_Array[*]})"
        exit 1
 fi
 
 # Special Check for ID if weekly build is selected
 if [ "$REPOTYPE" == "weekly"  -a -z "$ID" ]; then
        usage "Weekly build selected without ID! please provide ID"
        exit 1
 fi
 if [ "$REPOTYPE" != "weekly" -a -z "$ID" ]; then
        ID="$RELEASE-$REPOTYPE"
 fi
 
 # Create the BUILDID
 str=""
 case $REPOTYPE in
        weekly)  str="s/\...@build_id\@/$ID/";;
        preview) str="s/\...@build_id\@/preview/";;
        daily)   str="s/\...@build_id\@/daily/";;
        *)
                usage "errk.. !I should'nt be here"
                exit 1;;
 esac
 
 # Check if we have a valid build platform
 if [ "$BUILD_PLATFORMS" = "all" ]; then
        BUILD_PLATFORMS="$BuildNames"
 fi
 
 # Verify the build platforms before attempting builds!
 VALID_BUILD_PLATFORMS=""
 for build in $BUILD_PLATFORMS
 do
        idx=0
        bname=`echo $build|tr 'A-Z' 'a-z'`
        valid=0
        while [ $idx -lt ${#build_optio...@]} ]
        do
                name=`echo "${Build_Options[$idx]}"|cut -d '|' -f1`
                lname=`echo $name|tr 'A-Z' 'a-z'`
                if [ "$lname" = "$bname" ]; then
                        valid=1
                        break;
                fi
                idx=$((idx + 1))
        done
        if [ $valid -eq 1 ]; then
                echo "$name is valid"
                VALID_BUILD_PLATFORMS="$VALID_BUILD_PLATFORMS $name"
        else
                usage "Unknown build platform $build!"
                exit 1
        fi
 done
 
 # Time for action
 if [ $GIT_UPDATE -eq 1 ]; then
        git checkout -f $BRANCH
        git pull
 else
        echo "WARNING: BUILDING WITHOUT GIT UPDATE!!!! - BEWARE OF STALE 
FILES!" >&2
 fi
 
 # Start build
 rm -f *.log
 
 for build in $VALID_BUILD_PLATFORMS
 do
        idx=0
        bname=`echo $build|tr 'A-Z' 'a-z'`
        match=0
        while [ $idx -lt ${#build_optio...@]} ]
        do
                name=`echo "${Build_Options[$idx]}"|cut -d '|' -f1`
                lname=`echo $name|tr 'A-Z' 'a-z'`
                if [ "$lname" = "$bname" ]; then
                        match=1
                        break;
                fi
                idx=$((idx + 1))
        done
        if [ $match -eq 1 ]; then
                name=`echo "${Build_Options[$idx]}"|cut -d '|' -f1`
                ks=`echo "${Build_Options[$idx]}"|cut -d '|' -f2`
                options=`echo "${Build_Options[$idx]}"|cut -d '|' -f3`
                # Lets modify the ks for this
                sed -e "$str" -i $ks || usage "$ks: build replacement"\
                        "failed!-please report" || exit 1
                mk_image $ks $options
                if [ $? -ne 0 -a "$STOP_FAIL" -eq 1 ]; then
                        usage "build failed for $name"
                        exit 1
                fi
        fi
 done
 
 exit 0
_______________________________________________
MeeGo-packaging mailing list
[email protected]
http://lists.meego.com/listinfo/meego-packaging

Reply via email to