Skip to content

Commit 64829e1

Browse files
authored
Merge pull request #471 from linuxserver/swag-maxmind-s6v3
switch to hybrid (swag-maxmind)
2 parents 485d51c + 266efd0 commit 64829e1

File tree

12 files changed

+41
-0
lines changed

12 files changed

+41
-0
lines changed

root/etc/s6-overlay/s6-rc.d/init-mod-swag-maxmind-add-package/dependencies.d/init-mods

Whitespace-only changes.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/with-contenv bash
2+
3+
if ! apk info 2>&1 | grep -q "libmaxminddb"; then
4+
echo "**** adding libmaxminddb to package install list ****"
5+
echo "libmaxminddb" >> /mod-repo-packages-to-install.list
6+
else
7+
echo "**** libmaxminddb already installed, skipping ****"
8+
fi
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
oneshot
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/etc/s6-overlay/s6-rc.d/init-mod-swag-maxmind-add-package/run

root/etc/s6-overlay/s6-rc.d/init-mod-swag-maxmind-setup/dependencies.d/init-mods-package-install

Whitespace-only changes.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/with-contenv bash
2+
3+
echo "Applying the maxmind mod..."
4+
5+
# create GeoIP2 folder symlink
6+
mkdir -p \
7+
/config/geoip2db
8+
[[ -d /var/lib/libmaxminddb ]] && [[ ! -L /var/lib/libmaxminddb ]] && \
9+
rm -rf /var/lib/libmaxminddb
10+
[[ ! -d /var/lib/libmaxminddb ]] && \
11+
ln -s /config/geoip2db /var/lib/libmaxminddb
12+
# check GeoIP2 database
13+
if [ -n "$MAXMINDDB_LICENSE_KEY" ]; then
14+
sed -i "s|.*MAXMINDDB_LICENSE_KEY.*|MAXMINDDB_LICENSE_KEY=\"${MAXMINDDB_LICENSE_KEY}\"|g" /etc/libmaxminddb.cron.conf
15+
if [ ! -f /var/lib/libmaxminddb/GeoLite2-City.mmdb ]; then
16+
echo "Downloading GeoIP2 City database."
17+
/etc/periodic/weekly/libmaxminddb
18+
fi
19+
elif [ -f /var/lib/libmaxminddb/GeoLite2-City.mmdb ]; then
20+
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."
21+
else
22+
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."
23+
fi
24+
25+
if [ ! -f /config/nginx/maxmind.conf ]; then
26+
cp /defaults/maxmind.conf /config/nginx/maxmind.conf
27+
fi
28+
29+
echo "Applied the maxmind mod"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
oneshot
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/etc/s6-overlay/s6-rc.d/init-mod-swag-maxmind-setup/run

root/etc/s6-overlay/s6-rc.d/init-mods-end/dependencies.d/init-mod-swag-maxmind-setup

Whitespace-only changes.

root/etc/s6-overlay/s6-rc.d/init-mods-package-install/dependencies.d/init-mod-swag-maxmind-add-package

Whitespace-only changes.

0 commit comments

Comments
 (0)