From 5716e4312dc4c687efeb4814dd6f92595a093605 Mon Sep 17 00:00:00 2001 From: Danielle McLean Date: Wed, 15 Aug 2018 15:26:53 +1000 Subject: [PATCH] Add an 'andromeda' script which activates the Andromeda backend for Substratum (requires adb, naturally) --- local/bin/andromeda | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100755 local/bin/andromeda diff --git a/local/bin/andromeda b/local/bin/andromeda new file mode 100755 index 0000000..ab8b5c4 --- /dev/null +++ b/local/bin/andromeda @@ -0,0 +1,32 @@ +#!/bin/zsh +print >&2 "Andromeda Start Shell Script + +This requires projekt.andromeda to be installed on the device. +Make sure the device is connected and ADB option enabled. +Please only have one device connected at a time to use this!" + +shell() { + adb shell "$@" || exit $? +} + +# Let's first grab the location where Andromeda is installed +pkg="$(shell pm path projekt.andromeda)" +pkg=${pkg#package:} + +# Quit Substratum if it's running. +shell am force-stop projekt.substratum + +# If Andromeda is already running, we have to kill it rather than just force-stop it. :( +pid="$(shell pidof andromeda)" +if [[ -n $pid ]]; then + print "Existing Andromeda process found with PID $pid, killing..." >&2 + # Additionally, Andromeda only responds to SIGKILL, not SIGTERM, which is absolutely disgusting. + shell kill -9 $pid +fi + +print "Launching Andromeda..." >&2 +shell </dev/null 2>&1 & +EOF