-rwxr-xr-x | scripts/mkipkg | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/scripts/mkipkg b/scripts/mkipkg index 7877078..9c5e184 100755 --- a/scripts/mkipkg +++ b/scripts/mkipkg | |||
@@ -285,81 +285,83 @@ substFiles() | |||
285 | for f in $1; do | 285 | for f in $1; do |
286 | substFile ./$f | 286 | substFile ./$f |
287 | done | 287 | done |
288 | } | 288 | } |
289 | 289 | ||
290 | substAndStripFiles() | 290 | substAndStripFiles() |
291 | { | 291 | { |
292 | for f in $1; do | 292 | for f in $1; do |
293 | stripFile ./$f | 293 | stripFile ./$f |
294 | substFile ./$f $2 | 294 | substFile ./$f $2 |
295 | done | 295 | done |
296 | } | 296 | } |
297 | 297 | ||
298 | installScript() | 298 | installScript() |
299 | { | 299 | { |
300 | if [ -n "$1" -a -f "$1" ]; then | 300 | if [ -n "$1" -a -f "$1" ]; then |
301 | destfile=`basename $1` | 301 | destfile=`basename $1` |
302 | filetype=`echo $destfile|cut -d. -f2` | 302 | filetype=`echo $destfile|cut -d. -f2` |
303 | if [ -n "$filetype" ]; then destfile=$filetype; fi | 303 | if [ -n "$filetype" ]; then destfile=$filetype; fi |
304 | if [ -n "$subst" ]; then | 304 | if [ -n "$subst" ]; then |
305 | sed -f $subst < $1 > $ctrldir/$destfile | 305 | sed -f $subst < $1 > $ctrldir/$destfile |
306 | else | 306 | else |
307 | cat $1 > $ctrldir/$destfile | 307 | cat $1 > $ctrldir/$destfile |
308 | fi | 308 | fi |
309 | chmod +x $ctrldir/$destfile | 309 | chmod +x $ctrldir/$destfile |
310 | fi | 310 | fi |
311 | } | 311 | } |
312 | 312 | ||
313 | tempDir=/tmp/`basename $self`.$$ | 313 | tempDir=/tmp/`basename $self`.$$ |
314 | mkdir -p $tempDir | 314 | mkdir -p $tempDir |
315 | if [ $? != 0 ]; then | 315 | if [ $? != 0 ]; then |
316 | echo "$self: cannot create $tempDir, exiting..." | 316 | echo "$self: cannot create $tempDir, exiting..." |
317 | rm -rf $tempDir | ||
317 | exit 1 | 318 | exit 1 |
318 | fi | 319 | fi |
319 | 320 | ||
320 | ctrldir=$tempDir/CONTROL | 321 | ctrldir=$tempDir/CONTROL |
321 | 322 | ||
322 | mkdir -p $ctrldir | 323 | mkdir -p $ctrldir |
323 | 324 | ||
324 | if [ ! -e $subst ] || [ -z "$subst" ]; then | 325 | if [ ! -e $subst ] || [ -z "$subst" ]; then |
325 | cat $control > $ctrldir/control.new | 326 | cat $control > $ctrldir/control.new |
326 | else | 327 | else |
327 | sed -f $subst < $control > $ctrldir/control.new | 328 | sed -f $subst < $control > $ctrldir/control.new |
328 | fi | 329 | fi |
329 | 330 | ||
330 | createFileList $ctrldir/control.new ipkgFileList | 331 | createFileList $ctrldir/control.new ipkgFileList |
331 | 332 | ||
332 | if [ "$?" != "0" ]; then | 333 | if [ "$?" != "0" ]; then |
333 | echo "$self: ERROR: missing files, not building $control" | 334 | echo "$self: ERROR: missing files, not building $control" |
335 | rm -rf $tempDir | ||
334 | exit 1 | 336 | exit 1 |
335 | fi | 337 | fi |
336 | 338 | ||
337 | 339 | ||
338 | cat $ctrldir/control.new | egrep -v '^(Files|FileExcludeMask|FileIncludeMask):' > $ctrldir/control | 340 | cat $ctrldir/control.new | egrep -v '^(Files|FileExcludeMask|FileIncludeMask):' > $ctrldir/control |
339 | rm -f $ctrldir/control.new | 341 | rm -f $ctrldir/control.new |
340 | 342 | ||
341 | ( cd $destdir && tar -cf - $ipkgFileList 2>/dev/null ) | ( cd $tempDir && tar -xf - 2>/dev/null ) | 343 | ( cd $destdir && tar -cf - $ipkgFileList 2>/dev/null ) | ( cd $tempDir && tar -xf - 2>/dev/null ) |
342 | 344 | ||
343 | if [ -z "$filesubst" ]; then | 345 | if [ -z "$filesubst" ]; then |
344 | ( cd $tempDir && stripFiles "$ipkgFileList" ) | 346 | ( cd $tempDir && stripFiles "$ipkgFileList" ) |
345 | else | 347 | else |
346 | if ! (echo $filesubst|grep -q '^/'); then | 348 | if ! (echo $filesubst|grep -q '^/'); then |
347 | filesubst="$oldpwd/$filesubst" | 349 | filesubst="$oldpwd/$filesubst" |
348 | fi | 350 | fi |
349 | ( cd $tempDir && substAndStripFiles "$ipkgFileList" $filesubst ) | 351 | ( cd $tempDir && substAndStripFiles "$ipkgFileList" $filesubst ) |
350 | fi | 352 | fi |
351 | 353 | ||
352 | path="`echo "$PATH" | sed -e "s/\:/ /g"`" | 354 | path="`echo "$PATH" | sed -e "s/\:/ /g"`" |
353 | if [ -z "$mkfsjffs2" ]; then | 355 | if [ -z "$mkfsjffs2" ]; then |
354 | for i in $path; do | 356 | for i in $path; do |
355 | if [ -x "$i/mkfs.jffs2" ]; then | 357 | if [ -x "$i/mkfs.jffs2" ]; then |
356 | mkfsjffs2="$i/mkfs.jffs2" | 358 | mkfsjffs2="$i/mkfs.jffs2" |
357 | break | 359 | break |
358 | fi | 360 | fi |
359 | done | 361 | done |
360 | fi | 362 | fi |
361 | 363 | ||
362 | if [ -z "$mkfsjffs2" ]; then | 364 | if [ -z "$mkfsjffs2" ]; then |
363 | echo "$self: WARNING: no mkjfs.jffs2 found in path. Falling back to using du" | 365 | echo "$self: WARNING: no mkjfs.jffs2 found in path. Falling back to using du" |
364 | echo "for size calculation. mkfs.jffs2 is recommended for size calculation" | 366 | echo "for size calculation. mkfs.jffs2 is recommended for size calculation" |
365 | echo "as it calculates the real package size on the compressed file system," | 367 | echo "as it calculates the real package size on the compressed file system," |