et: add package
This commit is contained in:
parent
49ac45da30
commit
e8ca10e14c
34
packages/et/CMakeLists.txt.patch
Normal file
34
packages/et/CMakeLists.txt.patch
Normal file
@ -0,0 +1,34 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 7f3f941..7c148ff 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -113,6 +113,8 @@ ELSEIF(NETBSD)
|
||||
set(CORE_LIBRARIES util resolv execinfo)
|
||||
ELSEIF(WIN32)
|
||||
set(CORE_LIBRARIES Ws2_32 Shlwapi dbghelp)
|
||||
+ELSEIF(ANDROID)
|
||||
+ set(CORE_LIBRARIES util)
|
||||
ELSE()
|
||||
set(CORE_LIBRARIES util resolv)
|
||||
ENDIF()
|
||||
@@ -120,7 +122,11 @@ ENDIF()
|
||||
MACRO(DECORATE_TARGET TARGET_NAME)
|
||||
add_sanitizers(${TARGET_NAME})
|
||||
set_target_properties(${TARGET_NAME} PROPERTIES COTIRE_CXX_PREFIX_HEADER_INIT "src/base/Headers.hpp")
|
||||
- cotire(${TARGET_NAME})
|
||||
+ IF(ANDROID)
|
||||
+ # Doesn't work when cross-compiling
|
||||
+ ELSE()
|
||||
+ cotire(${TARGET_NAME})
|
||||
+ ENDIF()
|
||||
ENDMACRO()
|
||||
|
||||
include_directories(
|
||||
@@ -129,7 +131,6 @@
|
||||
external_imported/Catch2/single_include
|
||||
external_imported/cxxopts/include
|
||||
external_imported/msgpack-c/include
|
||||
- external_imported/UniversalStacktrace/ust
|
||||
src/base
|
||||
src/terminal
|
||||
src/terminal/forwarding
|
16
packages/et/build.sh
Normal file
16
packages/et/build.sh
Normal file
@ -0,0 +1,16 @@
|
||||
TERMUX_PKG_HOMEPAGE=https://eternalterminal.dev
|
||||
TERMUX_PKG_DESCRIPTION="A remote shell that automatically reconnects without interrupting the session"
|
||||
TERMUX_PKG_LICENSE="Apache-2.0"
|
||||
TERMUX_PKG_MAINTAINER="@termux"
|
||||
TERMUX_PKG_VERSION=6.0.13
|
||||
TERMUX_PKG_SRCURL=https://github.com/MisterTea/EternalTerminal/archive/et-v${TERMUX_PKG_VERSION}.tar.gz
|
||||
TERMUX_PKG_SHA256=728c3a444d666897c710e33fe473d8d289263a59574451b13aa53ec3c6ac88b3
|
||||
TERMUX_PKG_DEPENDS="libc++, protobuf, libsodium"
|
||||
|
||||
termux_step_pre_configure() {
|
||||
termux_setup_protobuf
|
||||
}
|
||||
|
||||
termux_step_post_make_install() {
|
||||
install -Dm600 $TERMUX_PKG_SRCDIR/etc/et.cfg $TERMUX_PREFIX/etc/
|
||||
}
|
30
packages/et/src-base-Headers.hpp.patch
Normal file
30
packages/et/src-base-Headers.hpp.patch
Normal file
@ -0,0 +1,30 @@
|
||||
diff --git a/src/base/Headers.hpp b/src/base/Headers.hpp
|
||||
index 43a1903..405f51e 100644
|
||||
--- a/src/base/Headers.hpp
|
||||
+++ b/src/base/Headers.hpp
|
||||
@@ -85,7 +85,9 @@ inline int close(int fd) { return ::closesocket(fd); }
|
||||
#include "easylogging++.h"
|
||||
#include "json.hpp"
|
||||
#include "sole.hpp"
|
||||
+#if !defined(__ANDROID__)
|
||||
#include "ust.hpp"
|
||||
+#endif
|
||||
|
||||
#ifdef WITH_UTEMPTER
|
||||
#include <utempter.h>
|
||||
@@ -133,9 +135,15 @@ const int CLIENT_KEEP_ALIVE_DURATION = 5;
|
||||
// allow enough time.
|
||||
const int SERVER_KEEP_ALIVE_DURATION = 11;
|
||||
|
||||
+#if defined(__ANDROID__)
|
||||
+#define STFATAL LOG(FATAL) << "No Stack Trace on Android" << endl
|
||||
+
|
||||
+#define STERROR LOG(ERROR) << "No Stack Trace on Android" << endl
|
||||
+#else
|
||||
#define STFATAL LOG(FATAL) << "Stack Trace: " << endl << ust::generate()
|
||||
|
||||
#define STERROR LOG(ERROR) << "Stack Trace: " << endl << ust::generate()
|
||||
+#endif
|
||||
|
||||
#ifdef WIN32
|
||||
inline string WindowsErrnoToString() {
|
13
packages/et/src-base-TcpSocketHandler.cpp.patch
Normal file
13
packages/et/src-base-TcpSocketHandler.cpp.patch
Normal file
@ -0,0 +1,13 @@
|
||||
diff --git a/src/base/TcpSocketHandler.cpp b/src/base/TcpSocketHandler.cpp
|
||||
index e94f1a2..f1f7b3b 100644
|
||||
--- a/src/base/TcpSocketHandler.cpp
|
||||
+++ b/src/base/TcpSocketHandler.cpp
|
||||
@@ -14,6 +14,8 @@ int TcpSocketHandler::connect(const SocketEndpoint &endpoint) {
|
||||
hints.ai_socktype = SOCK_STREAM;
|
||||
#if __NetBSD__
|
||||
hints.ai_flags = (AI_CANONNAME | AI_ADDRCONFIG);
|
||||
+#elif defined(__ANDROID__)
|
||||
+ hints.ai_flags = (AI_CANONNAME | AI_ADDRCONFIG);
|
||||
#else
|
||||
hints.ai_flags = (AI_CANONNAME | AI_V4MAPPED | AI_ADDRCONFIG | AI_ALL);
|
||||
#endif
|
13
packages/et/src-terminal-ParseConfigFile.hpp.patch
Normal file
13
packages/et/src-terminal-ParseConfigFile.hpp.patch
Normal file
@ -0,0 +1,13 @@
|
||||
diff --git a/src/terminal/ParseConfigFile.hpp b/src/terminal/ParseConfigFile.hpp
|
||||
index 9b85468..acfa809 100644
|
||||
--- a/src/terminal/ParseConfigFile.hpp
|
||||
+++ b/src/terminal/ParseConfigFile.hpp
|
||||
@@ -34,6 +34,8 @@
|
||||
#include <sys/time.h>
|
||||
#endif /* HAVE_SYS_TIME_H */
|
||||
|
||||
+#include "Headers.hpp"
|
||||
+
|
||||
using namespace std;
|
||||
|
||||
#define MAX_LINE_SIZE 1024
|
154
packages/et/temporaryDirectory.patch
Normal file
154
packages/et/temporaryDirectory.patch
Normal file
@ -0,0 +1,154 @@
|
||||
diff --git a/src/base/Headers.hpp b/src/base/Headers.hpp
|
||||
index e1cabeb..405f51e 100644
|
||||
--- a/src/base/Headers.hpp
|
||||
+++ b/src/base/Headers.hpp
|
||||
@@ -294,7 +294,7 @@ inline string GetTempDirectory() {
|
||||
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t> > converter;
|
||||
std::string tmpDir = converter.to_bytes(wstring(buf, retval));
|
||||
#else
|
||||
- string tmpDir = "/tmp";
|
||||
+ string tmpDir = _PATH_TMP;
|
||||
#endif
|
||||
return tmpDir;
|
||||
}
|
||||
diff --git a/src/htm/HtmClientMain.cpp b/src/htm/HtmClientMain.cpp
|
||||
index 75599f3..1b7d226 100644
|
||||
--- a/src/htm/HtmClientMain.cpp
|
||||
+++ b/src/htm/HtmClientMain.cpp
|
||||
@@ -64,9 +64,9 @@ int main(int argc, char** argv) {
|
||||
el::Loggers::setVerboseLevel(3);
|
||||
// default max log file size is 20MB for etserver
|
||||
string maxlogsize = "20971520";
|
||||
- LogHandler::setupLogFile(&defaultConf, "/tmp/htm.log", maxlogsize);
|
||||
+ LogHandler::setupLogFile(&defaultConf, GetTempDirectory() + "htm.log", maxlogsize);
|
||||
// Redirect std streams to a file
|
||||
- LogHandler::stderrToFile("/tmp/htm");
|
||||
+ LogHandler::stderrToFile(GetTempDirectory() + "htm");
|
||||
|
||||
// Reconfigure default logger to apply settings above
|
||||
el::Loggers::reconfigureLogger("default", defaultConf);
|
||||
diff --git a/src/htm/HtmServer.cpp b/src/htm/HtmServer.cpp
|
||||
index 0d96a06..ca4eba9 100644
|
||||
--- a/src/htm/HtmServer.cpp
|
||||
+++ b/src/htm/HtmServer.cpp
|
||||
@@ -176,6 +176,6 @@ void HtmServer::recover() {
|
||||
|
||||
string HtmServer::getPipeName() {
|
||||
uid_t myuid = getuid();
|
||||
- return string("/tmp/htm.") + to_string(myuid) + string(".ipc");
|
||||
+ return string(GetTempDirectory() + "htm.") + to_string(myuid) + string(".ipc");
|
||||
}
|
||||
} // namespace et
|
||||
diff --git a/src/htm/HtmServerMain.cpp b/src/htm/HtmServerMain.cpp
|
||||
index e6ab21f..de57897 100644
|
||||
--- a/src/htm/HtmServerMain.cpp
|
||||
+++ b/src/htm/HtmServerMain.cpp
|
||||
@@ -18,9 +18,9 @@ int main(int argc, char **argv) {
|
||||
el::Loggers::setVerboseLevel(3);
|
||||
// default max log file size is 20MB for etserver
|
||||
string maxlogsize = "20971520";
|
||||
- LogHandler::setupLogFile(&defaultConf, "/tmp/htmd.log", maxlogsize);
|
||||
+ LogHandler::setupLogFile(&defaultConf, GetTempDirectory() + "htmd.log", maxlogsize);
|
||||
// Redirect std streams to a file
|
||||
- LogHandler::stderrToFile("/tmp/htmd");
|
||||
+ LogHandler::stderrToFile(GetTempDirectory() + "htmd");
|
||||
|
||||
// Reconfigure default logger to apply settings above
|
||||
el::Loggers::reconfigureLogger("default", defaultConf);
|
||||
diff --git a/src/terminal/TerminalMain.cpp b/src/terminal/TerminalMain.cpp
|
||||
index e61f72c..0794516 100644
|
||||
--- a/src/terminal/TerminalMain.cpp
|
||||
+++ b/src/terminal/TerminalMain.cpp
|
||||
@@ -14,7 +14,7 @@ using namespace et;
|
||||
void setDaemonLogFile(string idpasskey, string daemonType) {
|
||||
string first_idpass_chars = idpasskey.substr(0, 10);
|
||||
string logFile =
|
||||
- string("/tmp/etterminal_") + daemonType + "_" + first_idpass_chars;
|
||||
+ string(GetTempDirectory() + "etterminal_") + daemonType + "_" + first_idpass_chars;
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
@@ -140,7 +140,7 @@ int main(int argc, char** argv) {
|
||||
|
||||
// etserver with --jump cannot write to the default log file(root)
|
||||
LogHandler::setupLogFile(&defaultConf,
|
||||
- "/tmp/etjump-" + username + "-" + id + ".log",
|
||||
+ GetTempDirectory() + "etjump-" + username + "-" + id + ".log",
|
||||
maxlogsize);
|
||||
// Reconfigure default logger to apply settings above
|
||||
el::Loggers::reconfigureLogger("default", defaultConf);
|
||||
@@ -173,7 +173,7 @@ int main(int argc, char** argv) {
|
||||
|
||||
// etserver with --idpasskey cannot write to the default log file(root)
|
||||
LogHandler::setupLogFile(&defaultConf,
|
||||
- "/tmp/etterminal-" + username + "-" + id + ".log",
|
||||
+ GetTempDirectory() + "etterminal-" + username + "-" + id + ".log",
|
||||
maxlogsize);
|
||||
// Reconfigure default logger to apply settings above
|
||||
el::Loggers::reconfigureLogger("default", defaultConf);
|
||||
diff --git a/src/terminal/TerminalServerMain.cpp b/src/terminal/TerminalServerMain.cpp
|
||||
index a8d59c6..23fa0ae 100644
|
||||
--- a/src/terminal/TerminalServerMain.cpp
|
||||
+++ b/src/terminal/TerminalServerMain.cpp
|
||||
@@ -28,7 +28,7 @@ int main(int argc, char **argv) {
|
||||
("logtostdout", "log to stdout") //
|
||||
("pidfile", "Location of the pid file",
|
||||
cxxopts::value<std::string>()->default_value(
|
||||
- "/var/run/etserver.pid")) //
|
||||
+ "@TERMUX_PREFIX@/var/run/etserver.pid")) //
|
||||
("v,verbose", "Enable verbose logging",
|
||||
cxxopts::value<int>()->default_value("0"), "LEVEL") //
|
||||
("serverfifo",
|
||||
@@ -58,7 +58,7 @@ int main(int argc, char **argv) {
|
||||
} else {
|
||||
defaultConf.setGlobally(el::ConfigurationType::ToStandardOutput, "false");
|
||||
// Redirect std streams to a file
|
||||
- LogHandler::stderrToFile("/tmp/etserver");
|
||||
+ LogHandler::stderrToFile(GetTempDirectory() + "etserver");
|
||||
}
|
||||
|
||||
string serverFifo = ROUTER_FIFO_NAME;
|
||||
@@ -89,7 +89,7 @@ int main(int argc, char **argv) {
|
||||
|
||||
{
|
||||
const char *fifoName =
|
||||
- ini.GetValue("Debug", "serverfifo", ROUTER_FIFO_NAME);
|
||||
+ ini.GetValue("Debug", "serverfifo", ROUTER_FIFO_NAME.c_str());
|
||||
if (fifoName) {
|
||||
serverFifo = string(fifoName);
|
||||
}
|
||||
@@ -129,7 +129,7 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
|
||||
// Set log file for etserver process here.
|
||||
- LogHandler::setupLogFile(&defaultConf, "/tmp/etserver-%datetime.log",
|
||||
+ LogHandler::setupLogFile(&defaultConf, GetTempDirectory() + "etserver-%datetime.log",
|
||||
maxlogsize);
|
||||
// Reconfigure default logger to apply settings above
|
||||
el::Loggers::reconfigureLogger("default", defaultConf);
|
||||
diff --git a/src/terminal/UserTerminalRouter.hpp b/src/terminal/UserTerminalRouter.hpp
|
||||
index 511e207..40aa7f9 100644
|
||||
--- a/src/terminal/UserTerminalRouter.hpp
|
||||
+++ b/src/terminal/UserTerminalRouter.hpp
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "PipeSocketHandler.hpp"
|
||||
#include "ServerConnection.hpp"
|
||||
|
||||
-#define ROUTER_FIFO_NAME "/tmp/etserver.idpasskey.fifo"
|
||||
+const string ROUTER_FIFO_NAME = GetTempDirectory() + "etserver.idpasskey.fifo";
|
||||
|
||||
namespace et {
|
||||
class UserTerminalRouter {
|
||||
diff --git a/src/terminal/forwarding/PortForwardHandler.cpp b/src/terminal/forwarding/PortForwardHandler.cpp
|
||||
index f046a86..b2422c1 100644
|
||||
--- a/src/terminal/forwarding/PortForwardHandler.cpp
|
||||
+++ b/src/terminal/forwarding/PortForwardHandler.cpp
|
||||
@@ -45,7 +45,7 @@ PortForwardSourceResponse PortForwardHandler::createSource(
|
||||
source = pfsr.source();
|
||||
} else {
|
||||
// Make a random file to forward the pipe
|
||||
- string sourcePattern = string("/tmp/et_forward_sock_XXXXXX");
|
||||
+ string sourcePattern = GetTempDirectory() + string("et_forward_sock_XXXXXX");
|
||||
string sourceDirectory = string(mkdtemp(&sourcePattern[0]));
|
||||
FATAL_FAIL(::chmod(sourceDirectory.c_str(), S_IRUSR | S_IWUSR | S_IXUSR));
|
||||
FATAL_FAIL(::chown(sourceDirectory.c_str(), userid, groupid));
|
Loading…
Reference in New Issue
Block a user