From 25577e882bed475d7f73a9435ad1d1e8a287bdc0 Mon Sep 17 00:00:00 2001 From: zakary Date: Sat, 14 Sep 2024 06:11:26 -0500 Subject: [PATCH] update for develop branch of deluge --- Dockerfile | 20 +++++++++-------- Dockerfile.aarch64 | 20 +++++++++-------- root/etc/s6-overlay/s6-rc.d/svc-deluged/run | 24 +++++++++++++++++++++ 3 files changed, 46 insertions(+), 18 deletions(-) diff --git a/Dockerfile b/Dockerfile index bd1a6ce..0afd381 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,23 +22,25 @@ RUN \ echo "**** install build packages ****" && \ apk add --no-cache --upgrade --virtual=build-dependencies \ build-base \ - python3-dev && \ + python3-dev \ + musl-dev \ + git \ + py3-cairo \ + py3-gobject3 \ + py3-zope-interface && \ echo "**** install packages ****" && \ apk add --no-cache --upgrade \ boost1.84-python3 \ geoip \ - python3 \ p7zip && \ - if [ -z ${DELUGE_VERSION+x} ]; then \ - DELUGE_VERSION=$(curl -sL https://pypi.python.org/pypi/deluge/json |jq -r '. | .info.version');\ - fi && \ python3 -m venv /lsiopy && \ pip install -U --no-cache-dir \ pip \ setuptools \ wheel && \ + git clone https://github.com/deluge-torrent/deluge.git /app/deluge/ && \ + python3 /app/deluge/setup.py develop && \ pip install -U --no-cache-dir --find-links https://wheel-index.linuxserver.io/alpine-3.20/ \ - deluge[all]==${DELUGE_VERSION} \ pygeoip && \ echo "**** grab GeoIP database ****" && \ curl -L --retry 10 --retry-max-time 60 --retry-all-errors \ @@ -49,12 +51,12 @@ RUN \ apk del --purge \ build-dependencies && \ rm -rf \ - $HOME/.cache \ + $HOME/.cache \ /tmp/* - COPY --from=libtorrent /libtorrent-build/usr/lib/libtorrent-rasterbar.* /usr/lib/ +COPY --from=libtorrent /libtorrent-build/usr/lib/libtorrent-rasterbar.* /usr/lib/ - COPY --from=libtorrent /libtorrent-build/usr/lib/python3.12 /lsiopy/lib/python3.12 +COPY --from=libtorrent /libtorrent-build/usr/lib/python3.12 /lsiopy/lib/python3.12 # add local files COPY root/ / diff --git a/Dockerfile.aarch64 b/Dockerfile.aarch64 index 1d84f5d..c5cfcc4 100644 --- a/Dockerfile.aarch64 +++ b/Dockerfile.aarch64 @@ -22,23 +22,25 @@ RUN \ echo "**** install build packages ****" && \ apk add --no-cache --upgrade --virtual=build-dependencies \ build-base \ - python3-dev && \ + python3-dev \ + musl-dev \ + git \ + py3-cairo \ + py3-gobject3 \ + py3-zope-interface && \ echo "**** install packages ****" && \ apk add --no-cache --upgrade \ boost1.84-python3 \ geoip \ - python3 \ p7zip && \ - if [ -z ${DELUGE_VERSION+x} ]; then \ - DELUGE_VERSION=$(curl -sL https://pypi.python.org/pypi/deluge/json |jq -r '. | .info.version');\ - fi && \ python3 -m venv /lsiopy && \ pip install -U --no-cache-dir \ pip \ setuptools \ wheel && \ + git clone https://github.com/deluge-torrent/deluge.git /app/deluge/ && \ + python3 /app/deluge/setup.py develop && \ pip install -U --no-cache-dir --find-links https://wheel-index.linuxserver.io/alpine-3.20/ \ - deluge[all]==${DELUGE_VERSION} \ pygeoip && \ echo "**** grab GeoIP database ****" && \ curl -L --retry 10 --retry-max-time 60 --retry-all-errors \ @@ -49,12 +51,12 @@ RUN \ apk del --purge \ build-dependencies && \ rm -rf \ - $HOME/.cache \ + $HOME/.cache \ /tmp/* - COPY --from=libtorrent /libtorrent-build/usr/lib/libtorrent-rasterbar.* /usr/lib/ +COPY --from=libtorrent /libtorrent-build/usr/lib/libtorrent-rasterbar.* /usr/lib/ - COPY --from=libtorrent /libtorrent-build/usr/lib/python3.12 /lsiopy/lib/python3.12 +COPY --from=libtorrent /libtorrent-build/usr/lib/python3.12 /lsiopy/lib/python3.12 # add local files COPY root/ / diff --git a/root/etc/s6-overlay/s6-rc.d/svc-deluged/run b/root/etc/s6-overlay/s6-rc.d/svc-deluged/run index 2ec50c9..9fe296f 100755 --- a/root/etc/s6-overlay/s6-rc.d/svc-deluged/run +++ b/root/etc/s6-overlay/s6-rc.d/svc-deluged/run @@ -3,6 +3,30 @@ DELUGE_LOGLEVEL=${DELUGE_LOGLEVEL:-info} +# downlad latest GeoIP.dat after aged a week +geoip_dat_path="/usr/share/GeoIP/GeoIP.dat" +echo "[info] Checking GeoIP.dat ($geoip_dat_path)..." + +if [ -e "$geoip_dat_path" ]; then + current_time=$(date +%s) + # file's modification and creation times in seconds since epoch + modification_time=$(stat -c %Y "$geoip_dat_path") + creation_time=$(stat -c %W "$geoip_dat_path") + week_seconds=$((7 * 24 * 60 * 60)) + + if (((current_time - modification_time) > week_seconds)) || (((current_time - creation_time) > week_seconds)); then + echo "[info] Found outdated GeoIP.dat...updating (timeout 30s)" + curl -s -L --retry 3 --retry-max-time 30 --retry-all-errors \ + "https://mailfud.org/geoip-legacy/GeoIP.dat.gz" | + gunzip >$geoip_dat_path + fi +else + echo "[info] No GeoIP.dat found...updating (timeout 30s)" + curl -s -L --retry 3 --retry-max-time 30 --retry-all-errors \ + "https://mailfud.org/geoip-legacy/GeoIP.dat.gz" | + gunzip >$geoip_dat_path +fi + if [[ -f /config/core.conf ]]; then DELUGED_PORT=$(grep '"daemon_port"' /config/core.conf | tr -cd "[:digit:]") fi