Files
termux-packages/packages/task-spooler/fix-hardcoded-paths.patch
2023-10-30 18:01:38 +00:00

189 lines
9.0 KiB
Diff

+++ a/CMakeLists.txt
@@ -84,8 +84,8 @@
endif(TASK_SPOOLER_COMPILE_CUDA)
# install
-install(CODE "execute_process(COMMAND install -c -d /usr/local/bin)")
-install(CODE "execute_process(COMMAND install -c ts /usr/local/bin)")
+install(CODE "execute_process(COMMAND install -c -d @TERMUX_PREFIX@/bin)")
+install(CODE "execute_process(COMMAND install -c ts @TERMUX_PREFIX@/bin)")
install(CODE "execute_process(COMMAND ./makeman)")
-install(CODE "execute_process(COMMAND install -c -d /usr/local/share/man/man1)")
-install(CODE "execute_process(COMMAND install -c -m 644 ts.1 /usr/local/share/man/man1)")
+install(CODE "execute_process(COMMAND install -c -d @TERMUX_PREFIX@/share/man/man1)")
+install(CODE "execute_process(COMMAND install -c -m 644 ./ts.1 @TERMUX_PREFIX@/share/man/man1)")
+++ a/env.c
@@ -40,8 +40,8 @@
if (p[1] != 1 && p[1] != 2)
close(p[1]);
close(p[0]);
- execlp("/bin/sh", "/bin/sh", "-c", command, (char*)NULL);
- error("/bin/sh exec error");
+ execlp("@TERMUX_PREFIX@/bin/sh", "@TERMUX_PREFIX@/bin/sh", "-c", command, (char*)NULL);
+ error("@TERMUX_PREFIX@/bin/sh exec error");
case -1:
error("Fork error");
default:
+++ a/execute.c
@@ -155,7 +155,7 @@
/* Prepare path */
int lname;
char *outfname_full;
- char *outdir = tmpdir == NULL ? "/tmp" : tmpdir;
+ char *outdir = tmpdir == NULL ? "@TERMUX_PREFIX@/tmp" : tmpdir;
lname = strlen(outdir) + strlen(outfname) + 1 /* \0 */;
outfname_full = (char *) malloc(lname);
+++ a/list.c
@@ -29,7 +29,7 @@
char *line;
line = malloc(600);
- snprintf(line, 600, "#!/bin/sh\n# - task spooler (ts) job dump\n"
+ snprintf(line, 600, "#!@TERMUX_PREFIX@/bin/sh\n# - task spooler (ts) job dump\n"
"# This file has been created because a SIGTERM killed\n"
"# your queue server.\n"
"# The finished commands are listed first.\n"
+++ a/mail.c
@@ -34,7 +34,7 @@
close(2);
close(p[1]);
dup2(p[0], 0);
- execl("/usr/sbin/sendmail", "sendmail", "-oi", dest, NULL);
+ execl("@TERMUX_PREFIX@/bin/sendmail", "sendmail", "-oi", dest, NULL);
error("run sendmail");
case -1:
error("fork sendmail");
+++ a/man.c
@@ -105,7 +105,7 @@
", or to the\n"
".B $USER\n"
"using\n"
- ".B /usr/sbin/sendmail.\n"
+ ".B @TERMUX_PREFIX@/bin/sendmail.\n"
"Look at\n"
".B ENVIRONMENT.\n"
".TP\n"
@@ -137,7 +137,7 @@
".B \"\\-E\"\n"
"Keep two different output files for the command stdout and stderr. stdout goes to\n"
"the file announced by ts (look at \\fB\\-o\\fR), and stderr goes to the stdout file\n"
- "with an additional \".e\". For example, /tmp/ts-out.SKsDw8 and /tmp/ts-out.SKsDw8.e.\n"
+ "with an additional \".e\". For example, @TERMUX_PREFIX@/tmp/ts-out.SKsDw8 and @TERMUX_PREFIX@/tmp/ts-out.SKsDw8.e.\n"
"Only the stdout file gets created with \\fBmkstemp\\fR, ensuring it does not overwrite\n"
"any other; the \".e\" will be overwritten if it existed.\n"
".TP\n"
@@ -338,7 +338,7 @@
"temporary directory, \n"
".B TMPDIR\n"
"will be used if defined, or\n"
- ".B /tmp\n"
+ ".B @TERMUX_PREFIX@/tmp\n"
"otherwise.\n"
".TP\n"
".B \"TS_SOCKET\"\n"
@@ -362,7 +362,7 @@
"or if not defined,\n"
".B nobody.\n"
"The system\n"
- ".B /usr/sbin/sendmail\n"
+ ".B @TERMUX_PREFIX@/bin/sendmail\n"
"is used. The\n"
"job outputs are not sent as an attachment, so understand the consequences if you\n"
"use the\n"
@@ -382,12 +382,12 @@
".TP\n"
".B \"TS_ENV\"\n"
"This has a command to be run at enqueue time through\n"
- "\\fB/bin/sh\\fR. The output of the command will be readable through the option\n"
+ "\\fB@TERMUX_PREFIX@/bin/sh\\fR. The output of the command will be readable through the option\n"
"\\fB\\-i\\fR. You can use a command which shows relevant environment for the command run.\n"
"For example, you may use \\fBTS_ENV='pwd;set;mount'\\fR.\n"
".SH FILES\n"
".TP\n"
- ".B /tmp/ts.error\n"
+ ".B @TERMUX_PREFIX@/tmp/ts.error\n"
"if\n"
".B ts\n"
"finds any internal problem, you should find an error report there.\n"
@@ -405,7 +405,7 @@
"in order to set redirections to the command run.\n"
"\n"
"If an internal problem is found in runtime, a file\n"
- ".B /tmp/ts.error\n"
+ ".B @TERMUX_PREFIX@/tmp/ts.error\n"
"is created, which you can submit to the developer in order to fix the bug.\n"
"\n"
".SH SEE ALSO\n"
@@ -504,7 +504,7 @@
", or to the\n"
".B $USER\n"
"using\n"
- ".B /usr/sbin/sendmail.\n"
+ ".B @TERMUX_PREFIX@/bin/sendmail.\n"
"Look at\n"
".B ENVIRONMENT.\n"
".TP\n"
@@ -536,7 +536,7 @@
".B \"\\-E\"\n"
"Keep two different output files for the command stdout and stderr. stdout goes to\n"
"the file announced by ts (look at \\fB\\-o\\fR), and stderr goes to the stdout file\n"
- "with an additional \".e\". For example, /tmp/ts-out.SKsDw8 and /tmp/ts-out.SKsDw8.e.\n"
+ "with an additional \".e\". For example, @TERMUX_PREFIX@/tmp/ts-out.SKsDw8 and @TERMUX_PREFIX@/tmp/ts-out.SKsDw8.e.\n"
"Only the stdout file gets created with \\fBmkstemp\\fR, ensuring it does not overwrite\n"
"any other; the \".e\" will be overwritten if it existed.\n"
".TP\n"
@@ -718,7 +718,7 @@
"temporary directory, \n"
".B TMPDIR\n"
"will be used if defined, or\n"
- ".B /tmp\n"
+ ".B @TERMUX_PREFIX@/tmp\n"
"otherwise.\n"
".TP\n"
".B \"TS_SOCKET\"\n"
@@ -742,7 +742,7 @@
"or if not defined,\n"
".B nobody.\n"
"The system\n"
- ".B /usr/sbin/sendmail\n"
+ ".B @TERMUX_PREFIX@/bin/sendmail\n"
"is used. The\n"
"job outputs are not sent as an attachment, so understand the consequences if you\n"
"use the\n"
@@ -762,12 +762,12 @@
".TP\n"
".B \"TS_ENV\"\n"
"This has a command to be run at enqueue time through\n"
- "\\fB/bin/sh\\fR. The output of the command will be readable through the option\n"
+ "\\fB@TERMUX_PREFIX@/bin/sh\\fR. The output of the command will be readable through the option\n"
"\\fB\\-i\\fR. You can use a command which shows relevant environment for the command run.\n"
"For example, you may use \\fBTS_ENV='pwd;set;mount'\\fR.\n"
".SH FILES\n"
".TP\n"
- ".B /tmp/ts.error\n"
+ ".B @TERMUX_PREFIX@/tmp/ts.error\n"
"if\n"
".B ts\n"
"finds any internal problem, you should find an error report there.\n"
@@ -785,7 +785,7 @@
"in order to set redirections to the command run.\n"
"\n"
"If an internal problem is found in runtime, a file\n"
- ".B /tmp/ts.error\n"
+ ".B @TERMUX_PREFIX@/tmp/ts.error\n"
"is created, which you can submit to the developer in order to fix the bug.\n"
"\n"
".SH SEE ALSO\n"
+++ a/server_start.c
@@ -49,7 +49,7 @@
/* Create the path */
tmpdir = getenv("TMPDIR");
if (tmpdir == NULL)
- tmpdir = "/tmp";
+ tmpdir = "@TERMUX_PREFIX@/tmp";
sprintf(userid, "%u", (unsigned int) getuid());