summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorjkhsjdhjs2022-11-28 22:30:35 +0100
committerjkhsjdhjs2022-11-28 22:48:49 +0100
commit231d56197fe0567ad40ef7821908e3cfe22f0011 (patch)
tree497770fd77eb3a7e808d2d3fe02b03d3da59aa63
parentad9dec8089565f68940804216373efa986504efc (diff)
downloadaur-231d56197fe0567ad40ef7821908e3cfe22f0011.tar.gz
Install files in compliance with the Arch Linux Packaging Guidelines
Also disable the self-updating capability. Only the package manager should create files in /usr, the self-updater only created litter that isn't removed when the package is uninstalled.
-rw-r--r--.SRCINFO10
-rw-r--r--PKGBUILD21
-rw-r--r--nzbhydra2.service4
-rw-r--r--nzbhydra2.sh3
-rw-r--r--nzbhydra2.tmpfiles1
-rw-r--r--wrapper-remove-base-path-checks.patch28
-rw-r--r--wrapper-remove-update-support.patch13
7 files changed, 68 insertions, 12 deletions
diff --git a/.SRCINFO b/.SRCINFO
index c86373b45d88..385238374adb 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -13,11 +13,17 @@ pkgbase = nzbhydra2
source = nzbhydra2.service
source = nzbhydra2.tmpfiles
source = nzbhydra2.sysusers
+ source = nzbhydra2.sh
source = wrapper-Fix-dropping-every-second-line-of-stdout-807.patch
+ source = wrapper-remove-base-path-checks.patch
+ source = wrapper-remove-update-support.patch
sha256sums = 52e488c71fbadf007cbdfc041c150ab44ac9054513c5b90c9b8dc42e804fb53c
- sha256sums = 0ae34e5c7e65779dcca28a16d61f5ddd0dbf1e706143353fcb8c643b8421da70
- sha256sums = 4003b4561db3867d194a731dbe495d2d1b5e0a1de3595b5d2e5502049ed6762e
+ sha256sums = 2fae64a1c5979d9f7b508f1e15d0f013b7cca1f2bbbdae56f546f4c362146b68
+ sha256sums = a9ceeed2b50d55c5e554c0d4c615e855fe4d3889eb118e37908fa04ffb7cb003
sha256sums = 8f91eb4f98f7f5c11590b29b1394dfa7ca62ad115feeac4f402c9ac094fb925a
+ sha256sums = f7946e4928fe26e6bbfe1388eb0071b846dd28b54b801b2ade992c204a69f5e3
sha256sums = d59bb189f178170c523550a032af7bc5f4c90518b3bca8a631403d6725bd6528
+ sha256sums = fd6ba3e8b22f3f90c19d9903445b2539837dca1c12df49863b2e8d1085d88b0e
+ sha256sums = f302b8dc8ed95ce18d67305a0460b1e62a4e4586fba0f77d3dd980a77cfba3d4
pkgname = nzbhydra2
diff --git a/PKGBUILD b/PKGBUILD
index ea892e1e8e18..26356e8e7edd 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -15,23 +15,32 @@ source=("https://github.com/theotherp/nzbhydra2/releases/download/v${pkgver}/${p
'nzbhydra2.service'
'nzbhydra2.tmpfiles'
'nzbhydra2.sysusers'
- 'wrapper-Fix-dropping-every-second-line-of-stdout-807.patch')
+ 'nzbhydra2.sh'
+ 'wrapper-Fix-dropping-every-second-line-of-stdout-807.patch'
+ 'wrapper-remove-base-path-checks.patch'
+ 'wrapper-remove-update-support.patch')
sha256sums=('52e488c71fbadf007cbdfc041c150ab44ac9054513c5b90c9b8dc42e804fb53c'
- '0ae34e5c7e65779dcca28a16d61f5ddd0dbf1e706143353fcb8c643b8421da70'
- '4003b4561db3867d194a731dbe495d2d1b5e0a1de3595b5d2e5502049ed6762e'
+ '2fae64a1c5979d9f7b508f1e15d0f013b7cca1f2bbbdae56f546f4c362146b68'
+ 'a9ceeed2b50d55c5e554c0d4c615e855fe4d3889eb118e37908fa04ffb7cb003'
'8f91eb4f98f7f5c11590b29b1394dfa7ca62ad115feeac4f402c9ac094fb925a'
- 'd59bb189f178170c523550a032af7bc5f4c90518b3bca8a631403d6725bd6528')
+ 'f7946e4928fe26e6bbfe1388eb0071b846dd28b54b801b2ade992c204a69f5e3'
+ 'd59bb189f178170c523550a032af7bc5f4c90518b3bca8a631403d6725bd6528'
+ 'fd6ba3e8b22f3f90c19d9903445b2539837dca1c12df49863b2e8d1085d88b0e'
+ 'f302b8dc8ed95ce18d67305a0460b1e62a4e4586fba0f77d3dd980a77cfba3d4')
prepare() {
+ patch "${srcdir}/nzbhydra2wrapperPy3.py" < "${srcdir}/wrapper-remove-base-path-checks.patch"
+ patch "${srcdir}/nzbhydra2wrapperPy3.py" < "${srcdir}/wrapper-remove-update-support.patch"
# TODO: remove on next release
patch "${srcdir}/nzbhydra2wrapperPy3.py" < "${srcdir}/wrapper-Fix-dropping-every-second-line-of-stdout-807.patch"
}
package() {
- install -d -m 755 "${pkgdir}/usr/lib/nzbhydra2"
- cp -dpr --no-preserve=ownership "${srcdir}/lib" "${srcdir}/readme.md" "${pkgdir}/usr/lib/nzbhydra2"
+ install -D -m 755 "${srcdir}/nzbhydra2.sh" "${pkgdir}/usr/bin/nzbhydra2"
install -D -m 755 "${srcdir}/nzbhydra2wrapperPy3.py" "${pkgdir}/usr/lib/nzbhydra2/nzbhydra2wrapperPy3.py"
+ install -D -m 644 "${srcdir}/lib/core-${pkgver}-exec.jar" "${pkgdir}/usr/share/java/nzbhydra2/core-${pkgver}-exec.jar"
+ 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"
diff --git a/nzbhydra2.service b/nzbhydra2.service
index b43c36dff241..0b7252b2df7b 100644
--- a/nzbhydra2.service
+++ b/nzbhydra2.service
@@ -7,10 +7,8 @@ After=network.target
User=nzbhydra2
Group=nzbhydra2
Type=simple
-WorkingDirectory=/usr/lib/nzbhydra2
-ExecStart=/usr/bin/python /usr/lib/nzbhydra2/nzbhydra2wrapperPy3.py --nobrowser --datafolder /var/lib/nzbhydra2
+ExecStart=/usr/bin/nzbhydra2 --nobrowser --datafolder /var/lib/nzbhydra2
Restart=always
-SyslogIdentifier=nzbhydra2
[Install]
WantedBy=multi-user.target
diff --git a/nzbhydra2.sh b/nzbhydra2.sh
new file mode 100644
index 000000000000..13ff036087b2
--- /dev/null
+++ b/nzbhydra2.sh
@@ -0,0 +1,3 @@
+#!/usr/bin/env sh
+export HYDRAWORKINGFOLDER=/usr/share/java/nzbhydra2
+exec /usr/lib/nzbhydra2/nzbhydra2wrapperPy3.py "$@"
diff --git a/nzbhydra2.tmpfiles b/nzbhydra2.tmpfiles
index 016b793507a9..51864bfae4ec 100644
--- a/nzbhydra2.tmpfiles
+++ b/nzbhydra2.tmpfiles
@@ -1,5 +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
-Z /usr/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..c5f55962979d
--- /dev/null
+++ b/wrapper-remove-base-path-checks.patch
@@ -0,0 +1,28 @@
+diff --git a/other/wrapper/nzbhydra2wrapperPy3.py b/other/wrapper/nzbhydra2wrapperPy3.py
+index 1c691007..9d920faa 100644
+--- a/other/wrapper/nzbhydra2wrapperPy3.py
++++ b/other/wrapper/nzbhydra2wrapperPy3.py
+@@ -283,11 +283,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)
+-
+ debugSwitchFile = os.path.join(args.datafolder, "DEBUG")
+ if os.path.exists(debugSwitchFile):
+ logger.setLevel("DEBUG")
+@@ -297,10 +292,7 @@ def startup():
+ logger.info("Setting wrapper log level to DEBUG")
+
+ isWindows = platform.system().lower() == "windows"
+- libFolder = os.path.join(basePath, "lib")
+- 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)
++ libFolder = basePath
+
+ 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:
diff --git a/wrapper-remove-update-support.patch b/wrapper-remove-update-support.patch
new file mode 100644
index 000000000000..b6b2ad1c9e9f
--- /dev/null
+++ b/wrapper-remove-update-support.patch
@@ -0,0 +1,13 @@
+diff --git a/other/wrapper/nzbhydra2wrapperPy3.py b/other/wrapper/nzbhydra2wrapperPy3.py
+index 1c691007..de862159 100644
+--- a/other/wrapper/nzbhydra2wrapperPy3.py
++++ b/other/wrapper/nzbhydra2wrapperPy3.py
+@@ -617,7 +617,7 @@ if __name__ == '__main__':
+
+ 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")