/
build.sh
executable file
·66 lines (51 loc) · 1.8 KB
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/sh
if [ $# -lt 1 ]; then
echo "$0 <mapping file>"
exit 1
fi
scriptDirectory="${BASH_SOURCE%/*}"
echo $scriptDirectory
exit 0
if [[ ! -d "$scriptDirectory" ]]; then scriptDirectory="$PWD"; fi
mappingFile="$1"
if [ ! -f "$mappingFile" ]; then
echo "Mapping file $mappingFile does not exist!"
exit 1
fi
if [ "$mappingFile" != "${mappingFile%.osm.pbf}" ]; then
mappingFileBase="${mappingFile%.osm.pbf}"
elif [ "$mappingFile" != "${mappingFile%.osm}" ]; then
mappingFileBase="${mappingFile%.osm}"
else
echo "$mapping file is neither an *.osm nor an *.osm.pbf file"
exit 1
fi
targetDirectory="$mappingFileBase"
outputFile="${mappingFileBase}.txt"
echo -n >$outputFile
echo "Mapping File:" | tee $outputFile
echo " $mappingFile" | tee -a $outputFile
mappingFileOpt="$scriptDirectory/${mappingFileBase}.opt"
defaultOpt="$scriptDirectory/default.opt"
if [ -f "$mappingFileOpt" ]; then
echo "Options file:" | tee -a $outputFile
echo " $mappingFileOpt" | tee -a $outputFile
. "$mappingFileOpt"
elif [ -f "$defaultOpt" ]; then
echo "Options file:" | tee -a $outputFile
echo " $defaultOpt" | tee -a $outputFile
. "$defaultOpt"
fi
if [ ! -d "$targetDirectory" ]; then
echo "Creating target directory $targetDirectory..."
mkdir "$targetDirectory"
fi
echo "Target directory:" | tee -a $outputFile
echo " $targetDirectory" | tee -a $outputFile
echo "Outputfile:" | tee -a $outputFile
echo " $outputFile" | tee -a $outputFile
echo "Options:" | tee -a $outputFile
echo " $options" | tee -a $outputFile
echo "Call:" | tee -a $outputFile
echo " ../Import/src/Import $options --typefile ../stylesheets/map.ost --destinationDirectory $targetDirectory $@" | tee -a $outputFile
../Import/src/Import $options --typefile ../stylesheets/map.ost --destinationDirectory "$targetDirectory" "$@" 2>&1 | tee -a $outputFile