Browse Source

cancel update script execution if something goes wrong

Michael Panzlaff 6 years ago
parent
commit
7c2e4d0718
1 changed files with 6 additions and 0 deletions
  1. 6
    0
      update_all.sh

+ 6
- 0
update_all.sh View File

@@ -1,5 +1,7 @@
1 1
 #!/bin/sh
2 2
 
3
+set -eu
4
+
3 5
 main_repo=$(pwd)
4 6
 
5 7
 git_save() {
@@ -9,6 +11,7 @@ git_save() {
9 11
         git stash push --include-untracked
10 12
         return 0
11 13
     else
14
+        set +e
12 15
         return 1
13 16
     fi
14 17
 }
@@ -27,6 +30,7 @@ echo "*** Updating Battle Engine repository ***"
27 30
 cd $main_repo/battle_engine
28 31
 git_save
29 32
 result=$?
33
+set -e
30 34
 git checkout master
31 35
 git pull
32 36
 git_restore $result
@@ -36,6 +40,7 @@ echo "*** Updating g3headers repository ***"
36 40
 cd $main_repo/g3headers
37 41
 git_save
38 42
 result=$?
43
+set -e
39 44
 git checkout master
40 45
 git pull
41 46
 git_restore $result
@@ -45,6 +50,7 @@ echo "*** Updating private repository ***"
45 50
 cd $main_repo/sots-private
46 51
 git_save
47 52
 result=$?
53
+set -e
48 54
 git checkout master
49 55
 git pull
50 56
 git_restore $result