From 3eaaff60a51dd967c9883251e40bc4124a432da4 Mon Sep 17 00:00:00 2001
From: Ciro Santilli <ciro.santilli@savoirfairelinux.com>
Date: Fri, 29 Jan 2016 15:07:50 +0100
Subject: [PATCH] Android install script, fix redirection or ubuntu run script

---
 README.md                                   | 12 ++++++++++++
 ubuntu-15.10-android-install-all-devices.sh |  6 ++++++
 ubuntu-15.10-run.sh                         |  4 ++--
 3 files changed, 20 insertions(+), 2 deletions(-)
 create mode 100755 ubuntu-15.10-android-install-all-devices.sh

diff --git a/README.md b/README.md
index 155f9ccc..87c60f0a 100644
--- a/README.md
+++ b/README.md
@@ -19,3 +19,15 @@ Run daemon and client on background:
 Stop daemon and client:
 
     ./ubuntu-15.10-stop.sh
+
+## Ubuntu 15.10 host Android device
+
+First ensure that you can build and install a minimal Android App on your device, e.g. <https://github.com/cirosantilli/android-cheat/tree/214fab34bb0e1627ac73e43b72dee7d1f8db7bfb/min>
+
+This will at least require installing the SDK.
+
+All executables used must be in your `PATH`, e.g. `adb`.
+
+Then build and install on all devices with:
+
+    ./ubuntu-15.10-android-install-all-devices.sh
diff --git a/ubuntu-15.10-android-install-all-devices.sh b/ubuntu-15.10-android-install-all-devices.sh
new file mode 100755
index 00000000..5aebefad
--- /dev/null
+++ b/ubuntu-15.10-android-install-all-devices.sh
@@ -0,0 +1,6 @@
+#!/usr/bin/env bash
+# Build the Android app and install it on all connected devices.
+cd client-android
+./compile.sh
+# From: http://stackoverflow.com/questions/8610733/how-can-i-adb-install-an-apk-to-multiple-connected-devices
+adb devices | tail -n +2 | cut -sf 1 | xargs -i'{}' adb -s '{}' install ring-android/app/build/outputs/apk/app-debug.apk
diff --git a/ubuntu-15.10-run.sh b/ubuntu-15.10-run.sh
index ecbf82ad..340324f2 100755
--- a/ubuntu-15.10-run.sh
+++ b/ubuntu-15.10-run.sh
@@ -1,7 +1,7 @@
 #!/usr/bin/env bash
 # Run local install daemon and client that have\
 # been installed with the install script on the background.
-./install/daemon/libexec/dring 2>&1 >>daemon.log &
+./install/daemon/libexec/dring >>daemon.log 2>&1 &
 echo $! >daemon.pid
-LD_LIBRARY_PATH="$LD_LIBRARY_PATH:install/lrc/lib" ./install/client-gnome/bin/gnome-ring 2>&1 >>client-gnome.log &
+LD_LIBRARY_PATH="$LD_LIBRARY_PATH:install/lrc/lib" ./install/client-gnome/bin/gnome-ring >>client-gnome.log 2>&1 &
 echo $! >client-gnome.pid
-- 
GitLab