mirror of
https://github.com/AdnanHodzic/auto-cpufreq.git
synced 2025-04-08 17:05:56 +02:00
Merge branch 'master' into shadeyg56-dev
This commit is contained in:
commit
75cfa71ff4
21
README.md
21
README.md
@ -351,6 +351,27 @@ Once you have made the necessary changes to the GRUB configuration file, you can
|
||||
# Legacy boot method for grub update.
|
||||
```
|
||||
|
||||
For systemd-boot users:
|
||||
|
||||
```
|
||||
sudo nano /etc/kernel/cmdline
|
||||
# make sure you have nano installed, or you can use your favorite text editor.
|
||||
```
|
||||
|
||||
For Intel users:
|
||||
|
||||
```
|
||||
quiet splash intel_pstate=disable
|
||||
```
|
||||
|
||||
For AMD users:
|
||||
|
||||
```
|
||||
quiet splash initcall_blacklist=amd_pstate_init amd_pstate.enable=0
|
||||
```
|
||||
|
||||
Once you have made the necessary changes to the cmdline file, you can update it by running `sudo reinstall-kernels`.
|
||||
|
||||
### AUR
|
||||
|
||||
* The command ```sudo auto-cpufreq --install``` produces error [#471](https://github.com/AdnanHodzic/auto-cpufreq/issues/471) please don't use it.
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# auto-cpufreq-installer:
|
||||
# auto-cpufreq source code based installer
|
||||
@ -111,10 +111,10 @@ function manual_install {
|
||||
Didn't detect Debian or RedHat based distro.
|
||||
|
||||
To complete installation, you need to:
|
||||
Install: python3, pip3, python3-setuptools
|
||||
Install: python3, pip3, python3-setuptools, gobject-introspection, cairo (or cairo-devel), gcc, and gtk3
|
||||
|
||||
Install necessary Python packages:
|
||||
pip3 install psutil click distro power
|
||||
pip3 install psutil click distro power requests PyGObject
|
||||
Run following sequence of lines:
|
||||
|
||||
-----
|
||||
@ -148,21 +148,21 @@ function tool_install {
|
||||
separator
|
||||
if [ -f /etc/debian_version ]; then
|
||||
detected_distro "Debian based"
|
||||
apt install python3-dev python3-pip python3-venv python3-setuptools dmidecode libgirepository1.0-dev libcairo2-dev -y
|
||||
apt install python3-dev python3-pip python3-venv python3-setuptools dmidecode libgirepository1.0-dev libcairo2-dev libgtk-3 gcc -y
|
||||
completed
|
||||
complete_msg
|
||||
elif [ -f /etc/redhat-release ]; then
|
||||
detected_distro "RedHat based"
|
||||
if [ -f /etc/centos-release ]; then
|
||||
yum install platform-python-devel dmidecode
|
||||
yum install platform-python-devel dmidecode gcc cairo-devel gobject-introspection-devel cairo-gobject-devel gtk3-devel
|
||||
else
|
||||
yum install python-devel dmidecode
|
||||
yum install python-devel dmidecode gcc cairo-devel gobject-introspection-devel cairo-gobject-devel gtk3-devel
|
||||
fi
|
||||
completed
|
||||
complete_msg
|
||||
elif [ -f /etc/solus-release ]; then
|
||||
detected_distro "Solus"
|
||||
eopkg install pip python3 python3-devel dmidecode
|
||||
eopkg install pip python3 python3-devel dmidecode gobject-introspection-devel libcairo-devel gcc libgtk-3
|
||||
eopkg install -c system.devel
|
||||
completed
|
||||
complete_msg
|
||||
@ -172,23 +172,23 @@ elif [ -f /etc/os-release ];then
|
||||
case $ID in
|
||||
opensuse-leap)
|
||||
detected_distro "OpenSUSE"
|
||||
zypper install -y python3 python3-pip python3-setuptools python3-devel gcc dmidecode
|
||||
zypper install -y python3 python3-pip python3-setuptools python3-devel gcc dmidecode gobject-introspection-devel python3-cairo-devel gtk3 gtk3-devel
|
||||
completed
|
||||
;;
|
||||
opensuse)
|
||||
opensuse-tumbleweed)
|
||||
detected_distro "OpenSUSE"
|
||||
echo -e "\nDetected an OpenSUSE distribution\n\nSetting up Python environment\n"
|
||||
zypper install -y python38 python3-pip python3-setuptools python3-devel gcc dmidecode gobject-introspection-devel python3-cairo-devel
|
||||
zypper install -y python38 python3-pip python3-setuptools python3-devel gcc dmidecode gobject-introspection-devel python3-cairo-devel gtk3 gtk3-devel
|
||||
completed
|
||||
;;
|
||||
arch|manjaro|endeavouros|garuda|artix)
|
||||
detected_distro "Arch Linux based"
|
||||
pacman -S --noconfirm --needed python python-pip python-setuptools base-devel dmidecode gobject-introspection
|
||||
pacman -S --noconfirm --needed python python-pip python-setuptools base-devel dmidecode gobject-introspection gtk3 gcc
|
||||
completed
|
||||
;;
|
||||
void)
|
||||
detected_distro "Void Linux"
|
||||
xbps-install -Sy python3 python3-pip python3-devel python3-setuptools base-devel dmidecode
|
||||
xbps-install -Sy python3 python3-pip python3-devel python3-setuptools base-devel dmidecode cairo-devel gobject-introspection gcc gtk+3
|
||||
completed
|
||||
;;
|
||||
*) #Any other distro
|
||||
|
@ -1194,31 +1194,34 @@ def sysinfo():
|
||||
offline_cpus = [str(cpu) for cpu in range(total_cpu_count) if cpu not in cpu_core]
|
||||
|
||||
# temperatures
|
||||
core_temp = psutil.sensors_temperatures()
|
||||
temp_sensors = psutil.sensors_temperatures()
|
||||
temp_per_cpu = [float("nan")] * online_cpu_count
|
||||
try:
|
||||
if "coretemp" in core_temp:
|
||||
# the priority for CPU temp is as follows: coretemp sensor -> sensor with CPU in the label -> acpi -> k10temp
|
||||
if "coretemp" in temp_sensors:
|
||||
# list labels in 'coretemp'
|
||||
core_temp_labels = [temp.label for temp in core_temp["coretemp"]]
|
||||
core_temp_labels = [temp.label for temp in temp_sensors["coretemp"]]
|
||||
for i, cpu in enumerate(cpu_core):
|
||||
# get correct index in core_temp
|
||||
# get correct index in temp_sensors
|
||||
core = cpu_core[cpu]
|
||||
cpu_temp_index = core_temp_labels.index(f"Core {core}")
|
||||
temp_per_cpu[i] = core_temp["coretemp"][cpu_temp_index].current
|
||||
temp_per_cpu[i] = temp_sensors["coretemp"][cpu_temp_index].current
|
||||
else:
|
||||
# iterate over all sensors
|
||||
for sensor in core_temp:
|
||||
for sensor in temp_sensors:
|
||||
# iterate over all temperatures in the current sensor
|
||||
for temp in core_temp[sensor]:
|
||||
if temp.label == 'CPU':
|
||||
for temp in temp_sensors[sensor]:
|
||||
if 'CPU' in temp.label:
|
||||
temp_per_cpu = [temp.current] * online_cpu_count
|
||||
break
|
||||
else:
|
||||
continue
|
||||
break
|
||||
else: # if 'CPU' label not found in any sensor, use first available temperature
|
||||
temp = list(core_temp.keys())[0]
|
||||
temp_per_cpu = [core_temp[temp][0].current] * online_cpu_count
|
||||
else:
|
||||
if "acpitz" in temp_sensors:
|
||||
temp_per_cpu = [temp_sensors["acpitz"][0].current] * online_cpu_count
|
||||
elif "k10temp" in temp_sensors:
|
||||
temp_per_cpu = [temp_sensors["k10temp"][0].current] * online_cpu_count
|
||||
except Exception as e:
|
||||
print(repr(e))
|
||||
pass
|
||||
|
@ -232,7 +232,7 @@ def main(config, daemon, debug, update, install, remove, live, log, monitor, sta
|
||||
|
||||
print("Please update using snap package manager, i.e: `sudo snap refresh auto-cpufreq`.")
|
||||
#check for AUR
|
||||
elif subprocess.run(["bash", "-c", "command -v yay >/dev/null 2>&1"]).returncode == 0 or subprocess.run(["bash", "-c", "command -v pacman >/dev/null 2>&1"]).returncode == 0:
|
||||
elif subprocess.run(["bash", "-c", "command -v pacman >/dev/null 2>&1"]).returncode == 0 and subprocess.run(["bash", "-c", "pacman -Q auto-cpufreq >/dev/null 2>&1"]).returncode == 0:
|
||||
print("Arch-based distribution with AUR support detected. Please refresh auto-cpufreq using your AUR helper.")
|
||||
else:
|
||||
verify_update()
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# auto-cpufreq daemon install script
|
||||
# reference: https://github.com/AdnanHodzic/auto-cpufreq
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# workaround for running Daemon without polluting syslog (#53, #82)
|
||||
$SNAP/bin/auto-cpufreq --daemon 2>&1 >> $SNAP_DATA/auto-cpufreq.stats
|
||||
|
@ -24,6 +24,8 @@ parts:
|
||||
build-packages:
|
||||
- gcc
|
||||
- python3-dev
|
||||
- libgirepository1.0-dev
|
||||
- libcairo2-dev
|
||||
stage-packages:
|
||||
- coreutils
|
||||
- dmidecode
|
||||
@ -62,24 +64,18 @@ apps:
|
||||
- system-observe
|
||||
- hardware-observe
|
||||
- etc-auto-cpufreq-conf
|
||||
|
||||
auto-cpufreq-gtk:
|
||||
command: bin/auto-cpufreq-gtk
|
||||
extensions: [gnome]
|
||||
environment:
|
||||
PYTHONPATH: $SNAP/usr/lib/python3/site-packages:$SNAP/usr/lib/python3/dist-packages:$PYTHONPATH
|
||||
LC_ALL: C.UTF-8
|
||||
LANG: C.UTF-8
|
||||
PKG_MARKER: SNAP
|
||||
plugs:
|
||||
- desktop
|
||||
- desktop-legacy
|
||||
- wayland
|
||||
- x11
|
||||
- cpu-control
|
||||
- system-observe
|
||||
- hardware-observe
|
||||
|
||||
- etc-auto-cpufreq-conf
|
||||
service:
|
||||
command: usr/bin/snapdaemon
|
||||
plugs:
|
||||
|
Loading…
x
Reference in New Issue
Block a user