Skip to content

Commit

Permalink
Issue #8 - get rid of hardcoded /vagrant/... paths
Browse files Browse the repository at this point in the history
  • Loading branch information
hholzgra committed Mar 10, 2022
1 parent af6b850 commit fa208ce
Show file tree
Hide file tree
Showing 27 changed files with 41 additions and 42 deletions.
2 changes: 1 addition & 1 deletion inc/database-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# TODO how to auto-detect correct conf include dir?
let Mem_1_3=$MemTotal/3
let Mem_2_3=2*$MemTotal/3
sed -e"s/#Mem_1_3#/$Mem_1_3/g" -e"s/#Mem_2_3#/$Mem_2_3/g" </vagrant/files/config-files/postgresql-extra.conf >/etc/postgresql/12/main/conf.d/postgresql-extra.conf
sed -e"s/#Mem_1_3#/$Mem_1_3/g" -e"s/#Mem_2_3#/$Mem_2_3/g" < $FILEDIR/config-files/postgresql-extra.conf >/etc/postgresql/12/main/conf.d/postgresql-extra.conf
systemctl restart postgresql

# add "gis" database users
Expand Down
8 changes: 3 additions & 5 deletions inc/elevation-data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@

cd /home/maposmatic



# read SRTM 90m zone name -> area mapping table
echo "Importing SRTM zone database"
sudo -u maposmatic psql gis < /vagrant/files/database/db_dumps/srtm_zones.sql > /dev/null
sudo -u maposmatic psql gis < $FILEDIR/database/db_dumps/srtm_zones.sql > /dev/null

mkdir -p elevation-data
cd elevation-data
Expand Down Expand Up @@ -71,7 +69,7 @@ mkdir -p dem
cd dem

# file taken from OpenTopoMap repository, which may not be installed at this point yet
cp /vagrant/files/relief_color_text_file.txt .
cp $FILEDIR/relief_color_text_file.txt .

# fill empty spaces
for file in $(find /home/maposmatic/elevation-data/srtm-data -name "*.hgt" | sort)
Expand Down Expand Up @@ -111,7 +109,7 @@ gdaldem hillshade -z 7 -combined -compute_edges -co compress=lzw -co predictor=2

# set up countours database and table schema
echo "create contour db"
sudo -u maposmatic psql --quiet gis < /vagrant/files/database/db_dumps/contours_schema.sql
sudo -u maposmatic psql --quiet gis < $FILEDIR/database/db_dumps/contours_schema.sql

# create contours shapefile and imports its data into the database
echo "gdal_contour"
Expand Down
2 changes: 1 addition & 1 deletion inc/git-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

mkdir -p /vagrant/git-log

git config --global init.templatedir /vagrant/files/git-templates
git config --global init.templatedir $FILEDIR/git-templates

git config --global advice.detachedHead false

Expand Down
2 changes: 1 addition & 1 deletion inc/ocitysmap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ git submodule update
chmod a+x render.py

# install the command line wrapper script in $PATH
cp /vagrant/files/config-files/ocitysmap-command.sh /usr/local/bin/ocitysmap
cp $FILEDIR/config-files/ocitysmap-command.sh /usr/local/bin/ocitysmap
chmod a+x /usr/local/bin/ocitysmap

cd ..
Expand Down
2 changes: 1 addition & 1 deletion inc/overlays/allotments.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ cd /home/maposmatic/styles

git clone --quiet https://github.com/hholzgra/Mapnik-allotments.git

cp /vagrant/files/config-files/datasource-settings.xml.inc Mapnik-allotments/inc
cp $FILEDIR/config-files/datasource-settings.xml.inc Mapnik-allotments/inc

2 changes: 1 addition & 1 deletion inc/overlays/contour-lines.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ cd /home/maposmatic/styles

mkdir contour-overlay
cd contour-overlay
cp /vagrant/files/styles/contour.xml .
cp $FILEDIR/styles/contour.xml .

2 changes: 1 addition & 1 deletion inc/overlays/hillshade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
mkdir -p /home/maposmatic/styles/hillshade-overlay
cd /home/maposmatic/styles/hillshade-overlay

cp /vagrant/files/styles/hillshade.xml .
cp $FILEDIR/styles/hillshade.xml .
ln -s /home/maposmatic/elevation-data/dem .
2 changes: 1 addition & 1 deletion inc/overlays/openrailway.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ for carto_style in *.mml
do
mapnik_style=$(basename $carto_style .mml).xml
carto -a $(mapnik-config -v) --quiet $carto_style > $mapnik_style
php /vagrant/files/tools/postprocess-style.php $mapnik_style
php $FILEDIR/tools/postprocess-style.php $mapnik_style
done


2 changes: 1 addition & 1 deletion inc/overlays/waymarked-trails.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ if ! test -z "$REPLICATION_BASE_URL"
then
echo ${REPLICATION_BASE_URL} > "${OSMOSIS_DIFFIMPORT}/baseurl.txt"

cp /vagrant/files/systemd/waymarked-update.* /etc/systemd/system
cp $FILEDIR/systemd/waymarked-update.* /etc/systemd/system
chmod 644 /etc/systemd/system/waymarked-update.*
systemctl daemon-reload
systemctl enable waymarked-update.timer
Expand Down
2 changes: 1 addition & 1 deletion inc/styles/ardenne.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ sed -i -e 's/"osmpg_db"/"gis"/g' project.mml

carto -a $(mapnik-config -v) --quiet project.mml > OpenArdenneMap.xml

php /vagrant/files/tools/postprocess-style.php OpenArdenneMap.xml
php $FILEDIR/tools/postprocess-style.php OpenArdenneMap.xml

2 changes: 1 addition & 1 deletion inc/styles/belgian.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ sed -e '/\sname:/d' \
< project.mml > osm.mml

carto -q -a $(mapnik-config -v) --quiet osm.mml > osm.xml
php /vagrant/files/tools/postprocess-style.php osm.xml
php $FILEDIR/tools/postprocess-style.php osm.xml

2 changes: 1 addition & 1 deletion inc/styles/blossom.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ sed -ie 's/http.*10m-populated-places-simple.zip"/\/home\/maposmatic\/shapefiles
sed -ie 's/"srs": ""/"srs": "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over"/g' osm.mml

carto -a $(mapnik-config -v) -q osm.mml > osm.xml
php /vagrant/files/tools/postprocess-style.php osm.xml
php $FILEDIR/tools/postprocess-style.php osm.xml

2 changes: 1 addition & 1 deletion inc/styles/cyclosm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ sed -e 's/dbname: "osm"/dbname: "gis"/g' \
< project.mml > cyclosm.mml

carto -a $(mapnik-config -v) --quiet cyclosm.mml > cyclosm.xml
php /vagrant/files/tools/postprocess-style.php cyclosm.xml
php $FILEDIR/tools/postprocess-style.php cyclosm.xml

# style expects contours table under a different name, and ele column with different type
sudo -u maposmatic psql contours -c "create view planet_osm_line as select gid, id, ele::int as ele, way from contours;"
Expand Down
2 changes: 1 addition & 1 deletion inc/styles/empty.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ cd /home/maposmatic/styles

mkdir empty
cd empty
cp /vagrant/files/styles/empty.xml .
cp $FILEDIR/styles/empty.xml .

4 changes: 2 additions & 2 deletions inc/styles/german.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ git clone --quiet https://github.com/giggls/openstreetmap-carto-de.git

cd openstreetmap-carto-de

latest_tag=$(php /vagrant/files/tools/get-latest-tag.php 'v.*-de\d+')
latest_tag=$(php $FILEDIR/tools/get-latest-tag.php 'v.*-de\d+')

git checkout --quiet v4.24.0-de1

Expand All @@ -20,7 +20,7 @@ make

for a in *.xml
do
php /vagrant/files/tools/postprocess-style.php $a
php $FILEDIR/tools/postprocess-style.php $a
done

ln -s /home/maposmatic/shapefiles data
Expand Down
2 changes: 1 addition & 1 deletion inc/styles/maposmatic.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ cd /home/maposmatic/styles
# configure the actual stylesheet
cd ../ocitysmap/stylesheet/maposmatic-printable

/vagrant/files/tools/generate_xml.py \
$FILEDIR/tools/generate_xml.py \
--dbname gis \
--host 'localhost' \
--user maposmatic \
Expand Down
4 changes: 2 additions & 2 deletions inc/styles/mapquest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ cd MapQuest-Mapnik-Style
ln -s /home/maposmatic/shapefiles/world_boundaries/ .

# generate stylesheet XML
/vagrant/files/tools/generate_xml.py \
$FILEDIR/tools/generate_xml.py \
--inc mapquest_inc \
--symbols mapquest_symbols \
--dbname gis \
Expand All @@ -25,7 +25,7 @@ ln -s /home/maposmatic/shapefiles/world_boundaries/ .
--password secret \
> /dev/null

/vagrant/files/tools/generate_xml.py \
$FILEDIR/tools/generate_xml.py \
--inc hybrid_inc \
--symbols hybrid_symbols \
--dbname gis \
Expand Down
4 changes: 2 additions & 2 deletions inc/styles/oomap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ git checkout maposmatic

cd maptiler/

cp /vagrant/files/styles/oomap/* styles/inc/
cp $FILEDIR/styles/oomap/* styles/inc/

ln -s /home/maposmatic/shapefiles .

psql gis < /vagrant/inc/styles/oomap.sql
psql gis < $INCDIR/styles/oomap.sql
shp2pgsql -g way /home/maposmatic/shapefiles/water-polygons-split-3857/water_polygons.shp public.water | psql gis > /dev/null
4 changes: 2 additions & 2 deletions inc/styles/osm-carto.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ ln -s /home/maposmatic/shapefiles data

sed '/\sname:/d' < project.mml > osm.mml
carto -a $(mapnik-config -v) --quiet osm.mml > osm.xml
php /vagrant/files/tools/postprocess-style.php osm.xml
php $FILEDIR/tools/postprocess-style.php osm.xml

# create color-reduced variant of generated style

php /vagrant/files/tools/make-style-monochrome.php
php $FILEDIR/tools/make-style-monochrome.php


2 changes: 1 addition & 1 deletion inc/styles/osm-mapnik.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
cd mapnik2-osm
ln -s /home/maposmatic/shapefiles/world_boundaries .

cp /vagrant/files/styles/mapnik2-osm/* inc
cp $FILEDIR/styles/mapnik2-osm/* inc

cd ..

2 changes: 1 addition & 1 deletion inc/styles/osmbright.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ cd osm-bright

ln -s /home/maposmatic/shapefiles shp

cp /vagrant/files/config-files/osmbright-configure.py configure.py
cp $FILEDIR/config-files/osmbright-configure.py configure.py

./make.py

Expand Down
2 changes: 1 addition & 1 deletion inc/styles/pandonia.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ sed -ie 's/http.*shoreline_300.zip"/\/home\/maposmatic\/shapefiles\/shoreline_30
sed -ie 's/http.*10m-populated-places-simple.zip"/\/home\/maposmatic\/shapefiles\/ne_10m_populated_places_simple\/ne_10m_populated_places_simple.shp", "type": "shape"/' osm.mml
sed -ie 's/"srs": ""/"srs": "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over"/g' osm.mml
carto -a $(mapnik-config -v) -q osm.mml > osm.xml
php /vagrant/files/tools/postprocess-style.php osm.xml
php $FILEDIR/tools/postprocess-style.php osm.xml

2 changes: 1 addition & 1 deletion inc/styles/routexl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ sed -ie 's/http.*10m-populated-places-simple.zip"/\/home\/maposmatic\/shapefiles
sed -ie 's/"srs": ""/"srs": "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over"/g' osm.mml

carto -a $(mapnik-config -v) -q osm.mml > osm.xml
php /vagrant/files/tools/postprocess-style.php osm.xml
php $FILEDIR/tools/postprocess-style.php osm.xml

2 changes: 1 addition & 1 deletion inc/styles/swiss.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ ln -s /home/maposmatic/shapefiles data

sed '/\sname:/d' < project.mml > osm.mml
carto -a $(mapnik-config -v) --quiet osm.mml > osm.xml
php /vagrant/files/tools/postprocess-style.php osm.xml
php $FILEDIR/tools/postprocess-style.php osm.xml

2 changes: 1 addition & 1 deletion inc/styles/toner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ ln -s /home/maposmatic/shapefiles data

sed '/"name":/d' < toner.mml > osm.mml
carto -a $(mapnik-config -v) --quiet osm.mml > toner.xml
php /vagrant/files/tools/postprocess-style.php toner.xml
php $FILEDIR/tools/postprocess-style.php toner.xml

sudo -u maposmatic psql gis < sql/functions/highroad.sql

4 changes: 2 additions & 2 deletions inc/testing.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#! /bin/bash

cd /vagrant/test
cd $VAGRANT/test
chmod a+w .
rm -f test-* thumbnails/test-*
./run-tests.sh

php /vagrant/files/tools/all-styles-pdf.php > all-styles.tex
php $FILEDIR/tools/all-styles-pdf.php > all-styles.tex
pdflatex all-styles.tex > /dev/null

15 changes: 8 additions & 7 deletions provision.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@ fi
#
#----------------------------------------------------

FILEDIR=/vagrant/files
INCDIR=/vagrant/inc
VAGRANT=/vagrant
FILEDIR=$VAGRANT/files
INCDIR=$VAGRANT/inc

if touch /vagrant/can_write_here
if touch $VAGRANT/can_write_here
then
CACHEDIR=/vagrant/cache
rm /vagrant/can_write_here
CACHEDIR=$VAGRANT/cache
rm $VAGRANT/can_write_here
else
mkdir -p /home/cache
chmod a+rwx /home/cache
Expand All @@ -44,7 +45,7 @@ export $(grep MemTotal /proc/meminfo | sed -e's/kB//' -e's/ //g' -e's/:/=/')
#
#----------------------------------------------------

export OSM_EXTRACT=$(ls /vagrant/*.pbf | head -1)
export OSM_EXTRACT=$(ls $VAGRANT/*.pbf | head -1)

if test -f "$OSM_EXTRACT"
then
Expand Down Expand Up @@ -151,7 +152,7 @@ banner "shapefiles"
# install shapefiles
. $INCDIR/get-shapefiles.sh
# set up shapefile update job
cp /vagrant/files/systemd/shapefile-update.* /etc/systemd/system
cp $FILEDIR/systemd/shapefile-update.* /etc/systemd/system
systemctl daemon-reload


Expand Down

0 comments on commit fa208ce

Please sign in to comment.