Fix for PopOS os_release problem (#311)
* Fix for PopOS os_release problem Fixes issue #276 * Added Pop!_OS detection * Removed redundant abort code in Pop!_OS detection * Added exit case for pressing 'N' or not pressing anything Also fixed weird whitespace issue with backslash * Changed to "Operation aborted by user" for 'N' * Update auto_cpufreq/core.py Co-authored-by: bobslept <38557801+bobslept@users.noreply.github.com> Co-authored-by: bobslept <38557801+bobslept@users.noreply.github.com>
This commit is contained in:
parent
00eca65c82
commit
7236e674f4
|
@ -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)
|
||||
exit(1)
|
||||
|
|
Loading…
Reference in New Issue