Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

extensions: add 'basic-graphics' extension #4288

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions extensions/basic-graphics/bin/graphics-cleanup
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash
set -euo pipefail

SELF="$( cd -- "$(dirname "$0")/.." ; pwd -P )"

rm -f $(
(
for provider in "$@"; do
cat ${SELF}/lists/$provider.${CRAFT_TARGET_ARCH}.list
done
) | sort -u | awk "/.+/ { print \"${CRAFT_PRIME}/\" \$0 }"
)

find "${CRAFT_PRIME}" -type d -empty -delete
40 changes: 40 additions & 0 deletions extensions/basic-graphics/bin/graphics-launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/bin/sh
set -e

# '%GRAPHICS%' interface is required
if ! snapctl is-connected %GRAPHICS%
then
echo "ERROR: the %GRAPHICS% interface isn't connected."
echo " Please install and connect a graphics userspace provider."
echo ""
echo "The default provider is %MESA%, you can install it and connect by issuing:"
echo " sudo snap install %MESA%"
echo " sudo snap connect ${SNAP_INSTANCE_NAME}:%GRAPHICS% %MESA%"
echo ""
echo "See https://mir-server.io/docs/the-%GRAPHICS%-snap-interface for more information."
exit 1
fi

# These interfaces may be optional (varies by snap)
for PLUG in opengl wayland x11; do
if ! snapctl is-connected ${PLUG}
then
echo "WARNING: ${PLUG} interface not connected!"
fi
done

real_xdg_runtime_dir=$(dirname "${XDG_RUNTIME_DIR}")
real_wayland=${real_xdg_runtime_dir}/${WAYLAND_DISPLAY:-wayland-0}

[ -d "${real_xdg_runtime_dir}" ] || echo "WARNING: missing ${real_xdg_runtime_dir}, is a Wayland compositor running?"
[ -O "${real_wayland}" ] || echo "WARNING: missing ${real_wayland}, is a Wayland compositor running?"

if mkdir -p "$XDG_RUNTIME_DIR" -m 700; then
ln -sf "${real_wayland}" "$XDG_RUNTIME_DIR"
ln -sf "${real_wayland}.lock" "$XDG_RUNTIME_DIR"
else
echo "WARNING: XDG_RUNTIME_DIR ($XDG_RUNTIME_DIR) missing, Wayland will not work"
fi

exec "${SNAP}/graphics/bin/%GRAPHICS%-provider-wrapper" "$@"

Loading
Loading