diff -uNr postgresql-13.0/contrib/pg_trgm/trgm_regexp.c postgresql-13.0.mod/contrib/pg_trgm/trgm_regexp.c --- postgresql-13.0/contrib/pg_trgm/trgm_regexp.c 2020-09-21 23:47:36.000000000 +0300 +++ postgresql-13.0.mod/contrib/pg_trgm/trgm_regexp.c 2020-10-19 20:20:32.875091545 +0300 @@ -2173,7 +2173,7 @@ { /* dot -Tpng -o /tmp/source.png < /tmp/source.gv */ - FILE *fp = fopen("/tmp/source.gv", "w"); + FILE *fp = fopen("@TERMUX_PREFIX@/tmp/source.gv", "w"); fprintf(fp, "%s", buf.data); fclose(fp); diff -uNr postgresql-13.0/src/bin/initdb/initdb.c postgresql-13.0.mod/src/bin/initdb/initdb.c --- postgresql-13.0/src/bin/initdb/initdb.c 2020-09-21 23:47:36.000000000 +0300 +++ postgresql-13.0.mod/src/bin/initdb/initdb.c 2020-10-19 20:20:44.907210164 +0300 @@ -1095,7 +1095,7 @@ #else snprintf(repltok, sizeof(repltok), "#unix_socket_directories = ''"); #endif - conflines = replace_token(conflines, "#unix_socket_directories = '/tmp'", + conflines = replace_token(conflines, "#unix_socket_directories = '@TERMUX_PREFIX@/tmp'", repltok); #if DEF_PGPORT != 5432 diff -uNr postgresql-13.0/src/bin/pg_ctl/pg_ctl.c postgresql-13.0.mod/src/bin/pg_ctl/pg_ctl.c --- postgresql-13.0/src/bin/pg_ctl/pg_ctl.c 2020-09-21 23:47:36.000000000 +0300 +++ postgresql-13.0.mod/src/bin/pg_ctl/pg_ctl.c 2020-10-19 20:17:25.837231316 +0300 @@ -494,7 +494,7 @@ snprintf(cmd, MAXPGPATH, "exec \"%s\" %s%s < \"%s\" 2>&1", exec_path, pgdata_opt, post_opts, DEVNULL); - (void) execl("/bin/sh", "/bin/sh", "-c", cmd, (char *) NULL); + (void) execl("@TERMUX_PREFIX@/bin/sh", "sh", "-c", cmd, (char *) NULL); /* exec failed */ write_stderr(_("%s: could not start server: %s\n"), diff -uNr postgresql-13.0/src/bin/pg_upgrade/check.c postgresql-13.0.mod/src/bin/pg_upgrade/check.c --- postgresql-13.0/src/bin/pg_upgrade/check.c 2020-09-21 23:47:36.000000000 +0300 +++ postgresql-13.0.mod/src/bin/pg_upgrade/check.c 2020-10-19 20:17:25.837231316 +0300 @@ -474,7 +474,7 @@ #ifndef WIN32 /* add shebang header */ - fprintf(script, "#!/bin/sh\n\n"); + fprintf(script, "#!@TERMUX_PREFIX@/bin/sh\n\n"); #else /* suppress command echoing */ fprintf(script, "@echo off\n"); @@ -602,7 +602,7 @@ #ifndef WIN32 /* add shebang header */ - fprintf(script, "#!/bin/sh\n\n"); + fprintf(script, "#!@TERMUX_PREFIX@/bin/sh\n\n"); #endif /* delete old cluster's default tablespace */ diff -uNr postgresql-13.0/src/bin/psql/command.c postgresql-13.0.mod/src/bin/psql/command.c --- postgresql-13.0/src/bin/psql/command.c 2020-09-21 23:47:36.000000000 +0300 +++ postgresql-13.0.mod/src/bin/psql/command.c 2020-10-19 20:18:07.733650936 +0300 @@ -3577,7 +3577,7 @@ if (result == -1) pg_log_error("could not start editor \"%s\"", editorName); else if (result == 127) - pg_log_error("could not start /bin/sh"); + pg_log_error("could not start @TERMUX_PREFIX@/bin/sh"); free(sys); return result == 0; @@ -3607,7 +3607,7 @@ const char *tmpdir = getenv("TMPDIR"); if (!tmpdir) - tmpdir = "/tmp"; + tmpdir = "@TERMUX_PREFIX@/tmp"; #else char tmpdir[MAXPGPATH]; int ret; @@ -4590,7 +4590,7 @@ #ifndef WIN32 -#define DEFAULT_SHELL "/bin/sh" +#define DEFAULT_SHELL "@TERMUX_PREFIX@/bin/sh" #else /* * CMD.EXE is in different places in different Win32 releases so we diff -uNr postgresql-13.0/src/include/pg_config_manual.h postgresql-13.0.mod/src/include/pg_config_manual.h --- postgresql-13.0/src/include/pg_config_manual.h 2020-09-21 23:47:36.000000000 +0300 +++ postgresql-13.0.mod/src/include/pg_config_manual.h 2020-10-19 20:22:20.620150044 +0300 @@ -203,7 +203,7 @@ #ifndef WIN32 #define DEFAULT_PGSOCKET_DIR "/tmp" #else -#define DEFAULT_PGSOCKET_DIR "" +#define DEFAULT_PGSOCKET_DIR "@TERMUX_PREFIX@/tmp" #endif /*