mirror of
https://github.com/luzifer-docker/matomo.git
synced 2024-10-18 08:04:22 +00:00
Split script, update GeoIP database
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
106d80d889
commit
604ad209f5
2 changed files with 14 additions and 7 deletions
|
@ -1,10 +1,11 @@
|
||||||
#!/usr/bin/with-contenv /bin/bash
|
#!/usr/bin/with-contenv /bin/bash
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
|
echo "Checking for Matomo update..."
|
||||||
if [[ -f core/Version.php ]]; then
|
if [[ -f core/Version.php ]]; then
|
||||||
installed_version=$(grep VERSION core/Version.php | sed -E "s/.*'(.*)'.*/\\1/")
|
installed_version=$(grep VERSION core/Version.php | sed -E "s/.*'(.*)'.*/\\1/")
|
||||||
if [ -n "${installed_version}" ] && [[ ${installed_version} == ${MATOMO_VERSION} ]]; then
|
if [ -n "${installed_version}" ] && [[ ${installed_version} == ${MATOMO_VERSION} ]]; then
|
||||||
echo "Matomo installation is up-to-date." >&2
|
echo "- Matomo installation is up-to-date." >&2
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -13,10 +14,4 @@ echo "No Matomo installation found or not up-to-date" >&2
|
||||||
echo "Installing bundled Matomo version" >&2
|
echo "Installing bundled Matomo version" >&2
|
||||||
|
|
||||||
tar -xvz -C /var/www --strip-components=1 -f /opt/matomo.tgz
|
tar -xvz -C /var/www --strip-components=1 -f /opt/matomo.tgz
|
||||||
|
|
||||||
if [[ -f misc/GeoLite2-City.mmdb ]]; then
|
|
||||||
curl -sSfL "https://geolite.maxmind.com/download/geoip/database/GeoLite2-City.tar.gz" |
|
|
||||||
tar -xz -C misc --strip-components=1 --wildcards '*/GeoLite2-City.mmdb'
|
|
||||||
fi
|
|
||||||
|
|
||||||
chown -R nobody:nogroup /var/www
|
chown -R nobody:nogroup /var/www
|
||||||
|
|
12
rootfs/etc/cont-init.d/geoip.sh
Executable file
12
rootfs/etc/cont-init.d/geoip.sh
Executable file
|
@ -0,0 +1,12 @@
|
||||||
|
#!/usr/bin/with-contenv /bin/bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
geoip_timeout=604800
|
||||||
|
|
||||||
|
echo "Checking GeoIP database..."
|
||||||
|
if [[ ! -f misc/GeoLite2-City.mmdb ]] || [[ $(($(date +%s) - $(stat -c %Z misc/GeoLite2-City.mmdb))) -gt ${geoip_timeout} ]]; then
|
||||||
|
curl -sSfL "https://geolite.maxmind.com/download/geoip/database/GeoLite2-City.tar.gz" |
|
||||||
|
tar -xz -C misc --strip-components=1 --wildcards '*/GeoLite2-City.mmdb'
|
||||||
|
fi
|
||||||
|
|
||||||
|
chown nobody:nogroup /var/www/misc/GeoLite2-City.mmdb
|
Loading…
Reference in a new issue