IVI repo changes.
[platform/upstream/image-configurations.git] / scripts / create.sh
1 #!/bin/sh
2 #
3 #A simple script to batch generate all release-able images for MeeGo. 
4 #
5 #This script will check out all MeeGo Image Kickstart files and execute 
6 #image generation based on repository type selected for all release-able images. 
7 #
8 # Written for MeeGo by Chris Ferron <chris.e.ferron@linux.intel.com> based on an initial
9 # effort buy Anas Nashif.
10
11
12 ID=$1
13 REPOTYPE=$2
14 RELEASE=$3
15
16 # Preparation Section
17 #export http_proxy= http://XXX.XXX.XXX.XXX:XXXX/
18
19 rm -f *.log
20
21 if [ "$RELEASE" = "MeeGo1.1" ]; then
22    git checkout -f MeeGo1.1 
23 elif [ "$RELEASE" = "Trunk" ]; then 
24    git checkout -f master
25 else
26    git checkout -f master
27    echo "No release type given, default to Trunk. Current support is for Trunk and MeeGo1.1"
28 fi
29
30 git pull
31
32 if [ "$REPOTYPE" = "1" ]; then
33   str="s/\@BUILD_ID\@/$ID/"
34 elif [ "$REPOTYPE" = "2" ]; then 
35   str="s/\@BUILD_ID\@/preview/"
36 elif [ "$REPOTYPE" = "3" ]; then 
37   str="s/\@BUILD_ID\@/daily/" 
38 else
39  echo " Repository Type needs to be 1 for Weekly or 2 for Preview or 3 for Daily" 
40  exit 1 
41 fi
42
43 find -name \*.ks -exec perl  -pi -e $str '{}' \;
44
45 # mk_image expects at minimal, one arg- the first arg must be the path to the ks file.
46 # all further args are passed through to 'mic create'
47 # finally, a --release argument is automatically prepended.
48 mk_image() {
49    local ks="$1";
50    shift
51    local name="meego-$(basename "$ks")"
52    name="${name%.ks}"
53    local dirname="$(dirname "$ks")"
54    rm -rf "${ID}/${dirname}/images/${name}"
55    mic create -c "$ks" --release="${ID}" "$@" 2>&1 | tee "${name}-${ID}.log"
56    if [ ! -d "${ID}/${dirname}/images/${name}" ]; then
57       echo "error: no ${ID}/${dirname}/images/${name} directory created"
58       return 1
59    fi
60    md5sum "${name}-${ID}.log" >> "${ID}/${dirname}/images/${name}/MANIFEST"
61    cp "${name}-${ID}.log" "$ID/${dirname}/images/${name}/"
62 }
63
64
65 #Core Image Section
66 mk_image core/core-armv7l-n900.ks -f raw --save-kernel --arch armv7
67 mk_image core/core-armv7l-madde-sysroot.ks --format=fs --compress-disk-image=none --package=tar.bz2 --arch=armv7l --save-kernel
68 mk_image core/core-ia32-madde-sysroot.ks --format=fs --compress-disk-image=none --package=tar.bz2
69
70 #Netbook Image Section
71 mk_image netbook/netbook-ia32.ks -f livecd
72 mk_image netbook/netbook-ia32-qemu.ks --format=raw --compress-disk-image=none --package=tar.bz2
73
74 #IVI Image Section
75 mk_image ivi/ivi-ia32.ks -f livecd
76
77 #Handset Image Section
78 #mk_image handset/handset-ia32-aava-mtf.ks -f nand
79 mk_image handset/handset-ia32-mtf.ks -f nand
80 #mk_image handset/handset-ia32-aava-mtf-devel.ks -f nand
81 mk_image handset/handset-ia32-mtf-devel.ks -f nand
82 mk_image handset/handset-armv7l-n900.ks -f raw --save-kernel --arch=armv7l
83 mk_image handset/handset-armv7l-n900-devel.ks -f raw --save-kernel --arch=armv7l
84 mk_image handset/handset-armv7hl-n900.ks -f raw --save-kernel --arch=armv7hl
85 mk_image handset/handset-ia32-pinetrail-mtf.ks -f livecd
86 mk_image handset/handset-armv7l-qemu.ks --format=raw --compress-disk-image=none --package=tar.bz2 --arch=armv7l --save-kernel
87 mk_image handset/handset-ia32-qemu.ks --format=raw --compress-disk-image=none --package=tar.bz2
88 mk_image handset/handset-armv7l-madde-sysroot.ks --format=fs --compress-disk-image=none --package=tar.bz2 --arch=armv7l --save-kernel
89 mk_image handset/handset-ia32-madde-sysroot.ks --format=fs --compress-disk-image=none --package=tar.bz2
90
91 exit 0