diff options
author | Salvador Cuñat <salvador.cunat@gmail.com> | 2017-06-11 21:58:44 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2017-06-11 14:00:02 -0700 |
commit | 49cbfdd72d0743ef27877b8826810107283e977b (patch) | |
tree | 8bf7162d4474f4cb4409e0033d5a5b50f4cefa5e /packaging/windows | |
parent | b14a522f4f308aed41ab49b5529cc10c05168716 (diff) | |
download | subsurface-49cbfdd72d0743ef27877b8826810107283e977b.tar.gz |
smtk2ssrf-mxe-build.sh: add a flag for git repo
Previous script would fail on git folders that pull from more than one
repo. That's not a general case, but pretty usual for developers
pulling/pushing to github.
BTW in this cases, a lind git pull doesn't ensure we are pulling from
the right repo.
When run without flag, default to pull --rebase.
At the same time introduce a tiny func to return a message and bail out
after some command failures.
Diffstat (limited to 'packaging/windows')
-rwxr-xr-x | packaging/windows/smtk2ssrf-mxe-build.sh | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/packaging/windows/smtk2ssrf-mxe-build.sh b/packaging/windows/smtk2ssrf-mxe-build.sh index d0a5bf53f..126dd1bd2 100755 --- a/packaging/windows/smtk2ssrf-mxe-build.sh +++ b/packaging/windows/smtk2ssrf-mxe-build.sh @@ -62,6 +62,15 @@ EXECDIR=$(pwd) BASEDIR=$(cd "$EXECDIR/.."; pwd) BUILDDIR=$(cd "$EXECDIR"; pwd) +GITREPO="" + +# Display an error message if we need to bail out +# +function aborting() { + echo -e "$RED----> $1. Aborting.$DEFAULT" + exit 1 +} + echo -e "$BLUE-> $BUILDDIR$DEFAULT" if [[ ! -d "$BASEDIR"/mxe ]] ; then @@ -87,6 +96,8 @@ else shift;; -d|--dir) DATADIR="$2" shift;; + -r|--repo) GITREPO="$2" + shift;; esac shift done @@ -134,11 +145,7 @@ if [ ! -f "$BASEDIR"/mxe/usr/i686-w64-mingw32.static/lib/libmdb.a ]; then --enable-shared \ --disable-man \ --disable-gmdb2 - make $JOBS >/dev/null - if [ $? -ne 0 ]; then - echo -e "$RED---> Building mdbtools failed. Aborting ...$DEFAULT " - exit 1 - fi + make $JOBS >/dev/null || aborting "Building mdbtools failed." make install else echo -e "$BLUE---> Prebuilt mxe mdbtools ... $DEFAULT" @@ -148,19 +155,15 @@ fi # cd "$BASEDIR/subsurface" git reset --hard master && echo -e "$BLUE---> Uncommited changes to Subsurface (if any) dropped$DEFAULT" -git pull "$(git remote -v |grep fetch |awk '{print $1}')" master -if [ $? -ne 0 ]; then - echo -e "$RED---> git pull failed, Subsurface not updated$DEFAULT" +if [ ! -z "$GITREPO" ]; then + git pull --rebase "$GITREPO" master || aborting "git pull failed, Subsurface not updated" else - echo -e "$BLUE---> Subsurface updated$DEFAULT" + git pull --rebase || aborting "git pull failed, Subsurface not updated" fi +echo -e "$BLUE---> Subsurface updated$DEFAULT" if [ "$SSRF_TAG" != "" ]; then - git checkout "$SSRF_TAG" - if [ $? -ne 0 ]; then - echo -e "$RED---> Failed to checkout Subsurface's $SSRF_TAG. Abort building. $DEFAULT" - exit 1 - fi + git checkout "$SSRF_TAG" || aborting "Failed to checkout Subsurface's $SSRF_TAG." fi # Every thing is ok. Go on. |