From c617d2434c194557650cb26f32be13049dd52840 Mon Sep 17 00:00:00 2001 From: Jocelyn Le Sage Date: Mon, 16 Sep 2024 12:26:42 -0400 Subject: [PATCH] Added a way to easy fixing JD installation. --- Dockerfile | 2 ++ README.md | 20 ++++++++++++ appdefs.yml | 18 +++++++++++ rootfs/etc/cont-init.d/55-jdownloader2.sh | 38 ++++++++++++++++++++--- 4 files changed, 74 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 37c1451..d173f51 100644 --- a/Dockerfile +++ b/Dockerfile @@ -44,6 +44,8 @@ RUN \ jq \ # We need a font. ttf-dejavu \ + # For fixing JD installation. + curl \ # For ffmpeg and ffprobe tools. ffmpeg \ # For rtmpdump tool. diff --git a/README.md b/README.md index 9706387..bbbfb51 100644 --- a/README.md +++ b/README.md @@ -52,6 +52,8 @@ your valuable time every day! * [MyJDownloader](#myjdownloader) * [Direct Connection](#direct-connection) * [Click'n'Load](#clicknload) + * [Troubleshooting](#troubleshooting) + * [JDownloader Fails to Start](#jdownloader-fails-to-start) * [Support or Contact](#support-or-contact) ## Quick Start @@ -644,6 +646,24 @@ JDownloader via the *MyJDownloader* service. [Click'n'Load]: http://jdownloader.org/knowledge/wiki/glossary/cnl2 [MyJDownloader browser extension]: https://my.jdownloader.org/apps/ +## Troubleshooting + +### JDownloader Fails to Start + +If JDownloader displays an error indicating that it is unable to start, +following these instruction might help fixing the problem. + +1. Create the file `.fix_jd_install`, under the directory that has been mapped + to `/config`. The content of the file is not important. However, if the + latest JDownloader installer is required, setting the content to `download` + causes the installer to be downloaded. +2. Restart the container. + +The presence of the file causes the container to attempt fixing the installation +during its startup. The repair process follows the instructions provided at: + +https://support.jdownloader.org/en/knowledgebase/article/fix-jdownloader-installation + ## Support or Contact Having troubles with the container or have questions? Please diff --git a/appdefs.yml b/appdefs.yml index 8d6ba85..809c310 100644 --- a/appdefs.yml +++ b/appdefs.yml @@ -68,6 +68,24 @@ app: [Click'n'Load]: http://jdownloader.org/knowledge/wiki/glossary/cnl2 [MyJDownloader browser extension]: https://my.jdownloader.org/apps/ + - title: Troubleshooting + level: 2 + - title: JDownloader Fails to Start + level: 3 + content: |- + If JDownloader displays an error indicating that it is unable to start, + following these instruction might help fixing the problem. + + 1. Create the file `.fix_jd_install`, under the directory that has been mapped + to `/config`. The content of the file is not important. However, if the + latest JDownloader installer is required, setting the content to `download` + causes the installer to be downloaded. + 2. Restart the container. + + The presence of the file causes the container to attempt fixing the installation + during its startup. The repair process follows the instructions provided at: + + https://support.jdownloader.org/en/knowledgebase/article/fix-jdownloader-installation changelog: - version: 24.08.1 date: 2024-08-02 diff --git a/rootfs/etc/cont-init.d/55-jdownloader2.sh b/rootfs/etc/cont-init.d/55-jdownloader2.sh index 2de9e1f..efb0516 100755 --- a/rootfs/etc/cont-init.d/55-jdownloader2.sh +++ b/rootfs/etc/cont-init.d/55-jdownloader2.sh @@ -6,12 +6,42 @@ set -u # Treat unset variables as an error. # Make sure mandatory directories exist. mkdir -p /config/logs -# Set default configuration on new install. -if [ ! -f /config/JDownloader.jar ]; then - cp /defaults/JDownloader.jar /config/ - cp -r /defaults/cfg /config/ +# Fix installation if requested. +# https://support.jdownloader.org/en/knowledgebase/article/fix-jdownloader-installation +if [ -f /config/.fix_jd_install ]; then + TO_REMOVE=" + Core.Jar + JDownloader.jar + tmp + update + " + + echo "fixing JDownloader installation..." + echo "$TO_REMOVE" | while read -r FILE; do + [ -n "$FILE" ] || continue + echo "removing /config/$FILE..." + rm -rf /config/"$FILE" + done + + if [ "$(cat /config/.fix_jd_install)" = "download" ]; then + JDOWNLOADER_URL=http://installer.jdownloader.org/JDownloader.jar + echo "downloading JDownloader installer..." + if curl -s -L --show-error --fail --max-time 120 -o /tmp/JDownloader.jar.download "$JDOWNLOADER_URL" + then + mv /tmp/JDownloader.jar.download /config/JDownloader.jar + else + echo "failed to download JDownloader installer." + fi + fi + + echo "installation fix done." + rm /config/.fix_jd_install fi +# Set default configuration on new install. +[ -f /config/JDownloader.jar ] || cp -v /defaults/JDownloader.jar /config/JDownloader.jar +[ -d /config/cfg ] || cp -rv /defaults/cfg /config/cfg + # Set MyJDownloader credentials. if [ -n "${MYJDOWNLOADER_EMAIL:-}" ] && [ -n "${MYJDOWNLOADER_PASSWORD:-}" ] then