forked from Maclay74/steam-patch
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathsteam-patch.spec
77 lines (64 loc) · 2.74 KB
/
steam-patch.spec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
%global _name steam-patch
Name: steam-patch
Version: 1.0.0
Release: 1%{?dist}
Summary: Steam Patch for ASUS ROG ALLY face buttons, tdp and GPU clock control
License: GPL3
URL: https://github.com/corando98/steam-patch
Source0: steam-patch-main.zip
Source1: steam-patch.service
Source2: restart-steam-patch-on-boot.service
Source3: steamos-priv-write-updated
BuildRequires: cargo rust
Recommends: steam gamescope-session
Provides: steam-patch
Conflicts: steam-patch
%description
Steam Patch for ASUS ROG ALLY
%prep
rm -rf %{_builddir}/steam-patch
cd $RPM_SOURCE_DIR
rm -f steam-patch-main.zip
wget https://github.com/corando98/steam-patch/archive/refs/heads/main.zip
mv main.zip steam-patch-main.zip
unzip $RPM_SOURCE_DIR/steam-patch-main.zip -d %{_builddir}
mkdir -p %{_builddir}/steam-patch
cp -rf %{_builddir}/steam-patch-main/* %{_builddir}/steam-patch
rm -rf %{_builddir}/steam-patch-main
cp -f %{_builddir}/steam-patch/{steam-patch.service,restart-steam-patch-on-boot.service,steamos-priv-write-updated} $RPM_SOURCE_DIR
%build
cd %{_builddir}/steam-patch
cargo build -r
%install
mkdir -p %{buildroot}/usr/bin
cp %{_builddir}/steam-patch/target/release/steam-patch %{buildroot}/usr/bin/steam-patch
mkdir -p %{buildroot}/etc/systemd/system/
mkdir -p %{buildroot}/usr/bin/steamos-polkit-helpers/
install -m 644 %{SOURCE1} %{buildroot}/etc/systemd/system/
install -m 644 %{SOURCE2} %{buildroot}/etc/systemd/system/
install -m 747 %{SOURCE3} %{buildroot}/usr/bin/steamos-polkit-helpers/
%post
sed -i "s/\$USER/${SUDO_USER}/g" /etc/systemd/system/steam-patch.service
systemctl daemon-reload
systemctl enable steam-patch.service
systemctl start steam-patch.service
systemctl enable restart-steam-patch-on-boot.service
systemctl start restart-steam-patch-on-boot.service
mv /usr/bin/steamos-polkit-helpers/steamos-priv-write /usr/bin/steamos-polkit-helpers/steamos-priv-write-bkp
mv /usr/bin/steamos-polkit-helpers/steamos-priv-write-updated /usr/bin/steamos-polkit-helpers/steamos-priv-write
%preun
systemctl stop steam-patch.service
systemctl disable steam-patch.service
systemctl stop restart-steam-patch-on-boot.service
systemctl disable restart-steam-patch-on-boot.service
systemctl daemon-reload
mv /usr/bin/steamos-polkit-helpers/steamos-priv-write /usr/bin/steamos-polkit-helpers/steamos-priv-write-updated
mv /usr/bin/steamos-polkit-helpers/steamos-priv-write-bkp /usr/bin/steamos-polkit-helpers/steamos-priv-write
%files
/etc/systemd/system/steam-patch.service
/etc/systemd/system/restart-steam-patch-on-boot.service
/usr/bin/steam-patch
/usr/bin/steamos-polkit-helpers/steamos-priv-write-updated
%changelog
* Fri Nov 03 2023 Diego Garcia <[email protected]> [1.0.0-1]
- Initial package