Reworked return codes
Signed-off-by: merspieler <merspieler@airmail.cc>
This commit is contained in:
parent
43225744d9
commit
7e4ae2fc0a
6 changed files with 18 additions and 10 deletions
|
@ -24,5 +24,12 @@ Programs that were not covered by `Getting started`:
|
||||||
It will make sure, that everything is in the correct format and in the correct datatype.
|
It will make sure, that everything is in the correct format and in the correct datatype.
|
||||||
* `./delete-db <database>`: Deletes the database.
|
* `./delete-db <database>`: Deletes the database.
|
||||||
|
|
||||||
|
## Return codes
|
||||||
|
* 0: Success
|
||||||
|
* 1: Argument error
|
||||||
|
* 2: IO error. An error with a file or database
|
||||||
|
* 3: Child process failed/can not be called
|
||||||
|
* 130: Aborted by user.
|
||||||
|
|
||||||
## User scripts
|
## User scripts
|
||||||
User scripts in the `scripts/` directory are help scripts contributed by users. They Do not belong to the easy-osm2city concept but extend it. Use only if you know what you do.
|
User scripts in the `scripts/` directory are help scripts contributed by users. They Do not belong to the easy-osm2city concept but extend it. Use only if you know what you do.
|
||||||
|
|
4
build
4
build
|
@ -151,7 +151,7 @@ def run_command(command):
|
||||||
return
|
return
|
||||||
elif exit_code == 130:
|
elif exit_code == 130:
|
||||||
print("Interrupted by user. Aborting...")
|
print("Interrupted by user. Aborting...")
|
||||||
sys.exit(0)
|
sys.exit(130)
|
||||||
|
|
||||||
start_time = time.time()
|
start_time = time.time()
|
||||||
|
|
||||||
|
@ -180,7 +180,7 @@ try:
|
||||||
project_bounds = get_bounds("projects/" + project + "/settings")
|
project_bounds = get_bounds("projects/" + project + "/settings")
|
||||||
if project_bounds == []:
|
if project_bounds == []:
|
||||||
print("Unable to read project settings")
|
print("Unable to read project settings")
|
||||||
sys.exit(1)
|
sys.exit(2)
|
||||||
start_bounds = start_bounds[0]
|
start_bounds = start_bounds[0]
|
||||||
project_bounds = project_bounds[0]
|
project_bounds = project_bounds[0]
|
||||||
if start_bounds["north"] == project_bounds["north"] and start_bounds["east"] == project_bounds["east"]:
|
if start_bounds["north"] == project_bounds["north"] and start_bounds["east"] == project_bounds["east"]:
|
||||||
|
|
|
@ -56,12 +56,12 @@ fi
|
||||||
source general-settings > /dev/null
|
source general-settings > /dev/null
|
||||||
if [ $? == 1 ]; then
|
if [ $? == 1 ]; then
|
||||||
echo "Couldn't find the general settings. Please run ./install first."
|
echo "Couldn't find the general settings. Please run ./install first."
|
||||||
exit 1
|
exit 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -f ".databases" ]; then
|
if [ ! -f ".databases" ]; then
|
||||||
echo "There are no databases created by easy-osm2city. Please create one by running ./create-db"
|
echo "There are no databases created by easy-osm2city. Please create one by running ./create-db"
|
||||||
exit 1
|
exit 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Which database do you want to use?"
|
echo "Which database do you want to use?"
|
||||||
|
@ -70,7 +70,7 @@ cat .databases | grep -e "$db_name" > /dev/null
|
||||||
if [ $? == 1 ]; then
|
if [ $? == 1 ]; then
|
||||||
echo "Database doesn't exsist. Please choose a different database or create one by running"
|
echo "Database doesn't exsist. Please choose a different database or create one by running"
|
||||||
echo "./create-db -d $db_name"
|
echo "./create-db -d $db_name"
|
||||||
exit 1
|
exit 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mkdir -p "projects/$project/scenery"
|
mkdir -p "projects/$project/scenery"
|
||||||
|
|
|
@ -54,4 +54,5 @@ if [ $? == 1 ]; then
|
||||||
echo "shapely"
|
echo "shapely"
|
||||||
echo "psycopg2-binary"
|
echo "psycopg2-binary"
|
||||||
echo "NOTE: use 'source venv/bin/activate' before you install the packages"
|
echo "NOTE: use 'source venv/bin/activate' before you install the packages"
|
||||||
|
exit 3
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -68,7 +68,7 @@ if project == "":
|
||||||
|
|
||||||
if os.path.isfile("projects/" + project + "/params.ini") == False:
|
if os.path.isfile("projects/" + project + "/params.ini") == False:
|
||||||
print("Project '" + project + "' not found")
|
print("Project '" + project + "' not found")
|
||||||
sys.exit(1)
|
sys.exit(2)
|
||||||
|
|
||||||
console_height, console_width = os.popen('stty size', 'r').read().split()
|
console_height, console_width = os.popen('stty size', 'r').read().split()
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@ try:
|
||||||
option["value"] = int(value)
|
option["value"] = int(value)
|
||||||
except:
|
except:
|
||||||
print("A problem occured while reading the params.ini file...")
|
print("A problem occured while reading the params.ini file...")
|
||||||
sys.exit(1)
|
sys.exit(2)
|
||||||
finally:
|
finally:
|
||||||
ini_file.close()
|
ini_file.close()
|
||||||
|
|
||||||
|
|
6
install
6
install
|
@ -72,7 +72,7 @@ if [ "$skip_install" != 1 ]; then
|
||||||
echo "git"
|
echo "git"
|
||||||
echo "Then rerun this script with skip-install argument"
|
echo "Then rerun this script with skip-install argument"
|
||||||
echo "./install --skip-install"
|
echo "./install --skip-install"
|
||||||
exit 1
|
exit 3
|
||||||
fi
|
fi
|
||||||
sudo apt-get install -y git osmosis postgis pgadmin3 postgresql-contrib postgresql-client postgresql-postgis postgresql python-pip python3-venv
|
sudo apt-get install -y git osmosis postgis pgadmin3 postgresql-contrib postgresql-client postgresql-postgis postgresql python-pip python3-venv
|
||||||
if [ $? == 100 ]; then
|
if [ $? == 100 ]; then
|
||||||
|
@ -91,7 +91,7 @@ if [ "$skip_install" != 1 ]; then
|
||||||
echo "git"
|
echo "git"
|
||||||
echo "Then rerun this script with skip-install argument"
|
echo "Then rerun this script with skip-install argument"
|
||||||
echo "./install --skip-install"
|
echo "./install --skip-install"
|
||||||
exit 1
|
exit 3
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ if [ "$skip_git" != 1 ]; then
|
||||||
echo "https://gitlab.com/fg-radi/osm2city"
|
echo "https://gitlab.com/fg-radi/osm2city"
|
||||||
echo "https://gitlab.com/fg-radi/osm2city-data"
|
echo "https://gitlab.com/fg-radi/osm2city-data"
|
||||||
echo "Unzip them in this directory and make sure, the are named osm2city and osm2city-data"
|
echo "Unzip them in this directory and make sure, the are named osm2city and osm2city-data"
|
||||||
exit 1
|
exit 3
|
||||||
fi
|
fi
|
||||||
git clone https://gitlab.com/fg-radi/osm2city.git
|
git clone https://gitlab.com/fg-radi/osm2city.git
|
||||||
git clone https://gitlab.com/fg-radi/osm2city-data.git
|
git clone https://gitlab.com/fg-radi/osm2city-data.git
|
||||||
|
|
Loading…
Reference in a new issue