mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-11-22 16:06:19 -05:00
Converting pi-gen map to use wrolpi user.
This commit is contained in:
parent
f230a02d80
commit
c7e9c6f23b
6 changed files with 68 additions and 70 deletions
|
|
@ -12,14 +12,17 @@ sudo -u wrolpi /bin/bash -c 'cd /opt/wrolpi && ./main.py db upgrade'
|
|||
|
||||
# Create gis (map) database.
|
||||
sudo -u postgres psql -c '\l' | grep gis || (
|
||||
sudo -u postgres createuser _renderd
|
||||
sudo -u postgres createdb -E UTF8 -O _renderd gis
|
||||
sudo -u postgres createuser wrolpi
|
||||
sudo -u postgres createdb -E UTF8 -O wrolpi gis
|
||||
sudo -u postgres psql -d gis -c "CREATE EXTENSION postgis"
|
||||
sudo -u postgres psql -d gis -c "CREATE EXTENSION hstore"
|
||||
sudo -u postgres psql -d gis -c "ALTER TABLE geometry_columns OWNER TO _renderd"
|
||||
sudo -u postgres psql -d gis -c "ALTER TABLE spatial_ref_sys OWNER TO _renderd"
|
||||
echo "Created gis database"
|
||||
)
|
||||
# Restore initial dump.
|
||||
zcat /opt/wrolpi-blobs/gis-map.dump.gz | sudo -u _renderd pg_restore --no-owner --role=_renderd -d gis
|
||||
sudo -u postgres psql gis -c 'ALTER TABLE geography_columns OWNER TO _renderd'
|
||||
zcat /opt/wrolpi-blobs/gis-map.dump.gz | sudo -u wrolpi pg_restore --no-owner --role=wrolpi -d gis
|
||||
sudo -u postgres psql gis -c 'ALTER TABLE geography_columns OWNER TO wrolpi'
|
||||
sudo -u postgres psql -d gis -c "ALTER TABLE spatial_ref_sys OWNER TO wrolpi"
|
||||
# Restore ownership of map files.
|
||||
sudo chown -R wrolpi:wrolpi /var/lib/mod_tile /run/renderd
|
||||
# Clear map tile cache files.
|
||||
[ -d /var/lib/mod_tile/ajt ] && sudo rm -r /var/lib/mod_tile/ajt
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ fi
|
|||
HAS_ICE_SHEET=false
|
||||
psql gis wrolpi -c '\d' | grep icesheet_polygons && HAS_ICE_SHEET=true
|
||||
if [ ${HAS_ICE_SHEET} = false ]; then
|
||||
echo "Missing icesheet_polygons. Run reset_map.sh"
|
||||
echo "WROLPi: Missing icesheet_polygons. Run reset_map.sh"
|
||||
exit 4
|
||||
fi
|
||||
|
||||
|
|
@ -37,11 +37,11 @@ if [[ ${1} == *.osm.pbf ]]; then
|
|||
# Import PBF files.
|
||||
for i in "$@"; do
|
||||
if [[ $i != *.osm.pbf ]]; then
|
||||
echo "Cannot mix file types"
|
||||
echo "WROLPi: Cannot mix file types"
|
||||
exit 5
|
||||
fi
|
||||
if [ ! -f "${i}" ]; then
|
||||
echo "File does not exist! ${i}"
|
||||
echo "WROLPi: File does not exist! ${i}"
|
||||
exit 6
|
||||
fi
|
||||
done
|
||||
|
|
@ -66,12 +66,12 @@ if [[ ${1} == *.osm.pbf ]]; then
|
|||
"${pbf_path}"
|
||||
elif [[ ${1} == *.dump ]]; then
|
||||
if [ ! -f "${1}" ]; then
|
||||
echo "File does not exist! ${1}"
|
||||
echo "WROLPi: File does not exist! ${1}"
|
||||
exit 7
|
||||
fi
|
||||
# Import a Postgresql dump.
|
||||
nice -n 18 pg_restore -j3 --no-owner -d gis "${1}"
|
||||
else
|
||||
echo "Cannot import unknown map file"
|
||||
echo "WROLPi: Cannot import unknown map file"
|
||||
exit 8
|
||||
fi
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue