|
diff --git a/mkipks b/mkipks new file mode 100755 index 0000000..9261ec9 --- a/dev/null +++ b/ mkipks |
|
@@ -0,0 +1,272 @@ |
| |
1 | #!/bin/sh |
| |
2 | |
| |
3 | QTE_VERSION=2.3.7 |
| |
4 | DEB_VERSION=2.0 |
| |
5 | |
| |
6 | LIBQPE_VERSION=1.5.2 |
| |
7 | LIBQPE_VERSION_MAJ=1 |
| |
8 | LIBQPE_VERSION_MIN=5 |
| |
9 | LIBQPE_VERSION_PAT=2 |
| |
10 | |
| |
11 | # Have to do this here, since CVS can't store symlinks |
| |
12 | mkdir -p $QPEDIR/etc/rc2.d |
| |
13 | rm -f $QPEDIR/etc/rc2.d/S98qpe |
| |
14 | ln -s ../init.d/qpe $QPEDIR/etc/rc2.d/S98qpe |
| |
15 | |
| |
16 | VERSION_MAJ=$(sed -n -e 's/.*QPE_VERSION "\([0-9]*\)\..*\..*".*/\1/p' <$QPEDIR/include/qpe/version.h) |
| |
17 | VERSION_MIN=$(sed -n -e 's/.*QPE_VERSION ".*\.\([0-9]*\)\..*".*/\1/p' <$QPEDIR/include/qpe/version.h) |
| |
18 | VERSION_PAT=$(sed -n -e 's/.*QPE_VERSION ".*\..*\.\([0-9]*\).*/\1/p' <$QPEDIR/include/qpe/version.h) |
| |
19 | if grep -q 'QPE_VERSION .*snapshot' $QPEDIR/include/qpe/version.h |
| |
20 | then |
| |
21 | VERSION_CVS="_$(date +%Y%m%d)" |
| |
22 | else |
| |
23 | VERSION_CVS="" |
| |
24 | fi |
| |
25 | |
| |
26 | QPE_VERSION=$VERSION_MAJ.$VERSION_MIN.$VERSION_PAT |
| |
27 | |
| |
28 | ARCH=arm |
| |
29 | CPU_ARCH=arm |
| |
30 | DEVICE_ARCH=SHARP |
| |
31 | STRIP=arm-linux-strip |
| |
32 | STRIP_FILES="*ARM*not stripped" |
| |
33 | |
| |
34 | TDIR=/tmp/ipk$$ |
| |
35 | DATADIR=$TDIR/data |
| |
36 | CTRLDIR=$TDIR/control |
| |
37 | |
| |
38 | IMAGEDIR= |
| |
39 | VERB= |
| |
40 | LIST= |
| |
41 | RPM= |
| |
42 | QUICKLAUNCH= |
| |
43 | RDIR=$PWD |
| |
44 | |
| |
45 | while [ $# -ne 0 ] |
| |
46 | do |
| |
47 | case "$1" in |
| |
48 | -v) |
| |
49 | VERB=1 |
| |
50 | echo >&2 "Packaging for version $VERSION_MAJ.$VERSION_MIN.$VERSION_PAT$VERSION_CVS" |
| |
51 | ;; -l) |
| |
52 | LIST=1 |
| |
53 | ;; -i) |
| |
54 | shift |
| |
55 | IMAGEDIR=$1 |
| |
56 | DATADIR=$IMAGEDIR |
| |
57 | mkdir -p $IMAGEDIR |
| |
58 | ;; -rpm) |
| |
59 | if [ "$QPEDIR" != "/opt/QtPalmtop" ] |
| |
60 | then |
| |
61 | echo >&2 '$QPEDIR is not the standard /usr/Qtopia directory.' |
| |
62 | sleep 1 |
| |
63 | #exit 1 |
| |
64 | fi |
| |
65 | RPM=1 |
| |
66 | ;; -arch) |
| |
67 | shift |
| |
68 | ARCH=$1 |
| |
69 | STRIP= |
| |
70 | STRIP_FILES= |
| |
71 | ;; -platform) |
| |
72 | shift |
| |
73 | DEVICE_ARCH=$1 |
| |
74 | CPU_ARCH=arm |
| |
75 | ;; -o) |
| |
76 | shift |
| |
77 | RDIR=$1 |
| |
78 | ;; -quicklaunch) |
| |
79 | QUICKLAUNCH=1 |
| |
80 | ;; /*) |
| |
81 | FILES="$FILES $1" |
| |
82 | ;; *) |
| |
83 | FILES="$FILES $PWD/$1" |
| |
84 | esac |
| |
85 | shift |
| |
86 | done |
| |
87 | |
| |
88 | |
| |
89 | if [ -z "$FILES" ] |
| |
90 | then |
| |
91 | FILES=`find $QPEDIR -name "*.control" -print` |
| |
92 | fi |
| |
93 | |
| |
94 | cd $QPEDIR |
| |
95 | |
| |
96 | for i in $FILES |
| |
97 | do |
| |
98 | rm -rf $TDIR |
| |
99 | |
| |
100 | mkdir -p $DATADIR |
| |
101 | mkdir -p $CTRLDIR |
| |
102 | |
| |
103 | packagename=${i##*/}; packagename=${packagename%.control} |
| |
104 | version=$(eval echo '"'$(sed -n -e "s/^Version: *//p" $i)'"') |
| |
105 | depends=$(eval echo '"'$(sed -n -e "s/^Depends: *//p" $i)'"') |
| |
106 | files=$(eval echo $(sed -n -e "s/^Files://p" $i)) |
| |
107 | arch=$(eval echo '"'$(sed -n -e "s/^Arch: *//p" $i)'"') |
| |
108 | platform=$(eval echo '"'$(sed -n -e "s/^Architecture: *//p" $i)'"') |
| |
109 | section=$(sed -n -e "s/^Section: *//p" $i) |
| |
110 | license=$(sed -n -e "s/^License: *//p" $i) |
| |
111 | summary=$(sed -n -e "s/^Description: *//p" $i) |
| |
112 | package=${packagename}_${version}_$ARCH |
| |
113 | ERROR= |
| |
114 | if [ -z "$files" ] |
| |
115 | then |
| |
116 | mkdir -p $DATADIR/usr/share/doc/$packagename |
| |
117 | else |
| |
118 | if [ -n "$QUICKLAUNCH" ] |
| |
119 | then |
| |
120 | for f in $files |
| |
121 | do |
| |
122 | case $f in |
| |
123 | bin/*) |
| |
124 | # if the bin name is a link then we assume quicklauncher is |
| |
125 | # being used and add the application plugin to the project |
| |
126 | if [ -L $QPEDIR/$f ] |
| |
127 | then |
| |
128 | plugin=$(echo $f | sed -n -e "s/^bin\/*//p") |
| |
129 | pfiles=$(find $QPEDIR/plugins/application -name "lib$plugin.so*") |
| |
130 | for pf in $pfiles |
| |
131 | do |
| |
132 | pf=$(basename $pf) |
| |
133 | files="$files plugins/application/$pf" |
| |
134 | done |
| |
135 | fi |
| |
136 | esac |
| |
137 | done |
| |
138 | fi |
| |
139 | |
| |
140 | for f in $files |
| |
141 | do |
| |
142 | if [ -d $f ] |
| |
143 | then |
| |
144 | ffiles=$(find $f -type f -o -type b -o -type c -o -type l) |
| |
145 | else |
| |
146 | ffiles=$f |
| |
147 | fi |
| |
148 | for ff in $ffiles |
| |
149 | do |
| |
150 | case $ff in |
| |
151 | */CVS/*) |
| |
152 | continue |
| |
153 | ;;*~) |
| |
154 | continue |
| |
155 | ;;*.control) |
| |
156 | continue |
| |
157 | ;; $QTDIR/*) |
| |
158 | BASE=/opt/QtPalmtop/$(dirname ${ff#$QTDIR/}) |
| |
159 | ;; etc/*.d/*) |
| |
160 | BASE=$(dirname /$ff) |
| |
161 | ;; ipaq/*) |
| |
162 | BASE=$(dirname ${ff#ipaq}) |
| |
163 | ;; *) |
| |
164 | BASE=/opt/QtPalmtop/$(dirname $ff) |
| |
165 | esac |
| |
166 | |
| |
167 | if [ -f $ff -o -b $ff -o -c $ff -o -L $ff ] |
| |
168 | then |
| |
169 | D=$DATADIR$BASE |
| |
170 | if [ -x $ff -a -n "$STRIP" ] |
| |
171 | then |
| |
172 | case $(file $ff) in |
| |
173 | $STRIP_FILES) |
| |
174 | $STRIP $ff |
| |
175 | ;; *) |
| |
176 | esac |
| |
177 | fi |
| |
178 | if [ -n "$RPM" ] |
| |
179 | then |
| |
180 | case "$ff" in |
| |
181 | /*) RPMFILES="$RPMFILES $ff" |
| |
182 | ;; *) RPMFILES="$RPMFILES $QPEDIR/$ff" |
| |
183 | esac |
| |
184 | else |
| |
185 | mkdir -p $D |
| |
186 | if cp -a $ff $D |
| |
187 | then |
| |
188 | true |
| |
189 | else |
| |
190 | ERROR=1 |
| |
191 | fi |
| |
192 | fi |
| |
193 | else |
| |
194 | echo >&2 "$0: $i: No such file: $ff" |
| |
195 | ERROR=1 |
| |
196 | fi |
| |
197 | done |
| |
198 | done |
| |
199 | fi |
| |
200 | if [ -z "$ERROR" ] |
| |
201 | then |
| |
202 | if [ -n "$RPM" ] |
| |
203 | then |
| |
204 | SPEC=/tmp/mkipks-rpm-$$.spec |
| |
205 | echo >$SPEC "Summary: $summary" |
| |
206 | echo >>$SPEC "Name: $packagename" |
| |
207 | echo >>$SPEC "Group: $section" ########## |
| |
208 | echo >>$SPEC "License: $license" |
| |
209 | echo >>$SPEC "Version: ${version%-*}" |
| |
210 | echo >>$SPEC "Release: ${version#*-}" |
| |
211 | |
| |
212 | echo >>$SPEC "%description" |
| |
213 | sed -n -e '/^Description:/,$ p' $i | tail +2 >>$SPEC |
| |
214 | echo >>$SPEC "%files" |
| |
215 | echo >>$SPEC "%defattr(-,root,root)" |
| |
216 | /bin/ls $RPMFILES >>$SPEC |
| |
217 | rpm -bb --target $ARCH-unknown-linux $SPEC |
| |
218 | # rm $SPEC |
| |
219 | elif [ -z "$IMAGEDIR" ] |
| |
220 | then |
| |
221 | if [ -z `which mkfs.jffs2` ] |
| |
222 | then |
| |
223 | size=$(du -h -s $DATADIR | sed -e 's/[ ].*//') |
| |
224 | else |
| |
225 | size=$(mkfs.jffs2 -r $DATADIR | wc -c) |
| |
226 | fi |
| |
227 | echo "Package: $packagename" >$CTRLDIR/control |
| |
228 | echo "Installed-Size: $size" >>$CTRLDIR/control |
| |
229 | echo "Filename: ./$package.ipk" >>$CTRLDIR/control |
| |
230 | if [ -n $platform ] |
| |
231 | then |
| |
232 | echo "Architecture: $platform" >> $CTRLDIR/control |
| |
233 | fi |
| |
234 | if [ -n $arch ] |
| |
235 | then |
| |
236 | echo "Arch: $arch" >> $CTRLDIR/control |
| |
237 | fi |
| |
238 | echo "Version: $version" >>$CTRLDIR/control |
| |
239 | if [ -n "$depends" ]; then echo "Depends: $depends" >>$CTRLDIR/control; fi |
| |
240 | egrep -v "^(Files|Version|Depends|Arch|Architecture):" >>$CTRLDIR/control $i |
| |
241 | echo "$DEB_VERSION" >$TDIR/debian-binary |
| |
242 | base=${i%.control} |
| |
243 | scripts="preinst postinst prerm postrm" |
| |
244 | for pf in $scripts |
| |
245 | do |
| |
246 | if [ -x ${base}.$pf ] |
| |
247 | then |
| |
248 | cp ${base}.$pf $CTRLDIR/$pf |
| |
249 | fi |
| |
250 | done |
| |
251 | if [ "$UID" = 0 ] |
| |
252 | then |
| |
253 | chown -R root.root $TDIR |
| |
254 | fi |
| |
255 | ( cd $CTRLDIR; tar cfz ../control.tar.gz ./*; ) |
| |
256 | ( cd $DATADIR; tar cfz ../data.tar.gz ./*; ) |
| |
257 | ( cd $TDIR; rm -rf control data; tar cf - ./debian-binary ./control.tar.gz ./data.tar.gz; ) | gzip >$RDIR/$package.ipk |
| |
258 | rm -rf $TDIR |
| |
259 | RESULT=$package.ipk |
| |
260 | if [ -n "$VERB" ] |
| |
261 | then |
| |
262 | echo >&2 "Built $RESULT ($size)" |
| |
263 | fi |
| |
264 | if [ -n "$LIST" ] |
| |
265 | then |
| |
266 | echo $RESULT |
| |
267 | fi |
| |
268 | fi |
| |
269 | else |
| |
270 | echo >&2 "Not building $package package" |
| |
271 | fi |
| |
272 | done |
|