-
Notifications
You must be signed in to change notification settings - Fork 441
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
extensions: add 'basic-graphics' extension
This extension provides a shortcut for snaps that make use of the 'mesa-core22' snap of graphics libraries & resources. It configures the conventional 'graphics-core22' content plug and provides the 'graphics-launch' helper script for setting-up the environment.
- Loading branch information
Showing
10 changed files
with
3,543 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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-core22-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" "$@" | ||
|
Oops, something went wrong.