forked from rickfarmer/android-vm
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathprovision.sh
executable file
·170 lines (146 loc) · 6.14 KB
/
provision.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
#!/usr/bin/env bash
echo " "
echo "***** Installing System Tools... *****"
echo " "
sudo apt-get -y --force-yes update >/dev/null 2>&1
sudo apt-get -y --force-yes install curl >/dev/null 2>&1
sudo apt-get -y --force-yes install unzip >/dev/null 2>&1
sudo apt-get -y --force-yes install libc6-i386 lib32stdc++6 lib32gcc1 lib32ncurses5 >/dev/null 2>&1
sudo apt-get -y --force-yes update >/dev/null 2>&1
sudo apt-get -y --force-yes install apt-file && apt-file update
sudo apt-get -y --force-yes install python-software-properties >/dev/null 2>&1
# http://askubuntu.com/questions/147400/problems-with-eclipse-and-android-sdk
sudo apt-get -y --force-yes install ia32-libs >/dev/null 2>&1
echo " "
echo "***** Installing Vbox guest utils (for high res support) *****"
echo " "
sudo apt-get -y --force-yes install virtualbox-guest-utils virtualbox-guest-x11 virtualbox-guest-dkms
echo " "
echo "***** Installing git... *****"
sudo apt-get -y --force-yes install git
# Install a desktop for the Android graphical tooling, e.g. Eclipse
#echo "What is your preferred Ubuntu desktop?"
#echo "1) Unity desktop (Ubuntu default)"
#echo "2) Gnome desktop"
#echo "3) Gnome Classic desktop"
#echo "4) xfce (lightweight desktop)"
#echo "5) KDE desktop"
#echo "6) Do not install a desktop (use the command line interface only)"
#read case;
#case $case in
# 1) echo "Installing Unity desktop..." | sudo aptitude install -y --without-recommends ubuntu-desktop >/dev/null 2>&1;;
# 2) echo "Installing Gnome desktop..." | sudo apt-get install -y ubuntu-desktop >/dev/null 2>&1;;
# 3) echo "Installing Gnome Classic desktop..." | sudo apt-get install -y gnome-panel >/dev/null 2>&1;;
# 4) echo "Installing xfce lightweight desktop..." | sudo apt-get install -y xubuntu-desktop >/dev/null 2>&1;;
# 5) echo "Installing KDE desktop..." | sudo apt-get install -y kubuntu-desktop >/dev/null 2>&1;;
# 6) exit
#esac
echo " "
echo "***** Installing Ubuntu Unity Desktop... *****"
echo " "
sudo aptitude install -y --without-recommends ubuntu-desktop >/dev/null 2>&1
# Or, the following desktop...
#echo "Installing Ubuntu Gnome Desktop..."
#sudo apt-get install -y ubuntu-desktop >/dev/null 2>&1
# Or, the following desktop...
#echo "Installing Ubuntu xfce lightweight desktop..."
#sudo apt-get install -y xubuntu-desktop >/dev/null 2>&1
# Or, the following desktop...
#echo "Installing Ubuntu KDE Desktop..."
#sudo apt-get install -y kubuntu-desktop >/dev/null 2>&1
echo " "
echo "***** Installing Android Studio *****"
echo " "
sudo mkdir /usr/local/android
sudo mkdir /usr/local/android/android_studio
cd /tmp
sudo curl -O https://dl.google.com/dl/android/studio/ide-zips/1.1.0/android-studio-ide-135.1740770-linux.zip
sudo unzip /tmp/android-studio-ide-135.1740770-linux.zip >/dev/null 2>&1
sudo mv /tmp/android-studio /usr/local/android/android_studio/
sudo rm -rf /tmp/android-studio-ide-135.1740770-linux.zip
echo " "
echo "***** Installing the Android SDK and Build Tools *****"
echo " "
sudo curl -O http://dl.google.com/android/android-sdk_r24.1.2-linux.tgz
sudo tar zxvf android-sdk_r24.1.2-linux.tgz
cd /tmp/android-sdk-linux/tools
echo "y" | sudo ./android update sdk --no-ui --filter 1,2,3,4,24,35,36,41,42,43,21,tool,platform-tool,doc
cd /tmp/
sudo mv /tmp/android-sdk-linux /usr/local/android/sdk/
sudo rm -rf /tmp/android-sdk_r24.1.2-linux.tgz
echo " "
echo "***** Installing Android NDK... *****"
echo " "
cd /tmp
sudo curl -O http://dl.google.com/android/ndk/android-ndk-r9-linux-x86_64.tar.bz2
sudo tar -jxf /tmp/android-ndk-r9-linux-x86_64.tar.bz2 >/dev/null 2>&1
sudo mv /tmp/android-ndk-r9 /usr/local/android/ndk
sudo rm -rf /tmp/android-ndk-r9-linux-x86_64.tar.bz2
sudo mkdir /usr/local/android/sdk/add-ons
sudo chmod -R 755 /usr/local/android
sudo ln -s /usr/local/android/sdk/tools/android /usr/bin/android
sudo ln -s /usr/local/android/sdk/platform-tools/adb /usr/bin/adb
echo " "
echo "***** Updating ANDROID_HOME... *****"
echo " "
cd ~/
cat << End >> .profile
export ANDROID_HOME="/usr/local/android/sdk"
export PATH=$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools:$PATH
End
echo " "
echo "***** Adding USB device driver information... *****"
echo "For more detail see http://developer.android.com/tools/device.html"
echo " "
sudo cp /vagrant/51-android.rules /etc/udev/rules.d
sudo chmod a+r /etc/udev/rules.d/51-android.rules
sudo service udev restart
sudo android update adb
sudo adb kill-server
sudo adb start-server
echo " "
echo " "
echo " "
echo "[ Next Steps ]================================================================"
echo " "
echo "1. Manually setup a USB connection for your Android device to the new VM"
echo " "
echo " If using VMware Fusion (for example, will be similar for VirtualBox):"
echo " 1. Plug your android device hardware into the computers USB port"
echo " 2. Open the 'Virtual Machine Library'"
echo " 3. Select the VM, e.g. 'android-vm: default', right-click and choose"
echo " 'Settings...'"
echo " 4. Select 'USB & Bluetooth', check the box next to your device and set"
echo " the 'Plug In Action' to 'Connect to Linux'"
echo " 5. Plug the device into the USB port and verify that it appears when "
echo " you run 'lsusb' from the command line"
echo " "
echo "2. Your device should appear when running 'lsusb' enabling you to use adb, e.g."
echo " "
echo " $ adb devices"
echo " ex. output,"
echo " List of devices attached"
echo " 007jbmi6 device"
echo " "
echo " $ adb shell"
echo " i.e. to log into the device (be sure to enable USB debugging on the device)"
echo " "
echo "See the included README.md for more detail on how to run and work with this VM."
echo " "
echo "[ Start your Ubuntu VM ]======================================================"
echo " "
echo "To start the VM, "
echo " To use with VirtualBox (free),"
echo " "
echo " $ vagrant up"
echo " "
echo " To use with VMware Fusion (OS X) (requires paid plug-in),"
echo " "
echo " $ vagrant up --provider=vmware_fusion"
echo " "
echo " To use VMware Workstation (Windows, Linux) (requires paid plug-in),"
echo " "
echo " $ vagrant up --provider=vmware_workstation"
echo " "
echo " "
echo "See the included README.md for more detail on how to run and work with this VM."