Do not try to rm OMIT_FROM_DIST files if they don't exist.
[git-tools-moved-to-github.git] / id-deb-build / mkdist.sh
index 1dec8ea..473013e 100755 (executable)
@@ -37,12 +37,15 @@ if [ "x$1" != x ]; then
   VERSION=$1
 fi
 
+trap 'rm -f tmp.tar' 0
 git archive --format=tar --prefix=$NAME-$VERSION/ v${VERSION} > tmp.tar || die "This version is not tagged in Git";
 tar xf tmp.tar
 rm tmp.tar
 for file in debian $OMIT_FROM_DIST; do
-  echo "Omitting $file from distribution"
-  rm -r $NAME-$VERSION/$file
+  if [ -e "$file" ]; then
+    echo "Omitting $file from distribution"
+    rm -r $NAME-$VERSION/$file
+  fi
 done
 tar cfz $NAME-$VERSION.tar.gz $NAME-$VERSION
 rm -r $NAME-$VERSION