-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpackageVAP
executable file
·115 lines (94 loc) · 2.75 KB
/
packageVAP
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#!/bin/bash
###########################################################################
##
## Copyright 2015 Solar Team Eindhoven. All rights reserved.
##
## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the License.
## You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
##
###########################################################################
if [ $# -lt 3 ]; then
echo "Usage: $0 <output file> <manifext file> <input files...>"
exit 1;
fi
OUTFILE=$1
FILE=$2
echo "-----------------------------------"
echo "Solar Team Eindhoven VAP builder"
echo "-----------------------------------"
echo "Building using manifest: $2"
THISPATH="$0"
while : ; do
DIR=$(dirname "$THISPATH")
NEWTHISPATH=$(readlink -f "$THISPATH")
[ $? -eq 0 ] || break
[ "$NEWTHISPATH" != "$THISPATH" ] || break
THISPATH="$NEWTHISPATH"
done
SCHEMAFILE="$DIR/MANIFESTSchema.xsd"
xmllint --schema "$SCHEMAFILE" "$FILE" > /dev/null
EXITSTATUS=$?
if [ $EXITSTATUS -ne 0 ]; then
exit $EXITSTATUS
fi
REQUIRED_DL=`xmlstarlet sel --text -t -v '//manifest/App/pluginfiles/file/text()' "$FILE"`
if [ "$REQUIRED_DL" != "" ]; then
echo "$REQUIRED_DL" | while read line ; do
FOUNDIT=0
for i in ${@:3}
do
THISFILE=`basename "$i"`
if [ "$THISFILE" = "$line" ]; then
FOUNDIT=1
break
fi
done
if [ $FOUNDIT -eq 0 ]; then
echo "Missing file $line"
exit 1
fi
done
fi
XMLOUTFILE="temp.xml"
install -D /dev/null "$OUTFILE"
echo "Creating XMLOutfile: $XMLOUTFILE"
echo "<!DOCTYPE RCC>" > $XMLOUTFILE
echo "<RCC version=\"1.0\">" >> $XMLOUTFILE
echo "<qresource>" >> $XMLOUTFILE
echo "<file alias=\"MANIFEST.xml\">$FILE</file>" >> $XMLOUTFILE
for i in ${@:3}
do
FILEBASE=`basename "$i"`
echo "Adding file: $FILEBASE"
echo "<file alias=\"$FILEBASE\">$i</file>" >> $XMLOUTFILE
done
echo "</qresource>" >> $XMLOUTFILE
echo "</RCC>" >> $XMLOUTFILE
echo "Done creating outfile!"
function ExecExists() {
(which $1 >/dev/null 2>&1 && return 0) || return 1
}
if [ -e "$OE_QMAKE_RCC" ]; then
RCC="$OE_QMAKE_RCC"
elif ExecExists rcc-qt5; then
RCC="rcc-qt5"
elif ExecExists rcc; then
RCC="rcc"
else
echo "Could not find rcc, please install!!" >&2
exit 1
fi
echo "Building outfile: $OUTFILE.."
$RCC -o "$OUTFILE" -binary "$XMLOUTFILE"
echo "Cleaning up.."
rm "temp.xml"
echo "All done!"