mirror of
https://github.com/AdnanHodzic/auto-cpufreq.git
synced 2025-04-08 17:05:56 +02:00
Merge pull request #481 from shadeyg56/master
Fix uncaught error in checking for snap
This commit is contained in:
commit
8f343df8b8
@ -256,17 +256,16 @@ def disable_power_profiles_daemon():
|
|||||||
|
|
||||||
# default gnome_power_svc_disable func (balanced)
|
# default gnome_power_svc_disable func (balanced)
|
||||||
def gnome_power_svc_disable():
|
def gnome_power_svc_disable():
|
||||||
|
snap_pkg_check = 0
|
||||||
# check if snap package installed
|
|
||||||
snap_pkg_check = call(['snap', 'list', '|', 'grep', 'auto-cpufreq'],
|
|
||||||
stdout=subprocess.DEVNULL,
|
|
||||||
stderr=subprocess.STDOUT)
|
|
||||||
|
|
||||||
if systemctl_exists:
|
if systemctl_exists:
|
||||||
# 0 is active
|
# 0 is active
|
||||||
if gnome_power_status != 0:
|
if gnome_power_status != 0:
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
# check if snap package installed
|
||||||
|
snap_pkg_check = call(['snap', 'list', '|', 'grep', 'auto-cpufreq'],
|
||||||
|
stdout=subprocess.DEVNULL,
|
||||||
|
stderr=subprocess.STDOUT)
|
||||||
# check if snapd is present and if snap package is installed | 0 is success
|
# check if snapd is present and if snap package is installed | 0 is success
|
||||||
if snap_pkg_check == 0:
|
if snap_pkg_check == 0:
|
||||||
print("GNOME Power Profiles Daemon is already disabled, it can be re-enabled by running:\n"
|
print("GNOME Power Profiles Daemon is already disabled, it can be re-enabled by running:\n"
|
||||||
@ -280,7 +279,8 @@ def gnome_power_svc_disable():
|
|||||||
except:
|
except:
|
||||||
# snapd not found on the system
|
# snapd not found on the system
|
||||||
print("There was a problem, couldn't determine GNOME Power Profiles Daemon")
|
print("There was a problem, couldn't determine GNOME Power Profiles Daemon")
|
||||||
|
snap_pkg_check = 0
|
||||||
|
|
||||||
if gnome_power_status == 0 and powerprofilesctl_exists:
|
if gnome_power_status == 0 and powerprofilesctl_exists:
|
||||||
|
|
||||||
if snap_pkg_check == 1:
|
if snap_pkg_check == 1:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user