Skip to content

Instantly share code, notes, and snippets.

@viyatb
Created October 22, 2015 06:09
Show Gist options
  • Save viyatb/bd3b17046ffffc5e8ba8 to your computer and use it in GitHub Desktop.
Save viyatb/bd3b17046ffffc5e8ba8 to your computer and use it in GitHub Desktop.
Genymotion scripts

Helper scripts for genymotion and android development

#!/usr/bin/env bash
# script geny_devices.sh
s3_43="e63063e8-a922-4832-8bcf-05362c3a1c9a"
nexus_44="45287ed9-2d5e-49a5-a0f9-82c29e7cc4b3"
# Samsung Galaxy S3 - 4.3 - API 18 - 720x1280" {e63063e8-a922-4832-8bcf-05362c3a1c9a}
# "Google Nexus 7 - 4.4.4 - API 19 - 800x1280" {45287ed9-2d5e-49a5-a0f9-82c29e7cc4b3}
#!/usr/bin/env bash
#script geny_snap.sh
source geny_devices.sh
VM=${s3_43}
# Hopefully performance improvement ;) Not really necessary
# for in in {1..254};
# do ping -c 192.168.56.$1 2&>1;
# done
MAC=`VBoxManage showvminfo ${VM} | grep MAC | awk -F ":" '{print $3}' | cut -c 2-13`
# echo "MAC is ${MAC}"
# On linux data returned from arp -a is like
# ? (192.168.56.101) at 08:00:27:b0:7f:38 [ether] on vboxnet0
# ? (192.168.0.1) at 9e:a9:e4:d5:43:5b [ether] on eth2
# Find IP with
IP=`arp -a | egrep vboxnet|grep -E -o "([0-9]{1,3}[\.]){3}[0-9]{1,3}"`
# echo "IP is $IP"
IP=`echo $IP | cut -d "(" -f2 | cut -d ")" -f1`
# echo $IP|xclip
# echo -e "[OK] IP \t:\t ${IP}
# IP exported as global variable and to the clipboard."
echo $IP
#!/usr/bin/env bash
# script geny_save.sh
source geny_devices.sh
VM=${s3_43}
echo "VM is \"$VM\""
VBoxManage snapshot $VM restore snap1 &
#!/usr/bin/env bash
# script geny_start.sh
source geny_devices.sh
VM=${s3_43}
echo "VM is \"$VM\""
VBoxManage snapshot $VM restore snap1 &
VBoxHeadless -s $VM &
IP=`./geny_ip.sh`
echo ">>>>>>" $IP
adb tcpip 5555
adb connect $IP:5555
#restart adb as root to allow powering it off
#root mode is generally what we want from a headless emulator (to download emma files for instance)
adb root
adb connect $IP #:5555
#!/usr/bin/env bash
#script geny_stop.sh
IP=`./geny_ip.sh`
adb root
adb connect $IP:5555
adb shell reboot -p &
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment