chiark / gitweb /
Merge branch 'master' into 'master'
[fdroidserver.git] / docker / entrypoint.sh
1 #!/bin/bash
2
3 if [[ $EMULATOR == "" ]]; then
4     EMULATOR="android-19"
5     echo "Using default emulator $EMULATOR"
6 fi
7
8 if [[ $ARCH == "" ]]; then
9     ARCH="x86"
10     echo "Using default arch $ARCH"
11 fi
12 echo EMULATOR  = "Requested API: ${EMULATOR} (${ARCH}) emulator."
13 if [[ -n $1 ]]; then
14     echo "Last line of file specified as non-opt/last argument:"
15     tail -1 $1
16 fi
17
18 # Run sshd
19 /usr/sbin/sshd
20 adb start-server
21
22 # Detect ip and forward ADB ports outside to outside interface
23 ip=$(ifconfig  | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}')
24 socat tcp-listen:5037,bind=$ip,fork tcp:127.0.0.1:5037 &
25 socat tcp-listen:5554,bind=$ip,fork tcp:127.0.0.1:5554 &
26 socat tcp-listen:5555,bind=$ip,fork tcp:127.0.0.1:5555 &
27
28 # Set up and run emulator
29 if [[ $ARCH == *"x86"* ]]
30 then
31     EMU="x86"
32 else
33     EMU="arm"
34 fi
35
36 #FASTDROID_VNC_URL="https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/fastdroid-vnc/fastdroid-vnc"
37 #wget -c "${FASTDROID_VNC_URL}"
38
39 export PATH="${PATH}:/usr/local/android-sdk/tools/:/usr/local/android-sdk/platform-tools/"
40
41 echo "no" | android create avd -f -n test -t ${EMULATOR} --abi default/${ARCH}
42 echo "no" | emulator64-${EMU} -avd test -noaudio -no-window -gpu off -verbose -qemu -usbdevice tablet -vnc :0