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