Skip to content

Commit

Permalink
Fix Snap package daemon check
Browse files Browse the repository at this point in the history
  • Loading branch information
AdnanHodzic committed Aug 24, 2024
1 parent 64af2b4 commit 429bf76
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion auto_cpufreq/bin/auto_cpufreq.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def config_info_dialog():
config_info_dialog()
root_check()
file_stats()
if IS_INSTALLED_WITH_SNAP and dcheck == "enabled":
if IS_INSTALLED_WITH_SNAP and SNAP_DAEMON_CHECK == "enabled":
gnome_power_detect_snap()
tlp_service_detect_snap()
elif not IS_INSTALLED_WITH_SNAP:
Expand Down
9 changes: 3 additions & 6 deletions auto_cpufreq/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

from auto_cpufreq.config.config import config
from auto_cpufreq.globals import (
ALL_GOVERNORS, AVAILABLE_GOVERNORS, AVAILABLE_GOVERNORS_SORTED, GITHUB, IS_INSTALLED_WITH_AUR, IS_INSTALLED_WITH_SNAP, POWER_SUPPLY_DIR
ALL_GOVERNORS, AVAILABLE_GOVERNORS, AVAILABLE_GOVERNORS_SORTED, GITHUB, IS_INSTALLED_WITH_AUR, IS_INSTALLED_WITH_SNAP, POWER_SUPPLY_DIR, SNAP_DAEMON_CHECK
)
from auto_cpufreq.power_helper import *

Expand Down Expand Up @@ -55,9 +55,6 @@
auto_cpufreq_stats_path = Path("/var/run/auto-cpufreq.stats")
governor_override_state = Path("/opt/auto-cpufreq/override.pickle")

# daemon check
dcheck = getoutput("snapctl get daemon")

def file_stats():
global auto_cpufreq_stats_file
auto_cpufreq_stats_file = open(auto_cpufreq_stats_path, "w")
Expand Down Expand Up @@ -917,7 +914,7 @@ def running_daemon_check():
if is_running("auto-cpufreq", "--daemon"):
daemon_running_msg()
exit(1)
elif IS_INSTALLED_WITH_SNAP and dcheck == "enabled":
elif IS_INSTALLED_WITH_SNAP and SNAP_DAEMON_CHECK == "enabled":
daemon_running_msg()
exit(1)

Expand All @@ -926,6 +923,6 @@ def not_running_daemon_check():
if not is_running("auto-cpufreq", "--daemon"):
daemon_not_running_msg()
exit(1)
elif IS_INSTALLED_WITH_SNAP and dcheck == "disabled":
elif IS_INSTALLED_WITH_SNAP and SNAP_DAEMON_CHECK == "disabled":
daemon_not_running_msg()
exit(1)
1 change: 1 addition & 0 deletions auto_cpufreq/globals.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@
IS_INSTALLED_WITH_AUR = path.isfile("/etc/arch-release") and bool(getoutput("pacman -Qs auto-cpufreq"))
IS_INSTALLED_WITH_SNAP = getenv("PKG_MARKER") == "SNAP"
POWER_SUPPLY_DIR = "/sys/class/power_supply/"
SNAP_DAEMON_CHECK = getoutput("snapctl get daemon")

0 comments on commit 429bf76

Please sign in to comment.