swag-maxmind update/add workflows

This commit is contained in:
aptalca
2023-05-18 15:07:07 -04:00
parent 684b084649
commit f5427d44f9
6 changed files with 71 additions and 87 deletions
@@ -5,24 +5,26 @@ echo "Applying the maxmind mod..."
# create GeoIP2 folder symlink
mkdir -p \
/config/geoip2db
[[ -d /var/lib/libmaxminddb ]] && [[ ! -L /var/lib/libmaxminddb ]] && \
if [[ -d /var/lib/libmaxminddb ]] && [[ ! -L /var/lib/libmaxminddb ]]; then
rm -rf /var/lib/libmaxminddb
[[ ! -d /var/lib/libmaxminddb ]] && \
fi
if [[ ! -d /var/lib/libmaxminddb ]]; then
ln -s /config/geoip2db /var/lib/libmaxminddb
fi
# check GeoIP2 database
if [ -n "$MAXMINDDB_LICENSE_KEY" ]; then
if [[ -n "$MAXMINDDB_LICENSE_KEY" ]]; then
sed -i "s|.*MAXMINDDB_LICENSE_KEY.*|MAXMINDDB_LICENSE_KEY=\"${MAXMINDDB_LICENSE_KEY}\"|g" /etc/libmaxminddb.cron.conf
if [ ! -f /var/lib/libmaxminddb/GeoLite2-City.mmdb ]; then
if [[ ! -f /var/lib/libmaxminddb/GeoLite2-City.mmdb ]]; then
echo "Downloading GeoIP2 City database."
/etc/periodic/weekly/libmaxminddb
fi
elif [ -f /var/lib/libmaxminddb/GeoLite2-City.mmdb ]; then
elif [[ -f /var/lib/libmaxminddb/GeoLite2-City.mmdb ]]; then
echo -e "Currently using the user provided GeoLite2-City.mmdb.\nIf you want to enable weekly auto-updates of the database, retrieve a free license key from MaxMind,\nand add a new env variable \"MAXMINDDB_LICENSE_KEY\", set to your license key."
else
echo -e "Starting 2019/12/30, GeoIP2 databases require personal license key to download. Please retrieve a free license key from MaxMind,\nand add a new env variable \"MAXMINDDB_LICENSE_KEY\", set to your license key."
fi
if [ ! -f /config/nginx/maxmind.conf ]; then
if [[ ! -f /config/nginx/maxmind.conf ]]; then
cp /defaults/maxmind.conf /config/nginx/maxmind.conf
fi