diff options
| author | dario-loi <77234595+dario-loi@users.noreply.github.com> | 2024-11-26 22:39:43 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-11-26 22:39:43 +0100 |
| commit | 19ae0e7c82275831531429c3cfabd6810c311185 (patch) | |
| tree | 487fd817ccc0e1ac6c6c5112366553bb53ee2096 /fbgl_test_virtual_fb.sh | |
| parent | 7016d298ed1a5faf274ea5d300d7aea9dbc68b56 (diff) | |
| parent | 449ea58099de8fac62aae389b4ea2808a6ef66f3 (diff) | |
Merge branch 'lvntky:master' into master
Diffstat (limited to 'fbgl_test_virtual_fb.sh')
| -rw-r--r-- | fbgl_test_virtual_fb.sh | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/fbgl_test_virtual_fb.sh b/fbgl_test_virtual_fb.sh new file mode 100644 index 0000000..501b7e1 --- /dev/null +++ b/fbgl_test_virtual_fb.sh @@ -0,0 +1,42 @@ +#!/bin/bash + +# Check if Xvfb is installed +if ! command -v Xvfb &> /dev/null; then + echo "Xvfb not found. Install it with your package manager (e.g., sudo pacman -S xorg-server-xvfb)." + exit 1 +fi + +# Set variables +PRECOMPILED_BINARY="./fbgl_test" # Replace with your precompiled binary's path +DISPLAY_NUMBER=":99" # Virtual framebuffer display number + +# Check if the precompiled binary exists +if [ ! -f "$PRECOMPILED_BINARY" ]; then + echo "Precompiled binary '$PRECOMPILED_BINARY' not found." + exit 1 +fi + +# Start virtual framebuffer +echo "Starting Xvfb on display ${DISPLAY_NUMBER}..." +Xvfb $DISPLAY_NUMBER -screen 0 1024x768x24 & +XVFB_PID=$! + +# Wait for Xvfb to start +sleep 2 + +# Set the DISPLAY environment variable +export DISPLAY=$DISPLAY_NUMBER + +# Run the precompiled binary inside the virtual framebuffer +echo "Running $PRECOMPILED_BINARY in the virtual framebuffer environment..." +$PRECOMPILED_BINARY + +# Capture the exit code of the binary +BINARY_EXIT_CODE=$? + +# Stop Xvfb +echo "Stopping Xvfb..." +kill $XVFB_PID + +# Exit with the binary's exit code +exit $BINARY_EXIT_CODE |
