First - systemd user units exist … and second - theres nothing saying you cant use sudo -U
(remember sudo
is not equivalent to “super user do” it is more equivalent to “do as” … and that can be any user)
EDIT
And heres some more food for thought.
Sorry for the tome … it looks bigger than it is because of quotations.
I should clarify again that pacdiff -s
accomplishes this already quite well, which is why I eventually considered the fork unnecessary.
While somewhat less than intuitive … the ‘view’ option of pacdiff indeed works as ‘view and edit’, while -s
is not simply ‘pass sudo’ … its rather sudoedit
… meaning it handles permissions properly and is acting on temporary files and uses sudo afterwards to apply changes.
man pacdiff
[...]
-s, --sudo
Use sudo and sudoedit to merge/remove files.
[...]
[...]
-e, --edit
Edit one or more files instead of running a command. In lieu of a path name, the string "sudoedit" is used when consulting the security policy. If the user is autho‐
rized by the policy, the following steps are taken:
1. Temporary copies are made of the files to be edited with the owner set to the invoking user.
2. The editor specified by the policy is run to edit the temporary files. The sudoers policy uses the SUDO_EDITOR, VISUAL and EDITOR environment variables (in that
order). If none of SUDO_EDITOR, VISUAL or EDITOR are set, the first program listed in the editor sudoers(5) option is used.
3. If they have been modified, the temporary files are copied back to their original location and the temporary versions are removed.
To help prevent the editing of unauthorized files, the following restrictions are enforced unless explicitly allowed by the security policy:
• Symbolic links may not be edited (version 1.8.15 and higher).
• Symbolic links along the path to be edited are not followed when the parent directory is writable by the invoking user unless that user is root (version 1.8.16 and
higher).
• Files located in a directory that is writable by the invoking user may not be edited unless that user is root (version 1.8.16 and higher).
Users are never allowed to edit device special files.
If the specified file does not exist, it will be created. Unlike most commands run by sudo, the editor is run with the invoking user's environment unmodified. If the
temporary file becomes empty after editing, the user will be prompted before it is installed. If, for some reason, sudo is unable to update a file with its edited ver‐
sion, the user will receive a warning and the edited copy will remain in a temporary file.
[...]
…meaning … that there is not a reason to make all of these extra functions.
If you need/want to add yad or other graphical notifications and/or buttons then go for it.
But pacdiff -s
alone will handle all of the pacnew/pacsave and permissions and editing and so on … so long as DIFFPROG
is set to whatever your preferred editor is. If set to meld … then pacdiff -s
will do what this utility does, but better (just without the graphical prompts) … so I humbly suggest you revisit this with these things in mind …
Once again:
yad = ok
circumventing pacdiff for no good reason = less ok