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