From ddfffe674d9cb3788846fbc39e10763d951fa8cb Mon Sep 17 00:00:00 2001 From: Marcel Dopita Date: Tue, 9 Jan 2018 18:54:15 +0100 Subject: [PATCH] nzbget: Add package --- packages/nzbget/build.sh | 16 ++++++++++++++++ packages/nzbget/nzbget.cpp.patch | 22 ++++++++++++++++++++++ packages/nzbget/options.cpp.patch | 16 ++++++++++++++++ packages/nzbget/thread.cpp.patch | 22 ++++++++++++++++++++++ 4 files changed, 76 insertions(+) create mode 100644 packages/nzbget/build.sh create mode 100644 packages/nzbget/nzbget.cpp.patch create mode 100644 packages/nzbget/options.cpp.patch create mode 100644 packages/nzbget/thread.cpp.patch diff --git a/packages/nzbget/build.sh b/packages/nzbget/build.sh new file mode 100644 index 000000000..8bb1510b7 --- /dev/null +++ b/packages/nzbget/build.sh @@ -0,0 +1,16 @@ +TERMUX_PKG_HOMEPAGE=https://nzbget.net/ +TERMUX_PKG_DESCRIPTION="The most efficient usenet downloader" +TERMUX_PKG_VERSION=19.1 +TERMUX_PKG_SRCURL=https://github.com/nzbget/nzbget/releases/download/v${TERMUX_PKG_VERSION}/nzbget-${TERMUX_PKG_VERSION}-src.tar.gz +TERMUX_PKG_SHA256=06df42356ac2d63bbc9f7861abe9c3216df56fa06802e09e8a50b05f4ad95ce6 +TERMUX_PKG_DEPENDS="libxml2, ncurses, openssl, unrar, p7zip" +TERMUX_PKG_BUILD_IN_SRC=yes +TERMUX_PKG_EXTRA_CONFIGURE_ARGS="ac_cv_c_bigendian=no" + +termux_step_create_debscripts () { + echo "#!$TERMUX_PREFIX/bin/sh" > postinst + echo "sed -e 's|^\(CertStore=\).*|\1$TERMUX_PREFIX/etc/tls/cert.pem|g" >> postinst + echo "s|^\(ControlPassword=\).*|\1|g' $TERMUX_PREFIX/share/nzbget/nzbget.conf > ~/.nzbget" >> postinst + echo "exit 0" >> postinst + chmod 0755 postinst +} diff --git a/packages/nzbget/nzbget.cpp.patch b/packages/nzbget/nzbget.cpp.patch new file mode 100644 index 000000000..b4ec5fa69 --- /dev/null +++ b/packages/nzbget/nzbget.cpp.patch @@ -0,0 +1,22 @@ +diff --git a/daemon/main/nzbget.cpp b/daemon/main/nzbget.cpp +index 1cfa105..b5cee58 100644 +--- a/daemon/main/nzbget.cpp ++++ b/daemon/main/nzbget.cpp +@@ -19,6 +19,8 @@ + */ + + ++#include ++ + #include "nzbget.h" + #include "ServerPool.h" + #include "Log.h" +@@ -913,7 +915,7 @@ void NZBGet::Daemonize() + error("Starting daemon failed: could not create lock-file %s", m_options->GetLockFile()); + exit(1); + } +- if (lockf(lfp, F_TLOCK, 0) < 0) ++ if (flock(lfp, LOCK_EX) < 0) + { + error("Starting daemon failed: could not acquire lock on lock-file %s", m_options->GetLockFile()); + exit(1); diff --git a/packages/nzbget/options.cpp.patch b/packages/nzbget/options.cpp.patch new file mode 100644 index 000000000..37c1a2dfa --- /dev/null +++ b/packages/nzbget/options.cpp.patch @@ -0,0 +1,16 @@ +diff --git a/daemon/main/Options.cpp b/daemon/main/Options.cpp +index f41bd82..6a3dc0e 100644 +--- a/daemon/main/Options.cpp ++++ b/daemon/main/Options.cpp +@@ -182,10 +182,7 @@ const int BoolCount = 12; + const char* PossibleConfigLocations[] = + { + "~/.nzbget", +- "/etc/nzbget.conf", +- "/usr/etc/nzbget.conf", +- "/usr/local/etc/nzbget.conf", +- "/opt/etc/nzbget.conf", ++ "@TERMUX_PREFIX@/etc/nzbget.conf", + nullptr + }; + #endif diff --git a/packages/nzbget/thread.cpp.patch b/packages/nzbget/thread.cpp.patch new file mode 100644 index 000000000..115f69118 --- /dev/null +++ b/packages/nzbget/thread.cpp.patch @@ -0,0 +1,22 @@ +diff --git a/daemon/util/Thread.cpp b/daemon/util/Thread.cpp +index 199005f..61b5bcb 100644 +--- a/daemon/util/Thread.cpp ++++ b/daemon/util/Thread.cpp +@@ -111,7 +111,7 @@ void Thread::Start() + pthread_attr_t m_attr; + pthread_attr_init(&m_attr); + pthread_attr_setdetachstate(&m_attr, PTHREAD_CREATE_DETACHED); +- pthread_attr_setinheritsched(&m_attr, PTHREAD_INHERIT_SCHED); ++ //pthread_attr_setinheritsched(&m_attr, PTHREAD_INHERIT_SCHED); + m_running = !pthread_create(&m_threadObj, &m_attr, Thread::thread_handler, (void *) this); + pthread_attr_destroy(&m_attr); + #endif +@@ -140,7 +140,7 @@ bool Thread::Kill() + #ifdef WIN32 + bool terminated = TerminateThread(m_threadObj, 0) != 0; + #else +- bool terminated = pthread_cancel(m_threadObj) == 0; ++ bool terminated = pthread_kill(m_threadObj, 0) == 0; + #endif + + if (terminated)