Skip to content

Commit

Permalink
Update shellscript
Browse files Browse the repository at this point in the history
  • Loading branch information
JonasVHG committed Oct 4, 2024
1 parent 70c469c commit 4ba5d41
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions docker/config.sh
Original file line number Diff line number Diff line change
@@ -1,30 +1,35 @@
#!/bin/sh

if ! grep -q "host.docker.internal" /etc/hosts; then
echo "host.docker.internal has to be in your hosts-file, to add you need sudo privileges"
sudo sh -c 'echo "127.0.0.1 host.docker.internal" >> /etc/hosts'
UPDATE_HOSTS=${HAS_SUDO:-true}

if [ "$UPDATE_HOSTS" = "true" ] && ! grep -q "search.uitdatabank.local" /etc/hosts; then
echo "search.uitdatabank.local has to be in your hosts-file, to add you need sudo privileges"
sudo sh -c 'echo "127.0.0.1 search.uitdatabank.local" >> /etc/hosts'
fi

DIR="../appconfig/files/uitdatabank/docker/udb3-search-service/"
APPCONFIG_ROOTDIR=${APPCONFIG:-'../appconfig'}
GEOJSON_DATA_ROOTDIR=${GEOJSON_DATA:-'../geojson-data'}

DIR="${APPCONFIG_ROOTDIR}/files/uitdatabank/docker/udb3-search-service/"
if [ -d "$DIR" ]; then
cp -R "$DIR"/* .
else
echo "Error: missing appconfig. The appconfig and udb3-search-service repositories must be cloned into the same parent folder."
echo "Error: missing appconfig. The appconfig repository must be cloned at ${APPCONFIG_ROOTDIR}."
exit 1
fi

DIR="../appconfig/files/uitdatabank/docker/keys/"
DIR="${APPCONFIG_ROOTDIR}/files/uitdatabank/docker/keys/"
if [ -d "$DIR" ]; then
cp -R "$DIR"/* .
else
echo "Error: missing appconfig. The appconfig and udb3-search-service repositories must be cloned into the same parent folder."
echo "Error: missing appconfig. The appconfig repository must be cloned at ${APPCONFIG_ROOTDIR}."
exit 1
fi

DIR="../geojson-data/output"
DIR="${GEOJSON_DATA_ROOTDIR}/output"
if [ -d "$DIR" ]; then
cp "$DIR"/facet_mapping_regions.yml .
else
echo "Error: missing geojson data. See docker.md prerequisites to fix this."
echo "Error: missing geojson-data. The geojson-data repository must be cloned at ${GEOJSON_DATA_ROOTDIR}."
exit 1
fi
fi

0 comments on commit 4ba5d41

Please sign in to comment.