Skip to content

Commit

Permalink
build(fedora): fix version variables and skip post on rpm-ostree
Browse files Browse the repository at this point in the history
  • Loading branch information
ReenigneArcher committed Oct 6, 2024
1 parent 15b91a1 commit 888c83c
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 20 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/ci-copr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ jobs:
uses: actions/checkout@v4

- name: Get properties
env:
COPR_PR_WEBHOOK_TOKEN: "05fc9b07-a19b-4f83-89b2-ae1e7e0b5282"
run: |
# package name = repository name
package=${{ github.event.repository.name }}
Expand All @@ -42,7 +44,7 @@ jobs:
COPR_PUSH_WEBHOOK="${copr_base}/stable/${{ secrets.COPR_STABLE_WEBHOOK_TOKEN }}/${package}/"
fi
elif [ "${{ github.event_name }}" = "pull_request" ]; then
COPR_PR_WEBHOOK="${copr_base}/pulls:pr:${{github.event.number}}/${{vars.COPR_PR_WEBHOOK_TOKEN}}/${package}/"
COPR_PR_WEBHOOK="${copr_base}/pulls:pr:${{github.event.number}}/${{env.COPR_PR_WEBHOOK_TOKEN}}/${package}/"
fi
echo "COPR_PUSH_WEBHOOK=${COPR_PUSH_WEBHOOK}" >> $GITHUB_ENV
Expand Down
28 changes: 22 additions & 6 deletions packaging/linux/fedora/sunshine.spec
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,11 @@ if [ -n "$cuda_version" ] && [[ " ${cuda_supported_architectures[@]} " =~ " ${ar
cmake_args+=("-DCMAKE_CUDA_COMPILER:PATH=%{_builddir}/cuda/bin/nvcc")
fi

# setup the version
export BRANCH=%{branch}
export BUILD_VERSION=v%{build_version}
export COMMIT=%{commit}

# cmake
cd %{_builddir}/Sunshine
echo "cmake args:"
Expand All @@ -198,12 +203,23 @@ EOF

%post
# Note: this is copied from the postinst script
# Trigger udev rule reload for /dev/uinput and /dev/uhid
path_to_udevadm=$(which udevadm)
if [ -x "$path_to_udevadm" ] ; then
$path_to_udevadm control --reload-rules
$path_to_udevadm trigger --property-match=DEVNAME=/dev/uinput
$path_to_udevadm trigger --property-match=DEVNAME=/dev/uhid
# Check if we're in an rpm-ostree environment
if [ ! -x "$(command -v rpm-ostree)" ]; then
echo "Not in an rpm-ostree environment, proceeding with post install steps."

# Trigger udev rule reload for /dev/uinput and /dev/uhid
path_to_udevadm=$(which udevadm)
if [ -x "$path_to_udevadm" ]; then
echo "Reloading udev rules."
$path_to_udevadm control --reload-rules
$path_to_udevadm trigger --property-match=DEVNAME=/dev/uinput
$path_to_udevadm trigger --property-match=DEVNAME=/dev/uhid
echo "Udev rules reloaded successfully."
else
echo "error: udevadm not found or not executable."
fi
else
echo "rpm-ostree environment detected, skipping post install steps. Restart to apply the changes."
fi

%preun
Expand Down
41 changes: 28 additions & 13 deletions src_assets/linux/misc/postinst
Original file line number Diff line number Diff line change
@@ -1,17 +1,32 @@
#!/bin/sh

# Ensure Sunshine can grab images from KMS
path_to_setcap=$(which setcap)
path_to_sunshine=$(readlink -f $(which sunshine))
if [ -x "$path_to_setcap" ] ; then
echo "$path_to_setcap cap_sys_admin+p $path_to_sunshine"
$path_to_setcap cap_sys_admin+p $path_to_sunshine
fi
# Check if we're in an rpm-ostree environment
if [ ! -x "$(command -v rpm-ostree)" ]; then
echo "Not in an rpm-ostree environment, proceeding with post install steps."

# Ensure Sunshine can grab images from KMS
path_to_setcap=$(which setcap)
path_to_sunshine=$(readlink -f "$(which sunshine)")
if [ -x "$path_to_setcap" ] ; then
echo "Setting CAP_SYS_ADMIN capability on Sunshine binary."
echo "$path_to_setcap cap_sys_admin+p $path_to_sunshine"
$path_to_setcap cap_sys_admin+p $path_to_sunshine
echo "CAP_SYS_ADMIN capability set on Sunshine binary."
else
echo "error: setcap not found or not executable."
fi

# Trigger udev rule reload for /dev/uinput and /dev/uhid
path_to_udevadm=$(which udevadm)
if [ -x "$path_to_udevadm" ] ; then
$path_to_udevadm control --reload-rules
$path_to_udevadm trigger --property-match=DEVNAME=/dev/uinput
$path_to_udevadm trigger --property-match=DEVNAME=/dev/uhid
# Trigger udev rule reload for /dev/uinput and /dev/uhid
path_to_udevadm=$(which udevadm)
if [ -x "$path_to_udevadm" ] ; then
echo "Reloading udev rules."
$path_to_udevadm control --reload-rules
$path_to_udevadm trigger --property-match=DEVNAME=/dev/uinput
$path_to_udevadm trigger --property-match=DEVNAME=/dev/uhid
echo "Udev rules reloaded successfully."
else
echo "error: udevadm not found or not executable."
fi
else
echo "rpm-ostree environment detected, skipping post install steps. Restart to apply the changes."
fi

0 comments on commit 888c83c

Please sign in to comment.