Use doas instead of sudo if it's installed (fixed)#364
Use doas instead of sudo if it's installed (fixed)#364StratusFearMe21 wants to merge 3 commits intograysky2:masterfrom
Conversation
There was a problem hiding this comment.
Thanks for your improvements, @StratusFearMe21! I'm not an official maintainer here or anything, but I've been maintaining a personal OpenBSD port and have proposed some changes to increase portability to BSDs (see Issue #344 & PR #348).
So, the following suggestions come from using doas under OpenBSD and my efforts to improve portability, but also to minimize changes for @graysky2 to review and later maintain:
- I'd lean toward using only
SUDOand just setting it to eithersudoordoasand using it as the binary to execute - It seems like a reasonable requirement that
$SUDOshould be inPATHand could be confirmed withwhichindep_check() doasdoes support the-noption, so probably best to retain that so thatprofile-sync-daemondoesn't try to prompt for authentication interactively- The change to use
runuserinstead ofsudois not portable, so I'd suggest continuing to use$SUDO -uin its stead
Of course, that still leaves the sudo -kn situation. I submit the following for consideration:
- While
doasdoes not supportsudo's-koption, it does have a-Loption which appears to be equivalent tosudo -kwithout a command (doas -Lexits without running a command) - While it would change the functionality by invalidating cached credentials for the session, instead of just ignoring cached credentials while executing the command, by separately calling
sudo -kbeforesudo -n [...]we could more easily & cleanly conditionally execute either$SUDO -kor$SUDO -Ldepending on the value of$SUDO - That would also allow
$SUDO -n [...]to be used without adding further conditionals
I'm curious regarding your thoughts. I'm happy to put together an alternate PR, but wouldn't be able to until Sunday at the earliest.
|
@graysky2 Any chance this gets merged? This seems like not a big change and thus doable. I could help make this PR even shorter and more in line with the rest of the code, if you wish. |
|
I never used |
Fixes the issues in #323. Same concept as the original