Skip to content

Commit

Permalink
feat: Add workaround for Sunshine to set correct caps for KMS
Browse files Browse the repository at this point in the history
  • Loading branch information
KyleGospo committed Jan 2, 2024
1 parent 57b8a2b commit ed975d1
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
1 change: 1 addition & 0 deletions Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,7 @@ RUN /tmp/image-info.sh && \
systemctl disable rpm-ostreed-automatic.timer && \
systemctl enable ublue-update.timer && \
systemctl enable gamescope-workaround.service && \
systemctl enable sunshine-workaround.service && \
systemctl enable waydroid-workaround.service && \
systemctl enable bazzite-hardware-setup.service && \
systemctl enable tailscaled.service && \
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[Unit]
Description=Workaround sunshine not having the correct caps
ConditionFileIsExecutable=/usr/bin/sunshine
After=local-fs.target

[Service]
Type=oneshot
# Copy if it doesn't exist
ExecStartPre=/usr/bin/bash -c "[ -x /usr/local/bin/.sunshine ] || /usr/bin/cp /usr/bin/sunshine /usr/local/bin/.sunshine"
# This is faster than using .mount unit. Also allows for the previous line/cleanup
ExecStartPre=/usr/bin/mount --bind /usr/local/bin/.sunshine /usr/bin/sunshine
# Fix caps
ExecStart=/usr/sbin/setcap cap_sys_admin+p /usr/bin/sunshine
# Clean-up after ourselves
ExecStop=/usr/bin/umount /usr/bin/sunshine
ExecStop=/usr/bin/rm /usr/local/bin/.sunshine
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
C /usr/local/bin/.sunshine - - - - /usr/bin/sunshine

0 comments on commit ed975d1

Please sign in to comment.