-
-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat: conditional permissions behavior #28
Conversation
I also noticed that if we tell people that they can run quickpassthrough itself as root now, we will have to check if the I originally designed it to be run as the normal user so i never actually tested running it as sudo then normal user 😅 other than that i like the changes so far 😄 |
Thanks for the feedback! I was actually just checking in to ping you to request comment, so I'm happy to see you replied! I'll take a look :) |
@HikariKnight take a look when you can, I believe I've addressed your comments but this is a pretty heavy refactor so I definitely need a second pair of eyes |
The behavior that actually lead to me starting on this was that I would actually receive silent errors when I ran this command as a user after running it as root. This last commit, 395f5ab, finalizes my major changes for now I believe. Here's a demo of the behavior the aforementioned commit replaces silent fatal errors with: |
this gif looks nice, conveniently i am sick today so i surprisingly has freetime to look at the code once i have the paperwork done |
This looks good, will do a test build locally later today and test in VMs to make sure things work properly in ubuntu, pop, arch and fedora since this is a big refactor. |
Yes, this definitely needs to be looked at carefully and tested. Thanks for your efforts, and take care of yourself. |
Reduce cognitive complexity.
^ The code should be easier to review now, as well. |
Tested and working on Fedora Workstation (Grubby and Dracut test) |
Archlinux tested and works (pure grub and mkinitcpio test) only need the pop os test to succeed then we should be good @yunginnanet |
agreed on all points. adapter function added, complete with unit test |
cmd := fmt.Sprintf("cp -v %s %s", conffile, sysfile) | ||
|
||
err := command.ExecAndLogSudo(isRoot, false, cmd) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested everything but i had to patch this into
err := command.ExecAndLogSudo(isRoot, false, "cp", "-v", conffile, sysfile)
in order for everything to work as it got missed when we changed how ExecAndLogSudo worked. i will just patch that after merge
Overview
Current behavior asks for sudo password via stdin regardless on if we're root or not.
This PR adds an
IsRoot
boolean to the configuration struct and adjusts the final message appropriately, as well as other changes listed below.Change Items
HikariKnight/ls-iommu/pkg/common.ErrorCheck
ExecAndLogSudo
function to streamline running commands with elevated permissions.fileio.FileExist
to return both a boolean and an error.finalizeNotice
function to manually verify output messages.debug.log
to rename todebug_old.log
instead of deleting.