This commit is contained in:
2022-05-17 01:56:44 +03:00
commit 3a9b8c8468
117 changed files with 7175 additions and 0 deletions
+3
View File
@@ -0,0 +1,3 @@
tmp/*
chromedriver*
*.apk
+93
View File
@@ -0,0 +1,93 @@
FROM golang:1.17 as go
COPY tmp/devtools /devtools
RUN \
apt-get update && \
apt-get install -y upx-ucl libx11-dev && \
cd /devtools && \
GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" && \
upx /devtools/devtools
FROM ubuntu:18.04
ARG APPIUM_VERSION="1.8.1"
RUN \
apt update && \
apt remove -y libcurl4 && \
apt install -y apt-transport-https ca-certificates tzdata locales libcurl4 curl gnupg && \
curl --silent --location https://deb.nodesource.com/setup_12.x | bash - && \
apt install -y --no-install-recommends \
curl \
iproute2 \
nodejs \
openjdk-8-jdk-headless \
unzip \
xvfb \
libpulse0 \
libxcomposite1 \
libxcursor1 \
libxi6 \
libasound2 \
fluxbox \
x11vnc \
feh \
wmctrl \
libglib2.0-0 && \
apt-get clean && \
rm -Rf /tmp/* && rm -Rf /var/lib/apt/lists/*
RUN cd / && npm install --prefix ./opt/ appium@$APPIUM_VERSION
COPY android.conf /etc/ld.so.conf.d/
COPY fluxbox/aerokube /usr/share/fluxbox/styles/
COPY fluxbox/init /root/.fluxbox/
COPY fluxbox/aerokube.png /usr/share/images/fluxbox/
COPY --from=go /devtools/devtools /usr/bin/
# Android SDK
ENV ANDROID_HOME /opt/android-sdk-linux
ENV PATH /opt/android-sdk-linux/platform-tools:/opt/android-sdk-linux/tools:/opt/android-sdk-linux/tools/bin:/opt/android-sdk-linux/emulator:$PATH
ENV LD_LIBRARY_PATH ${ANDROID_HOME}/emulator/lib64:${ANDROID_HOME}/emulator/lib64/gles_swiftshader:${ANDROID_HOME}/emulator/lib64/qt/lib:${ANDROID_HOME}/emulator/lib64/vulkan:${LD_LIBRARY_PATH}
ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64
ARG ANDROID_DEVICE=""
ARG REPLACE_IMG="y"
ARG AVD_NAME="android6.0-1"
ARG BUILD_TOOLS="build-tools;23.0.1"
ARG PLATFORM="android-23"
ARG EMULATOR_IMAGE="system-images;android-23;default;x86"
ARG EMULATOR_IMAGE_TYPE="default"
ARG ANDROID_ABI="x86"
ARG SDCARD_SIZE="500"
ARG USERDATA_SIZE="500"
RUN \
curl -o sdk-tools.zip https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip && \
mkdir -p /opt/android-sdk-linux /root/.config/Android\ Open\ Source\ Project/ && \
unzip -q sdk-tools.zip -d /opt/android-sdk-linux && \
rm sdk-tools.zip && \
yes | sdkmanager --licenses
RUN \
sdkmanager "emulator" "tools" "platform-tools" "$BUILD_TOOLS" "platforms;$PLATFORM" "$EMULATOR_IMAGE" && \
mksdcard "$SDCARD_SIZE"M sdcard.img && \
echo "no" | ( \
([ -n "$ANDROID_DEVICE" ] && avdmanager create avd -n "$AVD_NAME" -k "$EMULATOR_IMAGE" --abi "$ANDROID_ABI" --device "$ANDROID_DEVICE" --sdcard /sdcard.img ) || \
avdmanager create avd -n "$AVD_NAME" -k "$EMULATOR_IMAGE" --abi "$ANDROID_ABI" --sdcard /sdcard.img \
) && \
ldconfig && \
( \
resize2fs /root/.android/avd/$AVD_NAME.avd/userdata.img "$USERDATA_SIZE"M || \
/opt/android-sdk-linux/emulator/qemu-img resize -f raw /root/.android/avd/$AVD_NAME.avd/userdata.img "$USERDATA_SIZE"M \
) && \
([ -z "$REPLACE_IMG" ] || mv /root/.android/avd/$AVD_NAME.avd/userdata.img /root/.android/avd/$AVD_NAME.avd/userdata-qemu.img ) && \
rm /opt/android-sdk-linux/system-images/$PLATFORM/$EMULATOR_IMAGE_TYPE/"$ANDROID_ABI"/userdata.img
COPY ["Emulator.conf", "/root/.config/Android Open Source Project/Emulator.conf"]
COPY emulator-snapshot.sh tmp/chromedriver* *.apk /usr/bin/
# Entrypoint
COPY tmp/entrypoint.sh /
ENTRYPOINT ["/entrypoint.sh"]
+2
View File
@@ -0,0 +1,2 @@
[General]
showNestedWarning=false
+2
View File
@@ -0,0 +1,2 @@
/opt/android-sdk-linux/emulator/lib64
/opt/android-sdk-linux/emulator/lib64/gles_swiftshader
+16
View File
@@ -0,0 +1,16 @@
#!/bin/bash
MAX_ATTEMPTS=5
adb root
adb devices | grep emulator | cut -f1 | while read id; do
apks=(/usr/bin/*.apk)
for apk in "${apks[@]}"; do
if [ -r "$apk" ]; then
for i in `seq 1 ${MAX_ATTEMPTS}`; do
echo "Installing $apk (attempt #$i of $MAX_ATTEMPTS)"
adb -s "$id" install -r "$apk" && break || sleep 15 && echo "Retrying to install $apk"
done
fi
done
adb -s "$id" emu kill -2 || true
done
rm -f /tmp/.X99-lock || true
+88
View File
@@ -0,0 +1,88 @@
#!/bin/bash
CHROMEDRIVER_PORT=9515
BOOTSTRAP_PORT=4725
EMULATOR=emulator-5554
APPIUM_ARGS=${APPIUM_ARGS:-""}
EMULATOR_ARGS=${EMULATOR_ARGS:-""}
PORT=${PORT:-"4444"}
DISPLAY_NUM=99
export DISPLAY=":$DISPLAY_NUM"
SCREEN_RESOLUTION=${SCREEN_RESOLUTION:-"1920x1080x24"}
SKIN=${SKIN:-"1080x1920"}
STOP=""
VERBOSE=${VERBOSE:-""}
if [ -z "$VERBOSE" ]; then
if [ -z "$APPIUM_ARGS" ]; then
APPIUM_ARGS="--log-level error"
fi
else
EMULATOR_ARGS="$EMULATOR_ARGS -verbose"
fi
clean() {
STOP="yes"
if [ -n "$APPIUM_PID" ]; then
kill -TERM "$APPIUM_PID"
fi
if [ -n "$EMULATOR_PID" ]; then
kill -TERM "$EMULATOR_PID"
fi
if [ -n "$X11VNC_PID" ]; then
kill -TERM "$X11VNC_PID"
fi
if [ -n "$DEVTOOLS_PID" ]; then
kill -TERM "$DEVTOOLS_PID"
fi
if [ -n "$XVFB_PID" ]; then
kill -TERM "$XVFB_PID"
fi
}
trap clean SIGINT SIGTERM
/usr/bin/xvfb-run -e /dev/stdout -l -n "$DISPLAY_NUM" -s "-ac -screen 0 $SCREEN_RESOLUTION -noreset -listen tcp" /usr/bin/fluxbox -display "$DISPLAY" -log /tmp/fluxbox.log 2>/dev/null &
XVFB_PID=$!
retcode=1
until [ $retcode -eq 0 ] || [ -n "$STOP" ]; do
DISPLAY="$DISPLAY" wmctrl -m >/dev/null 2>&1
retcode=$?
if [ $retcode -ne 0 ]; then
echo Waiting X server...
sleep 0.1
fi
done
if [ -n "$STOP" ]; then exit 0; fi
if [ "$ENABLE_VNC" != "true" ] && [ "$ENABLE_VIDEO" != "true" ]; then
EMULATOR_ARGS="$EMULATOR_ARGS -no-window"
fi
ANDROID_AVD_HOME=/root/.android/avd DISPLAY="$DISPLAY" /opt/android-sdk-linux/emulator/emulator ${EMULATOR_ARGS} -writable-system -no-boot-anim -no-audio -no-jni -avd @AVD_NAME@ -sdcard /sdcard.img -skin "$SKIN" -skindir /opt/android-sdk-linux/platforms/@PLATFORM@/skins/ -gpu swiftshader_indirect -ranchu -qemu -enable-kvm &
EMULATOR_PID=$!
if [ "$ENABLE_VNC" == "true" ]; then
x11vnc -display "$DISPLAY" -passwd selenoid -shared -forever -loop500 -rfbport 5900 -rfbportv6 5900 -logfile /tmp/x11vnc.log &
X11VNC_PID=$!
fi
while [ "$(adb shell getprop sys.boot_completed | tr -d '\r')" != "1" ] && [ -z "$STOP" ] ; do sleep 1; done
if [ -n "$STOP" ]; then exit 0; fi
DEFAULT_CAPABILITIES='"androidNaturalOrientation": true, "deviceName": "android", "platformName": "Android", "noReset": true, "udid":"'$EMULATOR'"'
if [ -n "@CHROME_MOBILE@" ]; then
while ip addr | grep inet | grep -q tentative > /dev/null; do sleep 0.1; done
DEFAULT_CAPABILITIES=$DEFAULT_CAPABILITIES', "chromedriverPort": '$CHROMEDRIVER_PORT
/usr/bin/devtools --android &
DEVTOOLS_PID=$!
fi
if [ -x "/usr/bin/chromedriver" ]; then
DEFAULT_CAPABILITIES=$DEFAULT_CAPABILITIES',"chromedriverExecutable": "/usr/bin/chromedriver"'
fi
/opt/node_modules/.bin/appium -a 0.0.0.0 -p "$PORT" -bp "$BOOTSTRAP_PORT" --log-timestamp --log-no-colors --command-timeout 90 --no-reset ${APPIUM_ARGS} --default-capabilities "{$DEFAULT_CAPABILITIES}" &
APPIUM_PID=$!
wait
+175
View File
@@ -0,0 +1,175 @@
###############################################################################
#
# name: aerokube (based on ubuntu_light)
# made: paultag
# date: 16-10-2010
# http://pault.ag/
#
############################################################## BACKGROUND ######
# background: flat
# background.color: #2c001e
# background.colorTo: #2c001e
background: fullscreen
background.pixmap: /usr/share/images/fluxbox/aerokube.png
############################################################## FONTS ##########
menu.frame.font: Ubuntu-10:bold
menu.title.font: Ubuntu-12:bold
toolbar.clock.font: Ubuntu-10:bold
toolbar.workspace.font: Ubuntu-12:bold
toolbar.iconbar.focused.font: Ubuntu-10:bold
toolbar.iconbar.unfocused.font: Ubuntu-10
window.font: Ubuntu-10
############################################################## MENU ###########
menu.bevelWidth: 1
#menu.itemHeight: 35
#menu.titleHeight: 21
menu.borderColor: #525252
menu.borderWidth: 1
menu.bullet: Triangle
menu.bullet.position: Right
menu.frame.underlineColor: #ffffff
menu.title: flat gradient rectangle
menu.title.justify: center
menu.title.color: #FFFFFF
menu.title.colorTo: #FFFFFF
menu.title.textColor: #333333
menu.frame: flat gradient crossdiagonal
menu.frame.justify: left
menu.frame.color: #FFFFFF
menu.frame.colorTo: #FFFFFF
menu.frame.textColor: #333333
menu.frame.disableColor: #aea79f
menu.hilite: flat gradient rectangle
menu.hilite.color: #aea79f
menu.hilite.colorTo: #aea79f
menu.hilite.textColor: #000000
############################################################## TOOLBAR ########
toolbar.bevelWidth: 0
toolbar.borderWidth: 1
toolbar.borderColor: #aea79f
toolbar.height: 20
toolbar.justify: center
toolbar: flat gradient rectangle
toolbar.pixmap:
toolbar.color: #aea79f
toolbar.colorTo: #aea79f
toolbar.clock: parentrelative
toolbar.clock.justify: center
toolbar.clock.color: #
toolbar.clock.colorTo: #
toolbar.clock.textColor: #333333
toolbar.workspace: parentrelative
toolbar.workspace.justify: Center
toolbar.workspace.color: #
toolbar.workspace.colorTo: #
toolbar.workspace.textColor: #333333
toolbar.button: parentrelative
toolbar.button.color: #333333
toolbar.button.colorTo: #333333
toolbar.button.picColor: #333333
toolbar.button.pressed: parentrelative
toolbar.button.pressed.color: #aea79f
toolbar.button.pressed.colorTo: #aea79f
toolbar.button.pressed.picColor: #000000
toolbar.iconbar.borderWidth: 1
toolbar.iconbar.borderColor: #333333
toolbar.iconbar.empty: parentrelative
toolbar.iconbar.empty.color: #
toolbar.iconbar.empty.colorTo: #
toolbar.iconbar.focused.borderWidth: 1
toolbar.iconbar.focused.borderColor: #333333
toolbar.iconbar.focused: flat gradient rectangle
toolbar.iconbar.focused.color: #FFFFFF
toolbar.iconbar.focused.colorTo: #FFFFFF
toolbar.iconbar.focused.textColor: #333333
toolbar.iconbar.focused.justify: center
toolbar.iconbar.unfocused.borderWidth: 1
toolbar.iconbar.unfocused.borderColor: #525252
toolbar.iconbar.unfocused: flat gradient rectangle
toolbar.iconbar.unfocused.color: #aea79f
toolbar.iconbar.unfocused.colorTo: #aea79f
toolbar.iconbar.unfocused.textColor: #444444
toolbar.iconbar.unfocused.justify: center
############################################################## WINDOW #########
window.roundCorners: TopRight TopLeft
window.bevelWidth: 4
window.shade: false
window.borderWidth: 1
window.borderColor: #333333
window.justify: Center
window.title.height: 21
window.title.focus: flat gradient rectangle
window.title.focus.color: #000000
window.title.focus.colorTo: #333333
window.title.unfocus: flat gradient rectangle
window.title.unfocus.color: #111111
window.title.unfocus.colorTo: #444444
window.label.focus: parentrelative
window.label.focus.color: #
window.label.focus.colorTo: #
window.label.focus.textColor: #FFFFFF
window.label.unfocus: parentrelative
window.label.unfocus.color: #
window.label.unfocus.colorTo: #
window.label.unfocus.textColor: #aea79f
window.button.focus: parentrelative
window.button.focus.color: #
window.button.focus.colorTo: #
window.button.focus.picColor: #FFFFFF
window.button.unfocus: parentrelative
window.button.unfocus.Color: #
window.button.unfocus.ColorTo: #
window.button.unfocus.picColor: #888888
window.button.pressed: parentrelative
window.button.pressed.color: #
window.button.pressed.colorTo: #
window.button.pressed.picColor: #000000
window.handle.focus: flat
window.handle.focus.color: #1f1f1f
window.handle.focus.colorTo: #1f1f1f
window.handle.unfocus: lat
window.handle.unfocus.color: #1f1f1f
window.handle.unfocus.colorTo: #1f1f1f
window.handleWidth: 2
window.grip.focus: flat
window.grip.focus.color: #525252
window.grip.focus.colorTo: #525252
window.grip.unfocus: flat
window.grip.unfocus.color: #1f1f1f
window.grip.unfocus.colorTo: #1f1f1f
###############################################################################
# EOF
Binary file not shown.

After

Width:  |  Height:  |  Size: 125 KiB

+7
View File
@@ -0,0 +1,7 @@
session.menuFile: ~/.fluxbox/menu
session.keyFile: ~/.fluxbox/keys
session.styleFile: /usr/share/fluxbox/styles/aerokube
session.configVersion: 13
session.screen0.strftimeFormat: %d %b, %a %02k:%M:%S
session.screen0.toolbar.visible: false
session.screen0.toolbar.tools: