rpm-installer : include app_manager_extension.h file.
[platform/core/base/rpm-installer.git] / backend / scripts / coretpk_rw_xml_converter.sh.in
1 #!/bin/sh
2 INPUT=$1
3 OUTPUT=$2
4 PKGID=$3
5 USRAPPDIR=$4
6 CLIENTID=$5
7 INSTALLLOCATION=0
8
9 if [ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ]
10 then
11         echo "error!"
12         exit 2
13 fi
14
15 if [ $(grep -c " exec=\"/opt/" $INPUT) -gt 0 ] || [ $(grep -c "<icon>/opt/" $INPUT) -gt 0 ]
16 then
17         exit 44
18 fi
19
20 if [ $(grep -c "install-location=" $INPUT) -gt 0 ]
21 then
22         INSTALLLOCATION=1
23 fi
24
25
26 if [ -n "$4" ]
27 then
28         if [ $(grep -c "<service-application" $INPUT) -gt 0 ]
29         then
30                 if [ $INSTALLLOCATION -eq 1 ]
31                 then
32                         /bin/sed        -e      "s#<icon>#<icon>/opt/usr/apps/$PKGID/shared/res/#g" \
33                                                 -e      "s#exec=\"#exec=\"$USRAPPDIR/$PKGID/bin/#g" \
34                                                 -e "/<feature.*>/ d" -e "/<feature /,/<\/feature>/ d" \
35                                                 -e      "s#\(<manifest[^>]*\)>#\1 storeclient-id=\"$CLIENTID\">#" \
36                                                 -e "s#package=\"#type=\"coretpk\" package=\"#g" $INPUT > $OUTPUT
37                 else
38                         /bin/sed        -e      "s#<icon>#<icon>/opt/usr/apps/$PKGID/shared/res/#g" \
39                                                 -e      "s#exec=\"#exec=\"$USRAPPDIR/$PKGID/bin/#g" \
40                                                 -e "/<feature.*>/ d" -e "/<feature /,/<\/feature>/ d" \
41                                                 -e "s#\(<manifest[^>]*\)>#\1 install-location=\"internal-only\">#" \
42                                                 -e      "s#\(<manifest[^>]*\)>#\1 storeclient-id=\"$CLIENTID\">#" \
43                                                 -e "s#package=\"#type=\"coretpk\" package=\"#g" $INPUT > $OUTPUT
44                 fi
45         else
46                 if [ $INSTALLLOCATION -eq 1 ]
47                 then
48                         /bin/sed        -e      "s#<icon>#<icon>/opt/usr/apps/$PKGID/shared/res/#g" \
49                                                 -e      "s#exec=\"#exec=\"$USRAPPDIR/$PKGID/bin/#g" \
50                                                 -e "/<feature.*>/ d" -e "/<feature /,/<\/feature>/ d" \
51                                                 -e      "s#\(<manifest[^>]*\)>#\1 storeclient-id=\"$CLIENTID\">#" \
52                                                 -e "s#package=\"#type=\"coretpk\" package=\"#g" $INPUT > $OUTPUT
53                 else
54                         /bin/sed        -e      "s#<icon>#<icon>/opt/usr/apps/$PKGID/shared/res/#g" \
55                                                 -e      "s#exec=\"#exec=\"$USRAPPDIR/$PKGID/bin/#g" \
56                                                 -e "/<feature.*>/ d" -e "/<feature /,/<\/feature>/ d" \
57                                                 -e "s#\(<manifest[^>]*\)>#\1 install-location=\"auto\">#" \
58                                                 -e      "s#\(<manifest[^>]*\)>#\1 storeclient-id=\"$CLIENTID\">#" \
59                                                 -e "s#package=\"#type=\"coretpk\" package=\"#g" $INPUT > $OUTPUT
60                 fi
61         fi
62 else
63         if [ $(grep -c "<service-application" $INPUT) -gt 0 ]
64         then
65                 if [ $INSTALLLOCATION -eq 1 ]
66                 then
67                         /bin/sed        -e      "s#<icon>#<icon>/opt/usr/apps/$PKGID/shared/res/#g" \
68                                                 -e "/<feature.*>/ d" -e "/<feature /,/<\/feature>/ d" \
69                                                 -e      "s#exec=\"#exec=\"$USRAPPDIR/$PKGID/bin/#g" \
70                                                 -e "s#package=\"#type=\"coretpk\" package=\"#g" $INPUT > $OUTPUT
71                 else
72                         /bin/sed        -e      "s#<icon>#<icon>/opt/usr/apps/$PKGID/shared/res/#g" \
73                                                 -e      "s#exec=\"#exec=\"$USRAPPDIR/$PKGID/bin/#g" \
74                                                 -e "/<feature.*>/ d" -e "/<feature /,/<\/feature>/ d" \
75                                                 -e "s#\(<manifest[^>]*\)>#\1 install-location=\"internal-only\">#" \
76                                                 -e "s#package=\"#type=\"coretpk\" package=\"#g" $INPUT > $OUTPUT
77                 fi
78         else
79                 if [ $INSTALLLOCATION -eq 1 ]
80                 then
81                         /bin/sed        -e      "s#<icon>#<icon>/opt/usr/apps/$PKGID/shared/res/#g" \
82                                                 -e "/<feature.*>/ d" -e "/<feature /,/<\/feature>/ d" \
83                                                 -e      "s#exec=\"#exec=\"$USRAPPDIR/$PKGID/bin/#g" \
84                                                 -e "s#package=\"#type=\"coretpk\" package=\"#g" $INPUT > $OUTPUT
85                 else
86                         /bin/sed        -e      "s#<icon>#<icon>/opt/usr/apps/$PKGID/shared/res/#g" \
87                                                 -e      "s#exec=\"#exec=\"$USRAPPDIR/$PKGID/bin/#g" \
88                                                 -e "/<feature.*>/ d" -e "/<feature /,/<\/feature>/ d" \
89                                                 -e "s#\(<manifest[^>]*\)>#\1 install-location=\"auto\">#" \
90                                                 -e "s#package=\"#type=\"coretpk\" package=\"#g" $INPUT > $OUTPUT
91                 fi
92         fi
93 fi