Started the solution to Snap and PopOS not working (#329)

* Started the solution to Snap and PopOS not working

Needs Snap detection on line 102/103

This code does NOT function properly unless that detection added

Added ability for the program to resume if the PopOS fix works

* Implemented changes as suggested by bobslept
This commit is contained in:
tyleraharrison 2021-12-23 12:22:46 -06:00 committed by GitHub
parent 5332dffdb7
commit 78ddf145e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -83,29 +83,28 @@ def get_config(config_file=""):
try: try:
dist_name = distro.id() dist_name = distro.id()
except PermissionError: except PermissionError:
# Current work-around for distros like Pop!_OS where symlink causes permission issues # Current work-around for Pop!_OS where symlink causes permission issues
print("Warning: Cannot get distro name") print("[!] Warning: Cannot get distro name")
if os.path.exists("/etc/pop-os/os-release"): if os.path.exists("/etc/pop-os/os-release"):
print("Pop!_OS detected") # Check if using a Snap
print( if os.getenv("PKG_MARKER") == "SNAP":
"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("[!] Snap install on PopOS detected, you must manually run the following"
) " commands in another terminal:\n")
print( print("[!] Backup the /etc/os-release file:")
"Attempting to change symlink to hard link for /etc/os-release -> /etc/pop-os/os-release" print("sudo mv /etc/os-release /etc/os-release-backup\n")
) print("[!] Create hardlink to /etc/os-release:")
print("sudo ln /etc/pop-os/os-release /etc/os-release\n")
print("[!] Aborting. Restart auto-cpufreq when you created the hardlink")
sys.exit(1)
else:
# This should not be the case. But better be sure.
print("[!] Check /etc/os-release permissions and make sure it is not a symbolic link")
print("[!] Aborting...")
sys.exit(1)
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: else:
print("Aborting...") print("[!] Check /etc/os-release permissions and make sure it is not a symbolic link")
print("[!] Aborting...")
sys.exit(1) sys.exit(1)
# display running version of auto-cpufreq # display running version of auto-cpufreq