From d6ef80986fbf5b4ebcb251b15ce652436c06aeb9 Mon Sep 17 00:00:00 2001 From: Piero Toffanin Date: Wed, 14 Dec 2016 09:06:04 -0500 Subject: [PATCH] Added proposed changes by @mojodna --- app/migrations/9999_postgis.py | 4 ++-- start.sh | 4 ++-- webodm.sh | 20 +++++++++++--------- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/app/migrations/9999_postgis.py b/app/migrations/9999_postgis.py index 1c714b46..b36b1272 100644 --- a/app/migrations/9999_postgis.py +++ b/app/migrations/9999_postgis.py @@ -4,6 +4,6 @@ class Migration(migrations.Migration): dependencies = [("app", "0001_initial")] operations = [ - migrations.RunSQL("SET postgis.enable_outdb_rasters TO True;"), - migrations.RunSQL("SET postgis.gdal_enabled_drivers TO 'GTiff';") + migrations.RunSQL("ALTER SYSTEM SET postgis.enable_outdb_rasters TO True;"), + migrations.RunSQL("ALTER SYSTEM SET postgis.gdal_enabled_drivers TO 'GTiff';") ] \ No newline at end of file diff --git a/start.sh b/start.sh index ed92476b..b2992ca3 100755 --- a/start.sh +++ b/start.sh @@ -18,7 +18,7 @@ almost_there(){ # Check python version python -c "import sys;ret = 1 if sys.version_info <= (3, 0) else 0;print('Checking python version... ' + ('3.x, good!' if ret == 0 else '2.x'));sys.exit(ret);" -if [ $? -eq 1 ]; then +if [ $? -ne 0 ]; then almost_there echo -e "\e[33mYour system is currently using Python 2.x. You need to install or configure your system to use Python 3.x. Check out http://docs.python-guide.org/en/latest/dev/virtualenvs/ for information on how to setup Python 3.x alongside your Python 2.x install.\e[39m" echo @@ -27,7 +27,7 @@ fi # Check GDAL version python -c "import sys;import re;import subprocess;version = subprocess.Popen([\"gdalinfo\", \"--version\"], stdout=subprocess.PIPE).communicate()[0].decode().rstrip();ret = 0 if re.compile('^GDAL [2-9]\.[1-9]+').match(version) else 1; print('Checking GDAL version... ' + ('{}, excellent!'.format(version) if ret == 0 else version));sys.exit(ret);" -if [ $? -eq 1 ]; then +if [ $? -ne 0 ]; then almost_there echo -e "\e[33mYour system is currently using a version of GDAL that is too old, or GDAL is not installed. You need to install or configure your system to use GDAL 2.1 or higher. If you have installed multiple versions of GDAL, make sure the newer one takes priority in your PATH environment variable.\e[39m" echo diff --git a/webodm.sh b/webodm.sh index e33bd0a9..97f1a61c 100755 --- a/webodm.sh +++ b/webodm.sh @@ -1,12 +1,16 @@ #!/bin/bash +set -eo pipefail platform="Linux" # Assumed -uname=`uname` -if [[ $uname == "Darwin" ]]; then - platform = "MacOS / OSX" -elif [[ $uname == MINGW* ]]; then - platform = "Windows" -fi +uname=$(uname) +case $uname in + "Darwin") + platform="MacOS / OSX" + ;; + MINGW*) + platform="Windows" + ;; +esac usage(){ echo "Usage: $0 [options]" @@ -30,9 +34,7 @@ check_command(){ echo -e "Checking for $1... $check_msg" - if [[ $not_found ]]; then - exit 1 - fi + return 1 } environment_check(){