Support for OSTREE-based distributions#181
Merged
bayasdev merged 7 commits intobayasdev:mainfrom Aug 14, 2024
Merged
Conversation
bayasdev
requested changes
Aug 11, 2024
Contributor
Author
|
@bayasdev I added logic to cleanup() in my latest commit to address your concerns. I just have statements to check for EnvyControl's udev rules in |
bayasdev
requested changes
Aug 12, 2024
envycontrol.py
Outdated
| # attempt to delete rules from legacy directory | ||
| legacy_udev = '/lib/udev/rules.d/50-remove-nvidia.rules' | ||
| legacy_udev_pm = '/lib/udev/rules.d/80-nvidia-pm.rules' | ||
| if os.path.exists(legacy_udev): |
Owner
There was a problem hiding this comment.
@PilotGuy772 I think we could do something like this instead
# define list of files to remove
to_remove = [
BLACKLIST_PATH,
UDEV_INTEGRATED_PATH,
UDEV_PM_PATH,
XORG_PATH,
EXTRA_XORG_PATH,
MODESET_PATH,
LIGHTDM_SCRIPT_PATH,
LIGHTDM_CONFIG_PATH,
# legacy paths
'/etc/X11/xorg.conf.d/90-nvidia.conf',
'/lib/udev/rules.d/50-remove-nvidia.rules',
'/lib/udev/rules.d/80-nvidia-pm.rules'
]
# remove each file in the list
for file_path in to_remove:
try:
if os.path.exists(lfile_path):
os.remove(file_path)
logging.info(f"Removed file {file_path}")
except OSError as e:
# only warn if file exists (code 2)
if e.errno != 2:
logging.error(f"Failed to remove file '{file_path}': {e}")
envycontrol.py
Outdated
| # I'm keeping --force, but --regenerate-all is not necessary | ||
| # because rpm-ostree already passes the kernel version. | ||
|
|
||
| # this takes a LLOOOOOONG time to run, so let's warn the user first. |
Owner
There was a problem hiding this comment.
could you please remove the redundant comments?
envycontrol.py
Outdated
| def __init__(self, app_args) -> None: | ||
| self.app_args = app_args | ||
| self.current_mode = get_current_mode() | ||
| self.current_mode = get_nvidia_gpu_pci_bus() |
Owner
|
@PilotGuy772 please take a look at the comments I left, and thank you for adding OSTree support to EnvyControl as it was a frequently requested feature 🙌🏼 |
Contributor
Author
|
@bayasdev All done (I think) |
Owner
|
Thanks @PilotGuy772 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #180
Fixes #114
Fixes #49
EnvyControl is configured right now to put udev rules in
/lib/udev. The problem with this is that/lib/udevis distinctly intended for udev rules from the distribution. It is NOT meant to be manipulated so heavily. Instead, system admins ought to use/etc/udevto put custom rules.This ordinarily isn't a problem for EnvyControl because most distros don't care if you modify
/lib/, but immutable distros like Fedora Silverblue do care./lib/is not writable, but/etc/is. There's a reason for that.This PR changes the udev directory to
/etc/udev/, but everything still works as expected with this change. I also added logic to check if the distribution uses ostree by checking for/ostreeand/sysroot/ostree, which are the two places where you would usually find the ostree directory. My amateur testing on Bluefin has shown that switching between integrated and hybrid modes works perfectly.