Skip to content
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[Unit]
Description=Sync NVIDIA system drivers with Flatpak runtime
After=network-online.target flatpak-system-helper.service
Wants=network-online.target
ConditionPathExists=/proc/driver/nvidia/version

[Service]
Type=oneshot
ExecCondition=/usr/libexec/ublue-nvidia-flatpak-runtime-sync check
ExecStart=/usr/libexec/ublue-nvidia-flatpak-runtime-sync sync
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/bash

set -euo pipefail

SYSTEM_NVIDIA_VERSION=$(head -1 /proc/driver/nvidia/version | grep -oP '\d+\.\d+\.\d+')
FLATPAK_NVIDIA_VERSION=$(echo "${SYSTEM_NVIDIA_VERSION}" | tr '.' '-')

case "${1}" in
check)
# Exit 0 if sync is needed (versions mismatch), exit 1 if already in sync
if flatpak info --system org.freedesktop.Platform.GL.nvidia-"${FLATPAK_NVIDIA_VERSION}" >/dev/null 2>&1 && \
flatpak info --system org.freedesktop.Platform.GL32.nvidia-"${FLATPAK_NVIDIA_VERSION}" >/dev/null 2>&1; then
echo "NVIDIA Flatpak runtime ${SYSTEM_NVIDIA_VERSION} already installed"
exit 1
fi
echo "NVIDIA Flatpak runtime ${SYSTEM_NVIDIA_VERSION} needs to be installed"
exit 0
;;
sync)
echo "Installing NVIDIA Flatpak runtime version ${SYSTEM_NVIDIA_VERSION}"
flatpak install --noninteractive flathub \
org.freedesktop.Platform.GL.nvidia-"${FLATPAK_NVIDIA_VERSION}" \
org.freedesktop.Platform.GL32.nvidia-"${FLATPAK_NVIDIA_VERSION}"
;;
*)
echo "Usage: $0 {check|sync}"
exit 1
;;
esac
Loading