diff --git a/auto_cpufreq/core.py b/auto_cpufreq/core.py index 6ab60ae..24bda03 100644 --- a/auto_cpufreq/core.py +++ b/auto_cpufreq/core.py @@ -78,7 +78,29 @@ def get_config(config_file=''): return get_config.dict # get distro name -dist_name = distro.id() +try: + dist_name = distro.id() +except PermissionError: + # Current work-around for distros like Pop!_OS where symlink causes permission issues + print("Warning: Cannot get distro name") + if os.path.exists("/etc/pop-os/os-release"): + print("Pop!_OS detected") + print("Pop!_OS uses a symbolic link for the os-release file, this causes issues and can be fixed by converting to a hard link") + print("Attempting to change symlink to hard link for /etc/os-release -> /etc/pop-os/os-release") + + yN = input("Continue? [y/N] ") + if yN.lower() == "y": + print("Creating hard link for /etc/os-release") + # Backup /etc/os-release + os.system("sudo mv /etc/os-release /etc/os-release-backup") + # Create hard link to /etc/os-release + os.system("sudo ln /etc/pop-os/os-release /etc/os-release") + else: + print("Operation aborted by user") + sys.exit(1) + else: + print("Aborting...") + sys.exit(1) # display running version of auto-cpufreq def app_version(): @@ -1085,4 +1107,4 @@ def running_daemon(): exit(1) elif os.getenv("PKG_MARKER") == "SNAP" and dcheck == "enabled": daemon_running_msg() - exit(1) \ No newline at end of file + exit(1)