bedrocklinux / bedrocklinux-userland

This tracks development for the things such as scripts and (defaults for) config files for Bedrock Linux
https://bedrocklinux.org
GNU General Public License v2.0
602 stars 65 forks source link

[PAUSED] pmm: Add auto_escalate[] logic #214

Open NICHOLAS85 opened 3 years ago

NICHOLAS85 commented 3 years ago

Allows a pm to set auto_escalate[]. When this var is set its value will be used to populate ${root_user} for other pms. This is useful to mimic autosudoing uis behaviors like yay for other pms.

I tested every command to check whether they needed root permissions or not to function and prepended the command which did. However, this doesn't mean I didn't miss any or miss-categorize so I'll keep checking each commands behavior as I use this pr. The Bedrock documentation would need to be updated to reflect this new variable of course.

NICHOLAS85 commented 3 years ago

Current issues after a day of usage: Caching package database requires root and does not currently automatically escalate. I believe this was an issue already present in pmm that hadn't made itself apparent yet. yay, the only pm and pmm ui which a user would run without privileges, is affected. Potential solutions can be to not cache when run as user like cache_package_manager_list or to escalate automatically using auto_escalate[]. What do you think?

I believe pmm has some internal logic for the ${unprivileged_user} var which cuts the extra space out from the command preview when it is unpopulated, I need to replicate this behavior for ${root_user}. - Fixed

NICHOLAS85 commented 3 years ago

Placed on hold until a per-user infrastructure is developed for pmm/Bedrock as pmm will have to manage non-root per-user package caches as well.