--- misc/osrm-scripts/start-osrm.sh 2016/12/15 19:19:31 3170 +++ misc/osrm-scripts/start-osrm.sh 2016/12/16 07:02:35 3171 @@ -7,6 +7,17 @@ # DATADIR should have 6 GB free space for denmark +################################### +# Exit bash if a command fails +set -e +# also exit if a part of a pipe fails +set -o pipefail + + + +######################### + + TAG="v5.5.0" DATADIR=/mnt/qnap/openstreetmap @@ -16,30 +27,30 @@ fi if [ ! -f /usr/local/bin/osrm-extract ] ; then - apt-get install build-essential git cmake pkg-config libprotoc-dev protobuf-compiler libprotobuf-dev libosmpbf-dev libpng12-dev libbz2-dev libstxxl-dev libstxxl-doc libstxxl1 || exit - apt-get install libxml2-dev libzip-dev libboost-all-dev lua5.1 liblua5.1-0-dev libluabind-dev libtbb-dev ||exit + apt-get install build-essential git cmake pkg-config libprotoc-dev protobuf-compiler libprotobuf-dev libosmpbf-dev libpng12-dev libbz2-dev libstxxl-dev libstxxl-doc libstxxl1 + apt-get install libxml2-dev libzip-dev libboost-all-dev lua5.1 liblua5.1-0-dev libluabind-dev libtbb-dev - cd /root || exit + cd /root if [ ! -d osrm-backend ] ; then - git clone https://github.com/Project-OSRM/osrm-backend.git || exit - cd osrm-backend || exit - git checkout tags/$TAG || exit + git clone https://github.com/Project-OSRM/osrm-backend.git + cd osrm-backend + git checkout tags/$TAG else cd osrm-backend fi if [ ! -d build ] ; then - mkdir -p build || exit + mkdir -p build fi - cd build ||exit + cd build #If building on Debian8/jessie LTO is apparently broken - cmake -DENABLE_LTO=OFF .. || exit - make -j 2 || exit - make install ||exit + cmake -DENABLE_LTO=OFF .. + make -j 2 + make install fi @@ -49,19 +60,19 @@ cd $DATADIR if [ ! -f denmark-latest.osm ] ; then - wget http://download.geofabrik.de/europe/denmark-latest.osm.bz2 || exit - bunzip2 denmark-latest.osm.bz2 ||exit + wget http://download.geofabrik.de/europe/denmark-latest.osm.bz2 + bunzip2 denmark-latest.osm.bz2 fi cd /root/osrm-backend if [ ! -f $DATADIR/denmark-latest.osrm ] ; then - osrm-extract $DATADIR/denmark-latest.osm || exit + osrm-extract $DATADIR/denmark-latest.osm fi if [ ! -f $DATADIR/denmark-latest.osrm.hsgr ] ; then - osrm-contract $DATADIR/denmark-latest.osrm || exit + osrm-contract $DATADIR/denmark-latest.osrm fi cd $DATADIR