KASM-1209 Check for host modules

This commit is contained in:
Justin Travis 2023-12-28 19:13:07 -05:00
parent efa319d2eb
commit 3cd02e4952
No known key found for this signature in database
3 changed files with 39 additions and 19 deletions

View File

@ -5,7 +5,17 @@ This Image contains a browser-accessible version of [Redroid](https://github.com
![Screenshot][Image_Screenshot] ![Screenshot][Image_Screenshot]
[Image_Screenshot]: https://f.hubspotusercontent30.net/hubfs/5856039/dockerhub/image-screenshots/redroid.png "Image Screenshot" [Image_Screenshot]: https://f.hubspotusercontent30.net/hubfs/5856039/dockerhub/image-screenshots/redroid.png "Image Screenshot"
## Important !!
This image requires host level kernel modules to be installed and loaded.
See [Redroid Docs](https://github.com/remote-android/redroid-doc?tab=readme-ov-file#getting-started) for more details
# Environment Variables # Environment Variables
* `APP_ARGS` - Additional arguments to pass to the application when launched. * `REDROID_GPU_GUEST_MODE` - Used to instruct redroid to utilize GPU rendering. Options are `auto`, `guest`, and `host`
* `REDROID_FPS` - Set the maximum FPS for redroid and scrcpy
* `REDROID_WIDTH` - Set the desired width of the redroid device
* `REDROID_HEIGHT` - Set the desired height of the redroid device
* `REDROID_DPI` - Set the desired DPI of the redroid device
* `REDROID_SHOW_CONSOLE` - Display the scrcpy console after launching the redroid device.

View File

@ -1,9 +1,9 @@
# Live Demo # Live Demo
<a href="https://app.kasmweb.com/#/cast/5361455650" target="_blank"><img src="https://info.kasmweb.com/hubfs/dockerhub/GIFs/qbittorrent.gif" width="640" height="360"></a> <a href="https://app.kasmweb.com/#/cast/5361455650" target="_blank"><img src="https://info.kasmweb.com/hubfs/dockerhub/GIFs/redroid.gif" width="640" height="360"></a>
**Launch a real-time demo in a new browser window:** <a href="https://app.kasmweb.com/#/cast/5361455650" target="_blank">Live Demo</a>. **Launch a real-time demo in a new browser window:** <a href="https://app.kasmweb.com/#/cast/5361455650" target="_blank">Live Demo</a>.
<a href="https://app.kasmweb.com/#/cast/5361455650" target="_blank"><img src="https://5856039.fs1.hubspotusercontent-na1.net/hub/5856039/hubfs/dockerhub/casting-buttons/Qbittorrent.png" width="300" height="104"></a> <a href="https://app.kasmweb.com/#/cast/5361455650" target="_blank"><img src="https://5856039.fs1.hubspotusercontent-na1.net/hub/5856039/hubfs/dockerhub/casting-buttons/redroid.png" width="300" height="104"></a>
&lowast;*Note: Demo is limited to 3 minutes and has upload/downloads restricted for security purposes.* &lowast;*Note: Demo is limited to 3 minutes and has upload/downloads restricted for security purposes.*

View File

@ -7,32 +7,44 @@ DEFAULT_ARGS="-n"
ARGS=${APP_ARGS:-$DEFAULT_ARGS} ARGS=${APP_ARGS:-$DEFAULT_ARGS}
ANDROID_VERSION=${ANDROID_VERSION:-"13.0.0"} ANDROID_VERSION=${ANDROID_VERSION:-"13.0.0"}
REDROID_GPU_GUEST_MODE=${REDROID_GPU_GUEST_MODE:-"guest"} REDROID_GPU_GUEST_MODE=${REDROID_GPU_GUEST_MODE:-"guest"}
REDROID_FPS=${REDROID_FPS:-"60"} REDROID_FPS=${REDROID_FPS:-"30"}
REDROID_WIDTH=${REDROID_WIDTH:-"720"} REDROID_WIDTH=${REDROID_WIDTH:-"720"}
REDROID_HEIGHT=${REDROID_HEIGHT:-"1280"} REDROID_HEIGHT=${REDROID_HEIGHT:-"1280"}
REDROID_DPI=${REDROID_DPI:-"320"} REDROID_DPI=${REDROID_DPI:-"320"}
REDROID_SHOW_CONSOLE=${REDROID_SHOW_CONSOLE:-"1"} REDROID_SHOW_CONSOLE=${REDROID_SHOW_CONSOLE:-"1"}
ICON_ERROR="/usr/share/icons/ubuntu-mono-dark/status/22/system-devices-panel-alert.svg"
LAUNCH_CONFIG='/dockerstartup/redroid_launch_selections.json' LAUNCH_CONFIG='/dockerstartup/redroid_launch_selections.json'
# Launch Config Based Workflow # Launch Config Based Workflow
if [ -e ${LAUNCH_CONFIG} ]; then if [ -e ${LAUNCH_CONFIG} ]; then
ANDROID_VERSION="$(jq -r '.android_version' ${LAUNCH_CONFIG})" ANDROID_VERSION="$(jq -r '.android_version' ${LAUNCH_CONFIG})"
fi fi
function audio_patch() {
# The devices start with audio quite low
set +e
for ((i=1; i<=10; i++)); do
adb -s localhost:5555 shell input keyevent KEYCODE_VOLUME_UP &
sleep 0.2
done
set -e
function check_modules() {
if lsmod | grep -q binder_linux; then
echo "binder_linux module is loaded."
else
msg="Host level module binder_linux is not loaded. Cannot continue.\nSee https://github.com/remote-android/redroid-doc?tab=readme-ov-file#getting-started for more details."
echo msg
notify-send -u critical -t 0 -i "${ICON_ERROR}" "Redroid Error" "${msg}"
exit 1
fi
# Check for ashmem_linux module
if lsmod | grep -q ashmem_linux; then
echo "ashmem_linux module is loaded."
else
msg="Host level module ashmem_linux is not loaded. Cannot continue.\nSee https://github.com/remote-android/redroid-doc?tab=readme-ov-file#getting-started for more details."
echo msg
notify-send -u critical -t 0 -i "${ICON_ERROR}" "Redroid Error" "${msg}"
exit 1
fi
} }
start_android() { start_android() {
/usr/bin/filter_ready
/usr/bin/desktop_ready
sleep 5 sleep 5
xfce4-terminal --hide-menubar --command "bash -c \"sudo docker pull redroid/redroid:${ANDROID_VERSION}-latest \"" xfce4-terminal --hide-menubar --command "bash -c \"sudo docker pull redroid/redroid:${ANDROID_VERSION}-latest \""
sudo docker run -itd --rm --privileged \ sudo docker run -itd --rm --privileged \
@ -48,7 +60,6 @@ start_android() {
sleep 2 sleep 2
adb connect localhost:5555 adb connect localhost:5555
sleep 5 sleep 5
audio_patch
} }
start_scrcpy() { start_scrcpy() {
@ -74,8 +85,6 @@ kasm_startup() {
do do
if ! pgrep -x $DOCKER_PGREP > /dev/null if ! pgrep -x $DOCKER_PGREP > /dev/null
then then
/usr/bin/filter_ready
/usr/bin/desktop_ready
set +e set +e
sudo /usr/bin/supervisord -n & sudo /usr/bin/supervisord -n &
set -e set -e
@ -83,8 +92,6 @@ kasm_startup() {
fi fi
if ! pgrep -x $SCRCPY_PGREP > /dev/null if ! pgrep -x $SCRCPY_PGREP > /dev/null
then then
/usr/bin/filter_ready
/usr/bin/desktop_ready
start_scrcpy start_scrcpy
fi fi
sleep 1 sleep 1
@ -95,4 +102,7 @@ kasm_startup() {
} }
/usr/bin/filter_ready
/usr/bin/desktop_ready
check_modules
kasm_startup kasm_startup