diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2017-12-11 11:51:25 +0100 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2017-12-11 11:51:25 +0100 |
commit | 489feff4f35682eb99c60aeb1446bda789889947 (patch) | |
tree | fe4521a915ce318352629e47db2b16eb64800512 | |
parent | Version bump (diff) | |
download | android_kernel_wireguard-489feff4f35682eb99c60aeb1446bda789889947.tar.xz android_kernel_wireguard-489feff4f35682eb99c60aeb1446bda789889947.zip |
Do not install addon.d if no directory
Some ROMs don't support this. While we're at it, add more error
reporting.
-rw-r--r-- | standalone-tools/installer.sh | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/standalone-tools/installer.sh b/standalone-tools/installer.sh index 84dacdc..c285e4c 100644 --- a/standalone-tools/installer.sh +++ b/standalone-tools/installer.sh @@ -47,19 +47,28 @@ echo "ui_print = by zx2c4 =" >&$OUTFD echo "ui_print = www.wireguard.com =" >&$OUTFD echo "ui_print ==================================" >&$OUTFD +[ -n $ARCH ] || die "Could not determine architecture" +[ -f "$ZIP" ] || die "Could not find zip file" + trap cleanup INT TERM EXIT mount_system +print "Extracting files" rm -rf /tmp/wireguard mkdir -p /tmp/wireguard -print "Extracting files" unzip -d /tmp/wireguard "$ZIP" -[ -d /tmp/wireguard/arch/$ARCH ] || die "Not available for device's ABI" + print "Installing WireGuard tools" -cp /tmp/wireguard/arch/$(getprop ro.product.cpu.abi)/* /system/xbin/ -cp /tmp/wireguard/addon.d/40-wireguard.sh /system/addon.d/ -chmod 755 /system/xbin/wg /system/xbin/wg-quick /system/addon.d/40-wireguard.sh +[ -d /tmp/wireguard/arch/$ARCH ] || die "Not available for device's ABI" +cp -f /tmp/wireguard/arch/$ARCH/* /system/xbin/ || die "Could not copy binaries" +chmod 755 /system/xbin/wg /system/xbin/wg-quick || die "Could not mark binaries as executable" + +if [ -d /system/addon.d ]; then + print "Installing ROM flash survial script" + cp -f /tmp/wireguard/addon.d/40-wireguard.sh /system/addon.d/ || die "Could not copy survival script" + chmod 755 /system/addon.d/40-wireguard.sh || die "Could not mark survival script as executable" +fi mkdir -pm 700 /data/misc/wireguard print "Success! Be sure your kernel has the WireGuard module enabled." |