mirror of
https://github.com/terrapkg/packages.git
synced 2026-05-31 09:01:55 +00:00
@@ -2,11 +2,12 @@
|
||||
|
||||
Name: python-auto-cpufreq
|
||||
Version: 3.0.0
|
||||
Release: 1%?dist
|
||||
Release: 2%?dist
|
||||
Summary: Automatic CPU speed & power optimizer for Linux
|
||||
License: LGPL-3.0-or-later
|
||||
URL: https://foolcontrol.org/?p=4603
|
||||
Source0: https://github.com/AdnanHodzic/auto-cpufreq/archive/refs/tags/v%{version}.tar.gz
|
||||
Patch0: prevent-install-and-copy.patch
|
||||
|
||||
BuildRequires: python3-devel
|
||||
BuildRequires: python3-wheel
|
||||
@@ -32,6 +33,7 @@ Summary: %{summary}
|
||||
|
||||
%prep
|
||||
%git_clone https://github.com/AdnanHodzic/auto-cpufreq.git %{version}
|
||||
%patch -P0 -p1
|
||||
|
||||
%build
|
||||
%pyproject_wheel
|
||||
@@ -44,16 +46,16 @@ install -Dm644 scripts/org.auto-cpufreq.pkexec.policy %{buildroot}%{_datadir}/po
|
||||
install -Dm644 images/icon.png %{buildroot}%{_hicolordir}/512x512/apps/auto-cpufreq.png
|
||||
install -Dm644 images/icon.png %{buildroot}%{_datadir}/%{name}/icon.png
|
||||
|
||||
mkdir -p %{buildroot}%{_datadir}/%{name}/scripts/
|
||||
mkdir -p %{buildroot}%{_datadir}/auto-cpufreq/scripts/
|
||||
mkdir -p %{buildroot}/opt/auto-cpufreq/
|
||||
mkdir -p %{buildroot}%{_appsdir}/
|
||||
mkdir -p %{buildroot}%{_unitdir}/
|
||||
|
||||
install -Dm755 scripts/auto-cpufreq-install.sh %{buildroot}%{_datadir}/%{name}/scripts/
|
||||
install -Dm755 scripts/auto-cpufreq-remove.sh %{buildroot}%{_datadir}/%{name}/scripts/
|
||||
install -Dm755 scripts/auto-cpufreq-install.sh %{buildroot}%{_datadir}/auto-cpufreq/scripts/
|
||||
install -Dm755 scripts/auto-cpufreq-remove.sh %{buildroot}%{_datadir}/auto-cpufreq/scripts/
|
||||
install -Dm644 scripts/auto-cpufreq.service %{buildroot}%{_unitdir}/auto-cpufreq.service
|
||||
install -Dm755 scripts/cpufreqctl.sh %{buildroot}%{_datadir}/%{name}/scripts/
|
||||
install -Dm644 scripts/style.css %{buildroot}%{_datadir}/%{name}/scripts/
|
||||
install -Dm755 scripts/cpufreqctl.sh %{buildroot}%{_datadir}/auto-cpufreq/scripts/
|
||||
install -Dm644 scripts/style.css %{buildroot}%{_datadir}/auto-cpufreq/scripts/
|
||||
install -Dm644 scripts/auto-cpufreq-gtk.desktop %{buildroot}%{_appsdir}/
|
||||
|
||||
%post
|
||||
@@ -74,9 +76,12 @@ install -Dm644 scripts/auto-cpufreq-gtk.desktop %{buildroot}%{_appsdir}/
|
||||
%{_hicolordir}/512x512/apps/auto-cpufreq.png
|
||||
%{_datadir}/%{name}/icon.png
|
||||
%{_unitdir}/auto-cpufreq.service
|
||||
%{_datadir}/%{name}/scripts/
|
||||
%{_datadir}/auto-cpufreq/scripts/
|
||||
%{_appsdir}/auto-cpufreq-gtk.desktop
|
||||
|
||||
%changelog
|
||||
* Tue Apr 07 2026 Owen Zimmerman <owen@fyralabs.com>
|
||||
- Add install fix patch
|
||||
|
||||
* Sun Apr 05 2026 Owen Zimmerman <owen@fyralabs.com>
|
||||
- Initial commit
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
diff --git a/auto_cpufreq/core.py b/auto_cpufreq/core.py
|
||||
index f03e7de..2dff5fb 100755
|
||||
--- a/auto_cpufreq/core.py
|
||||
+++ b/auto_cpufreq/core.py
|
||||
@@ -277,19 +277,12 @@ def get_current_gov():
|
||||
)
|
||||
|
||||
def cpufreqctl():
|
||||
- """
|
||||
- deploy cpufreqctl.auto-cpufreq script
|
||||
- """
|
||||
- if not (IS_INSTALLED_WITH_SNAP or os.path.isfile("/usr/local/bin/cpufreqctl.auto-cpufreq")):
|
||||
- copy(SCRIPTS_DIR / "cpufreqctl.sh", "/usr/local/bin/cpufreqctl.auto-cpufreq")
|
||||
- call(["chmod", "a+x", "/usr/local/bin/cpufreqctl.auto-cpufreq"])
|
||||
+ # scripts are already in the correct place
|
||||
+ pass
|
||||
|
||||
def cpufreqctl_restore():
|
||||
- """
|
||||
- remove cpufreqctl.auto-cpufreq script
|
||||
- """
|
||||
- if not IS_INSTALLED_WITH_SNAP and os.path.isfile("/usr/local/bin/cpufreqctl.auto-cpufreq"):
|
||||
- os.remove("/usr/local/bin/cpufreqctl.auto-cpufreq")
|
||||
+ #no need to restore
|
||||
+ pass
|
||||
|
||||
def footer(l=79): print("\n" + "-" * l + "\n")
|
||||
|
||||
@@ -307,31 +300,8 @@ def remove_complete_msg():
|
||||
footer()
|
||||
|
||||
def deploy_daemon():
|
||||
- print("\n" + "-" * 21 + " Deploying auto-cpufreq as a daemon " + "-" * 22 + "\n")
|
||||
-
|
||||
- cpufreqctl() # deploy cpufreqctl script func call
|
||||
-
|
||||
- bluetooth_disable() # turn off bluetooth on boot
|
||||
-
|
||||
- auto_cpufreq_stats_path.touch(exist_ok=True)
|
||||
-
|
||||
- print("\n* Deploy auto-cpufreq install script")
|
||||
- copy(SCRIPTS_DIR / "auto-cpufreq-install.sh", "/usr/local/bin/auto-cpufreq-install")
|
||||
- call(["chmod", "a+x", "/usr/local/bin/auto-cpufreq-install"])
|
||||
-
|
||||
- print("\n* Deploy auto-cpufreq remove script")
|
||||
- copy(SCRIPTS_DIR / "auto-cpufreq-remove.sh", "/usr/local/bin/auto-cpufreq-remove")
|
||||
- call(["chmod", "a+x", "/usr/local/bin/auto-cpufreq-remove"])
|
||||
-
|
||||
- # output warning if gnome power profile is running
|
||||
- gnome_power_detect_install()
|
||||
- gnome_power_svc_disable()
|
||||
-
|
||||
- tuned_svc_disable()
|
||||
-
|
||||
- tlp_service_detect() # output warning if TLP service is detected
|
||||
-
|
||||
- call("/usr/local/bin/auto-cpufreq-install", shell=True)
|
||||
+ # prevent needless copying and system changes
|
||||
+ pass
|
||||
|
||||
def deploy_daemon_performance():
|
||||
print("\n" + "-" * 21 + " Deploying auto-cpufreq as a daemon (performance) " + "-" * 22 + "\n")
|
||||
@@ -363,37 +333,7 @@ def deploy_daemon_performance():
|
||||
|
||||
call("/usr/local/bin/auto-cpufreq-install", shell=True)
|
||||
|
||||
-def remove_daemon():
|
||||
- # check if auto-cpufreq is installed
|
||||
- if not os.path.exists("/usr/local/bin/auto-cpufreq-remove"):
|
||||
- print("\nauto-cpufreq daemon is not installed.\n")
|
||||
- sys.exit(1)
|
||||
-
|
||||
- print("\n" + "-" * 21 + " Removing auto-cpufreq daemon " + "-" * 22 + "\n")
|
||||
-
|
||||
- bluetooth_enable() # turn on bluetooth on boot
|
||||
-
|
||||
- # output warning if gnome power profile is stopped
|
||||
- gnome_power_rm_reminder()
|
||||
- gnome_power_svc_enable()
|
||||
-
|
||||
- tuned_svc_enable()
|
||||
-
|
||||
- # run auto-cpufreq daemon remove script
|
||||
- call("/usr/local/bin/auto-cpufreq-remove", shell=True)
|
||||
-
|
||||
- # remove auto-cpufreq-remove
|
||||
- os.remove("/usr/local/bin/auto-cpufreq-remove")
|
||||
-
|
||||
- # delete override pickle if it exists
|
||||
- if os.path.exists(governor_override_state): os.remove(governor_override_state)
|
||||
-
|
||||
- # delete stats file
|
||||
- if auto_cpufreq_stats_path.exists():
|
||||
- if auto_cpufreq_stats_file is not None: auto_cpufreq_stats_file.close()
|
||||
- auto_cpufreq_stats_path.unlink()
|
||||
-
|
||||
- cpufreqctl_restore() # restore original cpufrectl script
|
||||
+def remove_daemon(): pass
|
||||
|
||||
def gov_check():
|
||||
for gov in AVAILABLE_GOVERNORS:
|
||||
Reference in New Issue
Block a user