termux-packages/packages/libgcrypt/fix-hardcoded-paths.patch

83 lines
4.3 KiB
Diff
Raw Normal View History

2017-09-12 12:05:04 +02:00
diff -uNr libgcrypt-1.8.1/random/random.c libgcrypt-1.8.1.mod/random/random.c
--- libgcrypt-1.8.1/random/random.c 2017-06-24 14:34:29.000000000 +0300
+++ libgcrypt-1.8.1.mod/random/random.c 2017-09-12 10:37:13.012994125 +0300
@@ -40,7 +40,7 @@
#include "cipher.h" /* For _gcry_sha1_hash_buffer(). */
/* The name of a file used to globally configure the RNG. */
-#define RANDOM_CONF_FILE "/etc/gcrypt/random.conf"
+#define RANDOM_CONF_FILE "@TERMUX_PREFIX@/etc/gcrypt/random.conf"
/* If not NULL a progress function called from certain places and the
diff -uNr libgcrypt-1.8.1/random/rndunix.c libgcrypt-1.8.1.mod/random/rndunix.c
--- libgcrypt-1.8.1/random/rndunix.c 2017-05-23 18:30:34.000000000 +0300
+++ libgcrypt-1.8.1.mod/random/rndunix.c 2017-09-12 10:54:50.432993369 +0300
@@ -226,6 +226,42 @@
const int hasAlternative; /* Whether source has alt.location */
} dataSources[] = {
+ // For Android
+ { "/system/bin/vmstat", "-s", SC(-3), NULL, 0, 0, 0, 1 },
+ { "/system/xbin/vmstat", "-s", SC(-3), NULL, 0, 0, 0, 1 },
+ { "/system/bin/netstat", "-s", SC(2), NULL, 0, 0, 0, 1 },
+ { "/system/xbin/netstat", "-s", SC(2), NULL, 0, 0, 0, 1 },
+ { "/system/bin/mpstat", NULL, SC(1), NULL, 0, 0, 0, 0 },
+ { "/system/xbin/mpstat", NULL, SC(1), NULL, 0, 0, 0, 0 },
+ { "/system/bin/df", NULL, SC(1), NULL, 0, 0, 0, 0 },
+ { "/system/xbin/df", NULL, SC(1), NULL, 0, 0, 0, 0 },
+ { "/system/bin/iostat", NULL, SC(SC_0), NULL, 0, 0, 0, 0 },
+ { "/system/xbin/iostat", NULL, SC(SC_0), NULL, 0, 0, 0, 0 },
+ { "/system/bin/uptime", NULL, SC(SC_0), NULL, 0, 0, 0, 1 },
+ { "/system/xbin/uptime", NULL, SC(SC_0), NULL, 0, 0, 0, 1 },
+ { "/system/bin/ps", "aux", SC(0.3), NULL, 0, 0, 0, 1 },
+ { "/system/xbin/ps", "aux", SC(0.3), NULL, 0, 0, 0, 1 },
+ { "/system/bin/arp", "-a", SC(0.1), NULL, 0, 0, 0, 1 },
+ { "/system/xbin/arp", "-a", SC(0.1), NULL, 0, 0, 0, 1 },
+
+ // For Termux
+ { "@TERMUX_PREFIX@/bin/vmstat", "-s", SC(-3), NULL, 0, 0, 0, 1 },
+ { "@TERMUX_PREFIX@/bin/applets/vmstat", "-s", SC(-3), NULL, 0, 0, 0, 1 },
+ { "@TERMUX_PREFIX@/bin/netstat", "-s", SC(2), NULL, 0, 0, 0, 1 },
+ { "@TERMUX_PREFIX@/bin/applets/netstat", "-s", SC(2), NULL, 0, 0, 0, 1 },
+ { "@TERMUX_PREFIX@/bin/mpstat", NULL, SC(1), NULL, 0, 0, 0, 0 },
+ { "@TERMUX_PREFIX@/bin/applets/mpstat", NULL, SC(1), NULL, 0, 0, 0, 0 },
+ { "@TERMUX_PREFIX@/bin/df", NULL, SC(1), NULL, 0, 0, 0, 0 },
+ { "@TERMUX_PREFIX@/bin/applets/df", NULL, SC(1), NULL, 0, 0, 0, 0 },
+ { "@TERMUX_PREFIX@/bin/iostat", NULL, SC(SC_0), NULL, 0, 0, 0, 0 },
+ { "@TERMUX_PREFIX@/bin/applets/iostat", NULL, SC(SC_0), NULL, 0, 0, 0, 0 },
+ { "@TERMUX_PREFIX@/bin/uptime", NULL, SC(SC_0), NULL, 0, 0, 0, 1 },
+ { "@TERMUX_PREFIX@/bin/applets/uptime", NULL, SC(SC_0), NULL, 0, 0, 0, 1 },
+ { "@TERMUX_PREFIX@/bin/ps", "aux", SC(0.3), NULL, 0, 0, 0, 1 },
+ { "@TERMUX_PREFIX@/bin/applets/ps", "aux", SC(0.3), NULL, 0, 0, 0, 1 },
+ { "@TERMUX_PREFIX@/bin/arp", "-a", SC(0.1), NULL, 0, 0, 0, 1 },
+ { "@TERMUX_PREFIX@/bin/applets/arp", "-a", SC(0.1), NULL, 0, 0, 0, 1 },
+
{ "/bin/vmstat", "-s", SC(-3), NULL, 0, 0, 0, 1 },
{ "/usr/bin/vmstat", "-s", SC(-3), NULL, 0, 0, 0, 0},
{ "/bin/vmstat", "-c", SC(-3), NULL, 0, 0, 0, 1 },
diff -uNr libgcrypt-1.8.1/src/fips.c libgcrypt-1.8.1.mod/src/fips.c
--- libgcrypt-1.8.1/src/fips.c 2016-04-07 18:30:08.000000000 +0300
+++ libgcrypt-1.8.1.mod/src/fips.c 2017-09-12 10:36:08.292994171 +0300
@@ -36,7 +36,7 @@
/* The name of the file used to force libgcrypt into fips mode. */
-#define FIPS_FORCE_FILE "/etc/gcrypt/fips_enabled"
+#define FIPS_FORCE_FILE "@TERMUX_PREFIX@/etc/gcrypt/fips_enabled"
/* The states of the finite state machine used in fips mode. */
diff -uNr libgcrypt-1.8.1/src/hwfeatures.c libgcrypt-1.8.1.mod/src/hwfeatures.c
--- libgcrypt-1.8.1/src/hwfeatures.c 2017-06-24 14:34:29.000000000 +0300
+++ libgcrypt-1.8.1.mod/src/hwfeatures.c 2017-09-12 10:37:03.892994132 +0300
@@ -33,7 +33,7 @@
#include "hwf-common.h"
/* The name of a file used to globally disable selected features. */
-#define HWF_DENY_FILE "/etc/gcrypt/hwf.deny"
+#define HWF_DENY_FILE "@TERMUX_PREFIX@/etc/gcrypt/hwf.deny"
/* A table to map hardware features to a string. */
static struct