mirror of
https://github.com/OPM/ResInsight.git
synced 2026-11-24 06:48:13 -06:00
34 lines
1.2 KiB
Bash
34 lines
1.2 KiB
Bash
#!/bin/sh
|
|
|
|
# Find the installation path. We assume that this script is placed in the installation directory.
|
|
INSTALL_PATH=$(dirname "$0")
|
|
|
|
# Store the users working directory
|
|
WORKING_DIR=`pwd`
|
|
|
|
# Change to application directory
|
|
cd "$INSTALL_PATH"
|
|
|
|
# When running headless on a system without a display server, Qt still needs an X server to create
|
|
# OpenGL contexts. Wrap the application in xvfb-run (X virtual framebuffer) when no display is available.
|
|
XVFB_RUN=""
|
|
if [ -z "$DISPLAY" ]; then
|
|
for arg in "$@"; do
|
|
if [ "$arg" = "--headless" ]; then
|
|
if command -v xvfb-run >/dev/null 2>&1; then
|
|
XVFB_RUN="xvfb-run -a"
|
|
else
|
|
echo "resinsight: DISPLAY is not set and xvfb-run is not installed." >&2
|
|
echo "resinsight: install xvfb to run headless without a display server," >&2
|
|
echo "resinsight: e.g. 'apt-get install xvfb' or 'dnf install xorg-x11-server-Xvfb'." >&2
|
|
exit 1
|
|
fi
|
|
break
|
|
fi
|
|
done
|
|
fi
|
|
|
|
# Start the application making the default file open path become the users cwd
|
|
|
|
exec $XVFB_RUN ./ResInsight --startdir "$WORKING_DIR" "$@"
|