Add Intel copyright header.
[profile/ivi/cowhide.git] / examples / hoofbeats / make-wgt.sh
1 #!/bin/bash
2
3 # This script generates a widget package hoofbeats.wgt inside
4 # the root directory of this project.
5 #
6 # By default, it produces a package for the new Tizen
7 # APIs. If you want a package for the old APIs, call
8 # it with:
9 #
10 #   ./make-wgt.sh old
11
12 USE_OLD_CONFIG=$1
13 CONFIG_FILE=config.xml
14 PROJECT_NAME=hoofbeats
15
16 if [ "x$USE_OLD_CONFIG" != "x" ] ; then
17   echo "******* USING OLD APIS"
18
19   if [[ -d /tmp/$PROJECT_NAME ]] ; then
20     rm -Rf /tmp/$PROJECT_NAME/*
21     rmdir /tmp/$PROJECT_NAME
22   fi
23
24   mkdir /tmp/$PROJECT_NAME
25
26   # replace /api/ with /privilege/
27   sed -e 's%http://tizen\.org/privilege/%http://tizen\.org/api/%g' ./$CONFIG_FILE > /tmp/hoofbeats/$CONFIG_FILE
28
29   # the tmp file is the new config file
30   CONFIG_FILE=/tmp/$PROJECT_NAME/config.xml
31
32   # replace content privilege with mediacontent
33   sed -i -e 's%api/content%api/mediacontent%' $CONFIG_FILE
34
35   # remove privileges which don't exist in the old API:
36   # datacontrol, callhistory, networkbearerselection, setting
37   cat $CONFIG_FILE > $CONFIG_FILE.tmp
38
39   cat $CONFIG_FILE.tmp | grep -v "api/datacontrol" | grep -v "api/callhistory" | grep -v "api/networkbearerselection" | grep -v "api/setting" > $CONFIG_FILE
40 else
41   echo "******* USING NEW APIS"
42 fi
43
44 if [[ -f $PROJECT_NAME.wgt ]] ; then
45   rm $PROJECT_NAME.wgt
46 fi
47
48 zip --exclude stats/utils/\* stats/.git -r $PROJECT_NAME.wgt index.html icon.png javascripts stylesheets lib templates
49 zip -j $PROJECT_NAME.wgt $CONFIG_FILE