Browse Source

clean up /tmp on failure

Bill Gianopoulos 4 years ago
parent
commit
79af76e75a
1 changed files with 19 additions and 3 deletions
  1. 19 3
      scripts/xul2xhtml.sh

+ 19 - 3
scripts/xul2xhtml.sh

@@ -1,13 +1,24 @@
 #!/bin/bash
+ERROR=0
 GIT_REPO=https://gitlab.com/frg/seamonkey-central-patches.git
 rm -rf /tmp/comm-xul$$ /tmp/git-xul$$
 pushd /tmp
-hg clone https://hg.mozilla.org/comm-central/ /tmp/comm-xul$$ || exit 1
+hg clone https://hg.mozilla.org/comm-central/ /tmp/comm-xul$$ || ERROR=1 
+if [ $ERROR -eq 1 ]
+then
+  rm -rf /tmp/*$$
+  exit 1
+fi
 if [ '$GIT_REPO' != '' ]
 then
   mkdir /tmp/git-xul$$
   cd /tmp/git-xul$$
-  git clone $GIT_REPO || exit 1
+  git clone $GIT_REPO || ERROR=1
+  if [ $ERROR -eq 1 ]
+  then
+    rm -rf /tmp/*$$
+    exit 1
+  fi
   cd /tmp/comm-xul$$
   if [ -s /tmp/git-xul$$/seamonkey-central-patches/comm-central/patches/series ]
   then
@@ -17,7 +28,12 @@ then
       then
         break
       fi
-      hg import /tmp/git-xul$$/seamonkey-central-patches/comm-central/patches/$i || exit 1
+       hg import /tmp/git-xul$$/seamonkey-central-patches/comm-central/patches/$i || ERROR=1
+      if [ $ERROR -eq 1 ]
+      then
+        rm -rf /tmp/*$$
+        exit 1
+      fi
     done
   fi
 fi