[Service] Fix DeviceApiRouter with "new Service"
[platform/framework/web/wrtjs.git] / tizen / build / build_app.sh
1 #!/bin/bash
2
3 output_path=${1}
4 source_dir_name=${2}
5 source_path=${output_path}/${source_dir_name}
6 file_name=${3}
7 file_extension=${4}
8 privilege=${5}
9 profile=${6}
10
11 echo "Start $0..."
12 echo "ARGS=$@"
13 echo "PWD=$PWD"
14 echo "output_path=$output_path"
15 echo "source_dir_name=$source_dir_name"
16 echo "source_path=$source_path"
17 echo "file_name=$file_name"
18 echo "privilege=$privilege"
19 echo "profile=$profile"
20
21 if [ "${file_extension}" == "tpk" ]; then
22   # Upgradable WRTjs
23   rm -rf ${source_path}
24   install -d ${source_path}/shared/res/wrt
25   install -d ${source_path}/license
26   install -m 0644 packaging/tizen-manifest-tpk.xml ${source_path}/tizen-manifest.xml
27   install -m 0644 LICENSE ${source_path}/license
28   cp -rf out/gen/app ${source_path}/shared/res/wrt/app
29 elif [ "${file_extension}" == "wgt" ]; then
30   # DeviceHome
31   cp -rf device_home ${source_path}
32 else
33   echo "Please add proper file extension."
34   exit 1
35 fi
36
37 # Test signing
38 /usr/bin/hash-signer.sh -a -d -p ${privilege} -b ${output_path} ${source_dir_name}
39
40 pushd ${source_path}
41 echo "* zip"
42 zip -yr $file_name .
43 mv $file_name ../
44 popd
45
46 # tpkresigning from app-signer package
47 if [ "${profile}" == "tv" -a "${privilege}" != "public" ]; then
48   tpkresigner -a -d -p ${privilege} -n %{4} ${output_path}/${file_name}
49 fi
50 ls ${output_path}
51 rm -rf ${source_path}
52
53 echo "Finished $0 $@"