summaryrefslogtreecommitdiff
authorschurig <schurig>2003-06-03 11:49:03 (UTC)
committer schurig <schurig>2003-06-03 11:49:03 (UTC)
commitaaf7709f64dda5a6cb81eeb96e421ba4189654d6 (patch) (unidiff)
tree2571cb8ae66a1dbc323d813a148dbcb3012f390f
parent17b5bc4593ab0786f6488d452ae2430d6e4c46a5 (diff)
downloadopie-aaf7709f64dda5a6cb81eeb96e421ba4189654d6.zip
opie-aaf7709f64dda5a6cb81eeb96e421ba4189654d6.tar.gz
opie-aaf7709f64dda5a6cb81eeb96e421ba4189654d6.tar.bz2
remove $tempDir after an error
Diffstat (more/less context) (ignore whitespace changes)
-rwxr-xr-xscripts/mkipkg2
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
@@ -301,49 +301,51 @@ installScript()
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
313tempDir=/tmp/`basename $self`.$$ 313tempDir=/tmp/`basename $self`.$$
314mkdir -p $tempDir 314mkdir -p $tempDir
315if [ $? != 0 ]; then 315if [ $? != 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
318fi 319fi
319 320
320ctrldir=$tempDir/CONTROL 321ctrldir=$tempDir/CONTROL
321 322
322mkdir -p $ctrldir 323mkdir -p $ctrldir
323 324
324if [ ! -e $subst ] || [ -z "$subst" ]; then 325if [ ! -e $subst ] || [ -z "$subst" ]; then
325 cat $control > $ctrldir/control.new 326 cat $control > $ctrldir/control.new
326else 327else
327 sed -f $subst < $control > $ctrldir/control.new 328 sed -f $subst < $control > $ctrldir/control.new
328fi 329fi
329 330
330createFileList $ctrldir/control.new ipkgFileList 331createFileList $ctrldir/control.new ipkgFileList
331 332
332if [ "$?" != "0" ]; then 333if [ "$?" != "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
335fi 337fi
336 338
337 339
338cat $ctrldir/control.new | egrep -v '^(Files|FileExcludeMask|FileIncludeMask):' > $ctrldir/control 340cat $ctrldir/control.new | egrep -v '^(Files|FileExcludeMask|FileIncludeMask):' > $ctrldir/control
339rm -f $ctrldir/control.new 341rm -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
343if [ -z "$filesubst" ]; then 345if [ -z "$filesubst" ]; then
344 ( cd $tempDir && stripFiles "$ipkgFileList" ) 346 ( cd $tempDir && stripFiles "$ipkgFileList" )
345else 347else
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 )