From ee2158978a1ada1c30842bf5fbc83b46debac637 Mon Sep 17 00:00:00 2001 From: Leonid Pliushch Date: Tue, 12 Sep 2017 13:05:04 +0300 Subject: [PATCH] libgcrypt: fix hardcoded paths --- packages/libgcrypt/build.sh | 1 + packages/libgcrypt/fix-hardcoded-paths.patch | 82 ++++++++++++++++++++ 2 files changed, 83 insertions(+) create mode 100644 packages/libgcrypt/fix-hardcoded-paths.patch diff --git a/packages/libgcrypt/build.sh b/packages/libgcrypt/build.sh index 78cae4806..fd12c55f2 100755 --- a/packages/libgcrypt/build.sh +++ b/packages/libgcrypt/build.sh @@ -1,6 +1,7 @@ TERMUX_PKG_HOMEPAGE=https://www.gnu.org/software/libgcrypt/ TERMUX_PKG_DESCRIPTION="General purpose cryptographic library based on the code from GnuPG" TERMUX_PKG_VERSION=1.8.1 +TERMUX_PKG_REVISION=1 TERMUX_PKG_SHA256=7a2875f8b1ae0301732e878c0cca2c9664ff09ef71408f085c50e332656a78b3 TERMUX_PKG_SRCURL=https://www.gnupg.org/ftp/gcrypt/libgcrypt/libgcrypt-${TERMUX_PKG_VERSION}.tar.bz2 TERMUX_PKG_DEPENDS="libgpg-error" diff --git a/packages/libgcrypt/fix-hardcoded-paths.patch b/packages/libgcrypt/fix-hardcoded-paths.patch new file mode 100644 index 000000000..8a9102ef7 --- /dev/null +++ b/packages/libgcrypt/fix-hardcoded-paths.patch @@ -0,0 +1,82 @@ +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