easy-osm2city/create-project
merspieler a87c69ea4b Added create-project
Signed-off-by: merspieler <merspieler@airmail.cc>
2018-11-18 15:00:47 +01:00

73 lines
2.1 KiB
Bash
Executable file

#! /bin/bash
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
-p|--project)
project="$2"
shift # past argument
shift # past value
;;
-h|--help)
echo "usage: create-project -p <project> [OPTIONS]"
echo "Creates a new project with all necesary files."
echo ""
echo "OPTIONS"
echo " -p, --project Mandatory, project name which you want to clear of chache files."
echo " -h, --help Shows this help and exit"
exit 0
;;
*)
echo "Unknown option $key"
exit 1
;;
esac
done
if [ -z "$project" ]; then
echo "Option -p <project> is mandatory"
exit 1
fi
if [ -f "projects/$project/params.ini" ]; then
echo "The project was already created"
exit 1
fi
source general-settings > /dev/null
if [ $? == 1 ]; then
echo "Couldn't find the general settings. Please run ./install first."
exit 1
fi
mkdir -p "projects/$project/scenery"
echo "PREFIX = '$project'" > "projects/$project/params.ini"
echo "PATH_TO_SCENERY = '$fg_scenery'" >> "projects/$project/params.ini"
echo "PATH_TO_OUTPUT = '$(pwd)/projects/$project/scenery'" >> "projects/$project/params.ini"
echo "PATH_TO_OSM2CITY_DATA = '$(pwd)/osm2city-data'" >> "projects/$project/params.ini"
echo "" >> "projects/$project/params.ini"
echo "NO_ELEV = False" >> "projects/$project/params.ini"
echo "FG_ELEV = '$fg_elev'" >> "projects/$project/params.ini"
echo "" >> "projects/$project/params.ini"
echo "DB_HOST = '$db_host'" >> "projects/$project/params.ini"
echo "DB_PORT = '$db_port'" >> "projects/$project/params.ini"
echo "DB_USER = '$db_user'" >> "projects/$project/params.ini"
echo "DB_USER_PASSWORD = '$db_passwd'" >> "projects/$project/params.ini"
echo "" >> "projects/$project/params.ini"
echo "POINTS_ON_LINE_DISTANCE_MAX = 20" >> "projects/$project/params.ini"
echo "HIGHWAY_TYPE_MIN = 3" >> "projects/$project/params.ini"
echo "What is the WESTside boundary of the area?"
read west
echo "What is the SOUTHside boundary of the area?"
read south
echo "What is the EASTside boundary of the area?"
read east
echo "What is the NORTHside boundary of the area?"
read north
# TODO write settings file and check if input is correct