aboutsummaryrefslogtreecommitdiffstats
path: root/standalone-tools/Makefile
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2017-12-18 22:10:36 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2017-12-18 22:10:36 +0100
commit3b6ade940d7db3650a63d5efa65c3fecfc7f9ab2 (patch)
tree12938c0da75ae9c8d0a4114640e7ab2a68652a96 /standalone-tools/Makefile
parentwg-quick: get proper command output status (diff)
downloadandroid_kernel_wireguard-3b6ade940d7db3650a63d5efa65c3fecfc7f9ab2.tar.xz
android_kernel_wireguard-3b6ade940d7db3650a63d5efa65c3fecfc7f9ab2.zip
standalone-tools: add make push
Diffstat (limited to '')
-rw-r--r--standalone-tools/Makefile12
1 files changed, 10 insertions, 2 deletions
diff --git a/standalone-tools/Makefile b/standalone-tools/Makefile
index 1e49b07..340233a 100644
--- a/standalone-tools/Makefile
+++ b/standalone-tools/Makefile
@@ -4,7 +4,8 @@
ARCHS := $(shell ndk-build NDK_PROJECT_PATH=$(PWD)/build APP_BUILD_SCRIPT=$(PWD)/../Android.mk APP_PLATFORM=21 DUMP_NDK_KNOWN_DEVICE_ABIS 2>/dev/null)
-all: wireguard-tools.zip
+help:
+ @echo "Type \`make zip' to create a flashable zip, or type \`make push' to push tools to a running device using adb."
clean:
rm -rf build wireguard-tools.zip
@@ -27,5 +28,12 @@ wireguard-tools.zip: $(foreach ARCH,$(ARCHS),build/libs/$(ARCH)/wg-quick build/l
$(ANDROID_HOME)/build-tools/27.0.1/zipalign -v -p 4 build/unaligned-$@ build/aligned-$@
$(ANDROID_HOME)/build-tools/27.0.1/apksigner sign --key build/key.pk8 --cert build/cert.pem --min-sdk-version 21 --out $@ build/aligned-$@
-.PHONY: clean all
+zip: wireguard-tools.zip
+
+push: $(foreach ARCH,$(ARCHS),build/libs/$(ARCH)/wg-quick build/libs/$(ARCH)/wg)
+ ARCH="$$(adb shell 'su -c "mount -o rw,remount /system" && getprop ro.product.cpu.abi')" && \
+ adb push "build/libs/$$ARCH/wg-quick" "build/libs/$$ARCH/wg" /sdcard && \
+ adb shell 'su -c "mv /sdcard/wg /sdcard/wg-quick /system/xbin/ && chmod 755 /system/xbin/wg /system/xbin/wg-quick"'
+
+.PHONY: clean zip push
.SECONDARY: