|
diff --git a/mkipks b/mkipks index 29db5c0..b813e83 100755 --- a/ mkipks+++ b/ mkipks |
|
@@ -148,117 +148,119 @@ do |
148 | if [ -f $ff -o -b $ff -o -c $ff ] |
148 | if [ -f $ff -o -b $ff -o -c $ff ] |
149 | then |
149 | then |
150 | D=$DATADIR$BASE |
150 | D=$DATADIR$BASE |
151 | if [ -x $ff -a -n "$STRIP" ] |
151 | if [ -x $ff -a -n "$STRIP" ] |
152 | then |
152 | then |
153 | case $(file $ff) in |
153 | case $(file $ff) in |
154 | $STRIP_FILES) |
154 | $STRIP_FILES) |
155 | $STRIP $ff |
155 | $STRIP $ff |
156 | ;; *) |
156 | ;; *) |
157 | esac |
157 | esac |
158 | fi |
158 | fi |
159 | if [ -n "$RPM" ] |
159 | if [ -n "$RPM" ] |
160 | then |
160 | then |
161 | case "$ff" in |
161 | case "$ff" in |
162 | /*) RPMFILES="$RPMFILES $ff" |
162 | /*) RPMFILES="$RPMFILES $ff" |
163 | ;; *) RPMFILES="$RPMFILES $OPIEDIR/$ff" |
163 | ;; *) RPMFILES="$RPMFILES $OPIEDIR/$ff" |
164 | esac |
164 | esac |
165 | else |
165 | else |
166 | mkdir -p $D |
166 | mkdir -p $D |
167 | if cp -a $ff $D |
167 | if cp -a $ff $D |
168 | then |
168 | then |
169 | true |
169 | true |
170 | else |
170 | else |
171 | ERROR=1 |
171 | ERROR=1 |
172 | fi |
172 | fi |
173 | fi |
173 | fi |
174 | else |
174 | else |
175 | echo >&2 "$0: $i: No such file: $ff" |
175 | echo >&2 "$0: $i: No such file: $ff" |
176 | ERROR=1 |
176 | ERROR=1 |
177 | fi |
177 | fi |
178 | done |
178 | done |
179 | done |
179 | done |
180 | fi |
180 | fi |
181 | if [ -z "$ERROR" ] |
181 | if [ -z "$ERROR" ] |
182 | then |
182 | then |
183 | if [ -n "$RPM" ] |
183 | if [ -n "$RPM" ] |
184 | then |
184 | then |
185 | SPEC=/tmp/mkipks-rpm-$$.spec |
185 | SPEC=/tmp/mkipks-rpm-$$.spec |
186 | echo >$SPEC "Summary: $summary" |
186 | echo >$SPEC "Summary: $summary" |
187 | echo >>$SPEC "Name: $packagename" |
187 | echo >>$SPEC "Name: $packagename" |
188 | echo >>$SPEC "Group: $section" ########## |
188 | echo >>$SPEC "Group: $section" ########## |
189 | echo >>$SPEC "License: $license" |
189 | echo >>$SPEC "License: $license" |
190 | echo >>$SPEC "Version: ${version%-*}" |
190 | echo >>$SPEC "Version: ${version%-*}" |
191 | echo >>$SPEC "Release: ${version#*-}" |
191 | echo >>$SPEC "Release: ${version#*-}" |
192 | |
192 | |
193 | echo >>$SPEC "%description" |
193 | echo >>$SPEC "%description" |
194 | sed -n -e '/^Description:/,$ p' $i | tail +2 >>$SPEC |
194 | sed -n -e '/^Description:/,$ p' $i | tail +2 >>$SPEC |
195 | echo >>$SPEC "%files" |
195 | echo >>$SPEC "%files" |
196 | echo >>$SPEC "%defattr(-,root,root)" |
196 | echo >>$SPEC "%defattr(-,root,root)" |
197 | /bin/ls $RPMFILES >>$SPEC |
197 | /bin/ls $RPMFILES >>$SPEC |
198 | rpm -bb --target $ARCH-unknown-linux $SPEC |
198 | rpm -bb --target $ARCH-unknown-linux $SPEC |
199 | # rm $SPEC |
199 | # rm $SPEC |
200 | elif [ -z "$IMAGEDIR" ] |
200 | elif [ -z "$IMAGEDIR" ] |
201 | then |
201 | then |
202 | #size=$(du -h -s $DATADIR | sed -e 's/[ ].*//') |
202 | #size=$(du -h -s $DATADIR | sed -e 's/[ ].*//') |
203 | if (which mkfs.jffs2 >/dev/null 2>&1); then |
203 | if (which mkfs.jffs2 >/dev/null 2>&1); then |
204 | size=$(mkfs.jffs2 -r $DATADIR | wc -c) |
204 | size=$(mkfs.jffs2 -r $DATADIR | wc -c) |
205 | fi |
205 | fi |
206 | echo "Package: $packagename" >$CTRLDIR/control |
206 | echo "Package: $packagename" >$CTRLDIR/control |
207 | if [ ! -z "$size" ]; then |
207 | if [ ! -z "$size" ]; then |
208 | echo "Installed-Size: $size" >>$CTRLDIR/control |
208 | echo "Installed-Size: $size" >>$CTRLDIR/control |
209 | else |
209 | else |
210 | if [ -z "$SIZEWARNED" ] |
210 | if [ -z "$SIZEWARNED" ] |
211 | then |
211 | then |
212 | echo "Warning, no mkfs.jffs2 found, unable to set Installed-Size." |
212 | echo "Warning, no mkfs.jffs2 found, unable to set Installed-Size." |
213 | SIZEWARNED=1 |
213 | SIZEWARNED=1 |
214 | fi |
214 | fi |
215 | fi |
215 | fi |
216 | echo "Architecture: $ARCH" >>$CTRLDIR/control |
216 | echo "Architecture: $ARCH" >>$CTRLDIR/control |
217 | echo "Filename: ./$package.ipk" >>$CTRLDIR/control |
217 | echo "Filename: ./$package.ipk" >>$CTRLDIR/control |
218 | echo "Version: $version" >>$CTRLDIR/control |
218 | echo "Version: $version" >>$CTRLDIR/control |
219 | [ ! -z "$depends" ] && echo "Depends: $depends" >>$CTRLDIR/control |
219 | [ ! -z "$depends" ] && echo "Depends: $depends" >>$CTRLDIR/control |
220 | [ ! -z "$provides" ] && echo "Provides: $provides" >>$CTRLDIR/control |
220 | [ ! -z "$provides" ] && echo "Provides: $provides" >>$CTRLDIR/control |
221 | [ ! -z "$conflicts" ] && echo "Conflicts: $conflicts" >>$CTRLDIR/control |
221 | [ ! -z "$conflicts" ] && echo "Conflicts: $conflicts" >>$CTRLDIR/control |
222 | egrep -v "^(Files|Version|Depends|Provides|Conflicts|Architecture):" >>$CTRLDIR/control $i |
222 | egrep -v "^(Files|Version|Depends|Provides|Conflicts|Architecture):" >>$CTRLDIR/control $i |
223 | [ -n "$CLASSIC" ] && echo "$DEB_VERSION" >$TDIR/debian-binary |
223 | [ -n "$CLASSIC" ] && echo "$DEB_VERSION" >$TDIR/debian-binary |
224 | base=${i%.control} |
224 | base=${i%.control} |
225 | scripts="preinst postinst prerm postrm" |
225 | scripts="preinst postinst prerm postrm" |
226 | for pf in $scripts |
226 | for pf in $scripts |
227 | do |
227 | do |
228 | if [ -x ${base}.$pf ] |
228 | if [ -x ${base}.$pf ] |
229 | then |
229 | then |
230 | cp ${base}.$pf $CTRLDIR/$pf |
230 | cp ${base}.$pf $CTRLDIR/$pf |
231 | fi |
231 | fi |
232 | done |
232 | done |
233 | if [ -z "$CLASSIC" ] |
233 | if [ -z "$CLASSIC" ] |
234 | then |
234 | then |
235 | $OPIEDIR/scripts/ipkg-build -o root -g root $TDIR |
235 | $OPIEDIR/scripts/ipkg-build -o root -g root $TDIR |
236 | else |
236 | else |
237 | if [ "`id -u`" != "0" ] |
237 | if [ "`id -u`" != "0" ] |
238 | then |
238 | then |
239 | if [ -z "$ROOTWARNED" ] |
239 | if [ -z "$ROOTWARNED" ] |
240 | then |
240 | then |
241 | echo Warning. You are not root. Please become root or use fakeroot. |
241 | echo Warning. You are not root. Please become root or use fakeroot. |
242 | ROOTWARNED=1 |
242 | ROOTWARNED=1 |
243 | fi |
243 | fi |
| |
244 | else |
| |
245 | chown -R root.root $TDIR/* |
244 | fi |
246 | fi |
245 | ( cd $DATADIR && tar -czf $TDIR/data.tar.gz * ) |
247 | ( cd $DATADIR && tar -czf $TDIR/data.tar.gz * ) |
246 | ( cd $CTRLDIR && tar -czf $TDIR/control.tar.gz * ) |
248 | ( cd $CTRLDIR && tar -czf $TDIR/control.tar.gz * ) |
247 | ( cd $TDIR && tar -czf $OPIEDIR/$package.ipk ./control.tar.gz ./data.tar.gz ./debian-binary ) |
249 | ( cd $TDIR && tar -czf $OPIEDIR/$package.ipk ./control.tar.gz ./data.tar.gz ./debian-binary ) |
248 | fi |
250 | fi |
249 | RESULT=$package.ipk |
251 | RESULT=$package.ipk |
250 | if [ -n "$VERB" ] |
252 | if [ -n "$VERB" ] |
251 | then |
253 | then |
252 | echo >&2 "Built $RESULT ($size)" |
254 | echo >&2 "Built $RESULT ($size)" |
253 | fi |
255 | fi |
254 | if [ -n "$LIST" ] |
256 | if [ -n "$LIST" ] |
255 | then |
257 | then |
256 | echo $RESULT |
258 | echo $RESULT |
257 | fi |
259 | fi |
258 | fi |
260 | fi |
259 | else |
261 | else |
260 | echo >&2 "Not building $package package" |
262 | echo >&2 "Not building $package package" |
261 | fi |
263 | fi |
262 | done |
264 | done |
263 | # clean up |
265 | # clean up |
264 | rm -rf $TDIR |
266 | rm -rf $TDIR |
|