Browse Source

wireguard-tools: use su instead of tsu

master
Henrik Grimler 5 years ago
parent
commit
a96f642695
  1. 22
      packages/wireguard-tools/android.c.patch
  2. 8
      packages/wireguard-tools/build.sh

22
packages/wireguard-tools/android.c.patch

@ -1,24 +1,18 @@
--- a/src/wg-quick/android.c --- ../android.c.orig 2020-05-15 19:44:11.410344718 +0200
+++ b/src/wg-quick/android.c +++ ./src/wg-quick/android.c 2020-05-15 21:42:30.220908645 +0200
@@ -242,17 +252,17 @@ @@ -615,12 +615,12 @@
if (!getuid())
return; return;
- args[0] = "su"; args[0] = "su";
- args[1] = "-p"; - args[1] = "-p";
+ args[0] = "tsu"; - args[2] = "-c";
+ args[1] = "-a"; + args[1] = "-c";
args[2] = "-c"; + args[2] = "PATH=@TERMUX_PREFIX@/bin:/system/bin";
memcpy(&args[3], argv, argc * sizeof(*args)); memcpy(&args[3], argv, argc * sizeof(*args));
args[argc + 3] = NULL; args[argc + 3] = NULL;
- printf("[$] su -p -c "); - printf("[$] su -p -c ");
+ printf("[$] tsu -a -c "); + printf("[$] su PATH=@TERMUX_PREFIX@/bin:/system/bin ");
for (int i = 0; i < argc; ++i) for (int i = 0; i < argc; ++i)
printf("%s%c", argv[i], i == argc - 1 ? '\n' : ' '); printf("%s%c", argv[i], i == argc - 1 ? '\n' : ' ');
- execvp("su", args);
+ execvp("tsu", args);
exit(errno);
}

8
packages/wireguard-tools/build.sh

@ -2,14 +2,14 @@ TERMUX_PKG_HOMEPAGE=https://www.wireguard.com
TERMUX_PKG_DESCRIPTION="Tools for the WireGuard secure network tunnel" TERMUX_PKG_DESCRIPTION="Tools for the WireGuard secure network tunnel"
TERMUX_PKG_LICENSE="GPL-2.0" TERMUX_PKG_LICENSE="GPL-2.0"
TERMUX_PKG_VERSION=1.0.20200510 TERMUX_PKG_VERSION=1.0.20200510
TERMUX_PKG_REVISION=1
TERMUX_PKG_SRCURL=https://git.zx2c4.com/wireguard-tools/snapshot/wireguard-tools-$TERMUX_PKG_VERSION.tar.xz TERMUX_PKG_SRCURL=https://git.zx2c4.com/wireguard-tools/snapshot/wireguard-tools-$TERMUX_PKG_VERSION.tar.xz
TERMUX_PKG_SHA256=cd526c7ea177e59ae4c0ebc4f3cc360b8524881b090d043426bdf7e3c85ac8e7 TERMUX_PKG_SHA256=cd526c7ea177e59ae4c0ebc4f3cc360b8524881b090d043426bdf7e3c85ac8e7
TERMUX_PKG_DEPENDS="tsu"
TERMUX_PKG_BUILD_IN_SRC=true TERMUX_PKG_BUILD_IN_SRC=true
TERMUX_PKG_EXTRA_MAKE_ARGS=" -C src WITH_BASHCOMPLETION=yes WITH_WGQUICK=no WITH_SYSTEMDUNITS=no" TERMUX_PKG_EXTRA_MAKE_ARGS=" -C src WITH_BASHCOMPLETION=yes WITH_WGQUICK=no WITH_SYSTEMDUNITS=no"
termux_step_post_make_install() { termux_step_post_make_install() {
cd src/wg-quick cd src/wg-quick
$CC $CFLAGS $LDFLAGS -DWG_CONFIG_SEARCH_PATHS="\"$TERMUX_ANDROID_HOME/.wireguard $TERMUX_PREFIX/etc/wireguard /data/misc/wireguard /data/data/com.wireguard.android/files\"" -o wg-quick android.c $CC $CFLAGS $LDFLAGS -DWG_CONFIG_SEARCH_PATHS="\"$TERMUX_ANDROID_HOME/.wireguard $TERMUX_PREFIX/etc/wireguard /data/misc/wireguard /data/data/com.wireguard.android/files\"" -o wg-quick android.c
install -Dm0700 wg-quick $TERMUX_PREFIX/bin/wg-quick install -Dm0700 wg-quick $TERMUX_PREFIX/bin/wg-quick
} }

Loading…
Cancel
Save