You are not logged in.

#1 2025-02-25 17:48:57

zerophase
Member
Registered: 2015-09-03
Posts: 235

How to properly handle needing root access for part of a program?

I'm using paru to update the system when I run pacmatic. Some times I need to use sudo to replace pacnew files. However, if I always run pacmatic with sudo that causes issues when paru updates packages from the aur. So, instead I've appended sudo to the calls to functions calling $pacdiff_program. Is there a better means of handling this than adding sudo to parts of a script? Is there any means that would not require editing the pacmatic script to run vimdiff with different permissions from the rest of pacmatic?

Offline

#2 2025-02-25 18:49:38

cryptearth
Member
Registered: 2024-02-03
Posts: 1,303

Re: How to properly handle needing root access for part of a program?

the point is to not automate it at all - same as you're not supposed to run updates unattented
just replacing current configs with new defaults also can cause severe issues - instead you're supposed to check the difference and merge them properly

Offline

#3 2025-02-25 18:56:52

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 24,072

Re: How to properly handle needing root access for part of a program?

I'm hoping they are just using pacdiff for an interactive merging session.

Speaking of which, it does have a dedicated -s option so pacdiff will properly invoke sudo on it's own. And the underlying question, sudoing the distinct necessary parts that actually require this is the way to do it for scripts.

Offline

#4 2025-02-25 20:51:52

zerophase
Member
Registered: 2015-09-03
Posts: 235

Re: How to properly handle needing root access for part of a program?

cryptearth wrote:

the point is to not automate it at all - same as you're not supposed to run updates unattented
just replacing current configs with new defaults also can cause severe issues - instead you're supposed to check the difference and merge them properly

I merge them manually after reviewing. pacmatic doesn't always play nice with paru, if paru is configured to update the AUR and Arch repos.

Maybe, pacmatic needs to be updated to not break if the pacman_program and pacdiff_program values are changed. I just put sudo before pacdiff_program calls. So, I can update AUR files, and have pacdiff delete the pacnew after I've edited everything to be the same.

Offline

#5 Yesterday 00:38:09

zerophase
Member
Registered: 2015-09-03
Posts: 235

Re: How to properly handle needing root access for part of a program?

I just noticed pacmatic is no longer in the aur? Can I just fork and add it back? Looks like the developer behind it is no longer involved with Arch.

All it is is a script that checks the news, and deals with notifying the user to update pacnew files and such.

Last edited by zerophase (Yesterday 00:38:50)

Offline

#6 Yesterday 04:44:08

cryptearth
Member
Registered: 2024-02-03
Posts: 1,303

Re: How to properly handle needing root access for part of a program?

then what's the need to run that as root anyway?

Offline

#7 Yesterday 13:00:36

zerophase
Member
Registered: 2015-09-03
Posts: 235

Re: How to properly handle needing root access for part of a program?

You can't delete the pacnew files without running as root. Pacmatic is script in Arch from like 16 years ago for adding a bunch of maintenance tasks every time pacman or an aur helper is run.

Offline

#8 Yesterday 14:28:49

cryptearth
Member
Registered: 2024-02-03
Posts: 1,303

Re: How to properly handle needing root access for part of a program?

well, I have not experienced what might happen when a package ships a .pacnew while another from a previous update still exists - but I still fail to see a point where one would want to auto-cleanup any .pacnew file en masse
and even then I would either use something like

sudo rm $(find / -name "*.pacnew")

or would use a pacman hook

Offline

Board footer

Powered by FluxBB