From b24a00488431c7a962d5ca395b77d491b360e7fd Mon Sep 17 00:00:00 2001 From: John-Gee Date: Mon, 23 Jan 2023 04:31:08 -0800 Subject: [PATCH] Named per jkhsjdhjs from nzbhydra2-compiled, broken --- .SRCINFO | 29 +++++++++++ PKGBUILD | 53 +++++++++++++++++++++ nzbhydra2.service | 15 ++++++ nzbhydra2.sh | 3 ++ nzbhydra2.sysusers | 1 + nzbhydra2.tmpfiles | 4 ++ wrapper-remove-base-path-checks.patch | 30 ++++++++++++ wrapper-remove-release-type-detection.patch | 24 ++++++++++ wrapper-remove-update-support.patch | 23 +++++++++ 9 files changed, 182 insertions(+) create mode 100644 .SRCINFO create mode 100644 PKGBUILD create mode 100644 nzbhydra2.service create mode 100644 nzbhydra2.sh create mode 100644 nzbhydra2.sysusers create mode 100644 nzbhydra2.tmpfiles create mode 100644 wrapper-remove-base-path-checks.patch create mode 100644 wrapper-remove-release-type-detection.patch create mode 100644 wrapper-remove-update-support.patch diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..c3452fc275bf --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,29 @@ +pkgbase = nzbhydra2-nojava-bin + pkgdesc = Search aggregator for newznab and torznab indexers. + pkgver = 5.0.6 + pkgrel = 1 + url = https://github.com/theotherp/nzbhydra2 + arch = any + license = Apache + depends = python + optdepends = jackett: torrent indexer proxy + provides = nzbhydra2 + conflicts = nzbhydra2 + source = https://github.com/theotherp/nzbhydra2/releases/download/v5.0.6/nzbhydra2-5.0.6-linux.zip + source = nzbhydra2.service + source = nzbhydra2.tmpfiles + source = nzbhydra2.sysusers + source = nzbhydra2.sh + source = wrapper-remove-base-path-checks.patch + source = wrapper-remove-update-support.patch + source = wrapper-remove-release-type-detection.patch + sha256sums = 23251a8c72cbebd152b78931fed3d7edd2ebbec6e4a9817ed4875757c600b28a + sha256sums = dc66acae9ec02f3e8a16653b1b8e1d35be6bfded46b1649a4db53541fbdd739f + sha256sums = a9ceeed2b50d55c5e554c0d4c615e855fe4d3889eb118e37908fa04ffb7cb003 + sha256sums = 8f91eb4f98f7f5c11590b29b1394dfa7ca62ad115feeac4f402c9ac094fb925a + sha256sums = 8127f92afb0f70b6f79c11db0219f8b2557cb7bcafa16fd6ddb2d61166d216fe + sha256sums = 5660f26303826a0b8bf3f7c198c39e345e87b799e2304a79db5a77992d09cda4 + sha256sums = 35100f4e7ab5a480f5554d9abd32e8abac20d56f873f82ecbc906d0b3fdadc73 + sha256sums = defb77e7b19c6abfc8380cd175bc04062a0c52d1042b8e02173133367152c8e2 + +pkgname = nzbhydra2-nojava-bin diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..670f8066c5ed --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,53 @@ +# Maintainer: Gee + +# From nzbhydra2-bin: +# Maintainer: Donald Webster +# Maintainer: Daniel Egeberg +# Co-Maintainer: Leon Möller + +pkgname="nzbhydra2-nojava-bin" +pkgver=5.0.6 +pkgrel=1 +pkgdesc="Search aggregator for newznab and torznab indexers." +arch=('any') +url="https://github.com/theotherp/nzbhydra2" +license=('Apache') +provides=('nzbhydra2') +conflicts=('nzbhydra2') +depends=('python') +optdepends=('jackett: torrent indexer proxy') +source=("https://github.com/theotherp/nzbhydra2/releases/download/v${pkgver}/${pkgname%-nojava-bin}-${pkgver}-linux.zip" + 'nzbhydra2.service' + 'nzbhydra2.tmpfiles' + 'nzbhydra2.sysusers' + 'nzbhydra2.sh' + 'wrapper-remove-base-path-checks.patch' + 'wrapper-remove-update-support.patch' + 'wrapper-remove-release-type-detection.patch') + +sha256sums=('23251a8c72cbebd152b78931fed3d7edd2ebbec6e4a9817ed4875757c600b28a' + 'dc66acae9ec02f3e8a16653b1b8e1d35be6bfded46b1649a4db53541fbdd739f' + 'a9ceeed2b50d55c5e554c0d4c615e855fe4d3889eb118e37908fa04ffb7cb003' + '8f91eb4f98f7f5c11590b29b1394dfa7ca62ad115feeac4f402c9ac094fb925a' + '8127f92afb0f70b6f79c11db0219f8b2557cb7bcafa16fd6ddb2d61166d216fe' + '5660f26303826a0b8bf3f7c198c39e345e87b799e2304a79db5a77992d09cda4' + '35100f4e7ab5a480f5554d9abd32e8abac20d56f873f82ecbc906d0b3fdadc73' + 'defb77e7b19c6abfc8380cd175bc04062a0c52d1042b8e02173133367152c8e2') + +prepare() { + patch "${srcdir}/nzbhydra2wrapperPy3.py" < "${srcdir}/wrapper-remove-base-path-checks.patch" + patch "${srcdir}/nzbhydra2wrapperPy3.py" < "${srcdir}/wrapper-remove-update-support.patch" + patch "${srcdir}/nzbhydra2wrapperPy3.py" < "${srcdir}/wrapper-remove-release-type-detection.patch" +} + +package() { + install -D -m 755 "${srcdir}/nzbhydra2.sh" "${pkgdir}/usr/bin/nzbhydra2.sh" + install -D -m 755 "${srcdir}/nzbhydra2wrapperPy3.py" "${pkgdir}/usr/lib/nzbhydra2/nzbhydra2wrapperPy3.py" + install -D -m 755 "${srcdir}/nzbhydra2" "${pkgdir}/usr/bin/nzbhydra2" + install -D -m 755 "${srcdir}/core" "${pkgdir}/usr/bin/core" + install -D -m 644 "${srcdir}/readme.md" "${pkgdir}/usr/share/doc/nzbhydra2/readme.md" + + install -D -m 644 "${srcdir}/nzbhydra2.service" "${pkgdir}/usr/lib/systemd/system/nzbhydra2.service" + install -D -m 644 "${srcdir}/nzbhydra2.sysusers" "${pkgdir}/usr/lib/sysusers.d/nzbhydra2.conf" + install -D -m 644 "${srcdir}/nzbhydra2.tmpfiles" "${pkgdir}/usr/lib/tmpfiles.d/nzbhydra2.conf" +} diff --git a/nzbhydra2.service b/nzbhydra2.service new file mode 100644 index 000000000000..de5d5b0aacf7 --- /dev/null +++ b/nzbhydra2.service @@ -0,0 +1,15 @@ +[Unit] +Description=NZBHydra2 Daemon +Documentation=https://github.com/theotherp/nzbhydra2 +After=network.target + +[Service] +User=nzbhydra2 +Group=nzbhydra2 +Type=simple +WorkingDirectory=/usr/bin +ExecStart=/usr/bin/nzbhydra2 --nobrowser --datafolder /var/lib/nzbhydra2 +Restart=always + +[Install] +WantedBy=multi-user.target diff --git a/nzbhydra2.sh b/nzbhydra2.sh new file mode 100644 index 000000000000..bd46d04137f7 --- /dev/null +++ b/nzbhydra2.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env sh +export NZBHYDRA_DISABLE_UPDATE=true +exec /usr/lib/nzbhydra2/nzbhydra2wrapperPy3.py "$@" diff --git a/nzbhydra2.sysusers b/nzbhydra2.sysusers new file mode 100644 index 000000000000..d074fe067c4f --- /dev/null +++ b/nzbhydra2.sysusers @@ -0,0 +1 @@ +u nzbhydra2 - "nzbhydra2" /var/lib/nzbhydra2 diff --git a/nzbhydra2.tmpfiles b/nzbhydra2.tmpfiles new file mode 100644 index 000000000000..51864bfae4ec --- /dev/null +++ b/nzbhydra2.tmpfiles @@ -0,0 +1,4 @@ +# Override this file with a modified version in /etc/tmpfiles.d/ +d /var/lib/nzbhydra2 0750 nzbhydra2 nzbhydra2 +Z /var/lib/nzbhydra2 - nzbhydra2 nzbhydra2 +L /var/log/nzbhydra2 - - - - /var/lib/nzbhydra2/logs/ diff --git a/wrapper-remove-base-path-checks.patch b/wrapper-remove-base-path-checks.patch new file mode 100644 index 000000000000..6edf526dd8e0 --- /dev/null +++ b/wrapper-remove-base-path-checks.patch @@ -0,0 +1,30 @@ +diff --git a/other/wrapper/nzbhydra2wrapperPy3.py b/other/wrapper/nzbhydra2wrapperPy3.py +index e64c80d4..a9d8843c 100644 +--- a/other/wrapper/nzbhydra2wrapperPy3.py ++++ b/other/wrapper/nzbhydra2wrapperPy3.py +@@ -304,11 +304,6 @@ def startup(): + global jarFile, process, args, unknownArgs, consoleLines + basePath = getBasePath() + +- readme = os.path.join(basePath, "readme.md") +- if not os.path.exists(readme): +- logger.critical("Unable to determine base path correctly. Please make sure to run NZBHydra in the folder where its binary is located. Current base path: " + basePath) +- sys.exit(-1) +- + releaseType = determineReleaseType() + isWindows = platform.system().lower() == "windows" + isWithTrayIcon = os.path.exists("isWindowsTrayMarkerFile") +@@ -332,12 +327,8 @@ def startup(): + console_logger.setLevel("DEBUG") + logger.info("Setting wrapper log level to DEBUG") + +- libFolder = os.path.join(basePath, "lib") ++ libFolder = basePath + if releaseType == ReleaseType.GENERIC: +- if not os.path.exists(libFolder): +- logger.critical("Error: Lib folder %s not found. An update might've failed or the installation folder is corrupt", libFolder) +- sys.exit(-1) +- + jarFiles = [os.path.join(libFolder, f) for f in os.listdir(libFolder) if os.path.isfile(os.path.join(libFolder, f)) and f.endswith(".jar")] + if len(jarFiles) == 0: + logger.critical("Error: No JAR files found in folder %s. An update might've failed or the installation folder is corrupt", libFolder) diff --git a/wrapper-remove-release-type-detection.patch b/wrapper-remove-release-type-detection.patch new file mode 100644 index 000000000000..ef07e3de34bb --- /dev/null +++ b/wrapper-remove-release-type-detection.patch @@ -0,0 +1,24 @@ +diff --git a/other/wrapper/nzbhydra2wrapperPy3.py b/other/wrapper/nzbhydra2wrapperPy3.py +index e64c80d4..bd9e57ba 100644 +--- a/other/wrapper/nzbhydra2wrapperPy3.py ++++ b/other/wrapper/nzbhydra2wrapperPy3.py +@@ -491,18 +491,7 @@ def startup(): + + + def determineReleaseType(): +- if os.path.exists("lib"): +- releaseType = ReleaseType.GENERIC +- if os.path.exists("core") or os.path.exists("core.exe"): +- logger.warning("lib folder and core(.exe) found. Either delete the executable to use the generic release type (using java and ignoring the executable) or delete the lib folder to use the executable and not require java") +- elif os.path.exists("core") or os.path.exists("core.exe"): +- releaseType = ReleaseType.NATIVE +- else: +- logger.critical( +- "Unable to determine the release type. Neither lib folder nor core(.exe) found") +- sys.exit(-1) +- logger.info("Determined release type: " + releaseType) +- return releaseType ++ return ReleaseType.GENERIC + + + def escape_parameter(is_windows, parameter): diff --git a/wrapper-remove-update-support.patch b/wrapper-remove-update-support.patch new file mode 100644 index 000000000000..a4f655d4088a --- /dev/null +++ b/wrapper-remove-update-support.patch @@ -0,0 +1,23 @@ +diff --git a/other/wrapper/nzbhydra2wrapperPy3.py b/other/wrapper/nzbhydra2wrapperPy3.py +index e64c80d4..50678569 100644 +--- a/other/wrapper/nzbhydra2wrapperPy3.py ++++ b/other/wrapper/nzbhydra2wrapperPy3.py +@@ -640,8 +640,7 @@ def main(arguments): + global internalApiKey + internalApiKey = args.internalApiKey + if args.update: +- logger.info("Executing update") +- update() ++ logger.error("Updating is not supported.") + sys.exit(0) + if "--version" in unknownArgs or "--help" in unknownArgs: + # no fancy shit, just start the file +@@ -693,7 +692,7 @@ def main(arguments): + + if controlCode == 11: + logger.info("NZBHydra main process has terminated for updating") +- update() ++ logger.warning("Updating is not supported. Restarting...") + doStart = True + elif controlCode == 22: + logger.info("NZBHydra main process has terminated for restart")