From 0e02f315c88873b65d059b519fe3c4d4024dfa4f Mon Sep 17 00:00:00 2001 From: marco Date: Tue, 9 Jul 2024 15:37:24 +0200 Subject: [PATCH] docker: symlink all data files to the staging area --- docker/docker_start.sh | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/docker/docker_start.sh b/docker/docker_start.sh index a3e9226bced..c7104898486 100755 --- a/docker/docker_start.sh +++ b/docker/docker_start.sh @@ -213,15 +213,10 @@ if [ -n "$CERT_FILE" ] || [ -n "$KEY_FILE" ] ; then export LAPI_KEY_FILE=${LAPI_KEY_FILE:-$KEY_FILE} fi -# Check and prestage databases -for geodb in GeoLite2-ASN.mmdb GeoLite2-City.mmdb; do - # We keep the pre-populated geoip databases in /staging instead of /var, - # because if the data directory is bind-mounted from the host, it will be - # empty and the files will be out of reach, requiring a runtime download. - # We link to them to save about 80Mb compared to cp/mv. - if [ ! -e "/var/lib/crowdsec/data/$geodb" ] && [ -e "/staging/var/lib/crowdsec/data/$geodb" ]; then - mkdir -p /var/lib/crowdsec/data - ln -s "/staging/var/lib/crowdsec/data/$geodb" /var/lib/crowdsec/data/ +for target in "/stating/var/lib/crowdsec/data"/*; do + fname="$(basename "$target")" + if [ ! -e "/var/lib/crowdsec/data/$fname" ]; then + ln -s "$target" "/var/lib/crowdsec/data/$fname" fi done