topgrade icon indicating copy to clipboard operation
topgrade copied to clipboard

Run paccache after updates on Arch Linux-based systems

Open zombiepigdragon opened this issue 10 months ago • 0 comments

I want to suggest a new step

Which tool is this about? Where is its repository?

The Arch Linux pacman repo includes a script+service+timer for automatically cleaning the package cache by removing old copies of packages that are no longer installed and removing any packages of which there are more than three copies (Arch Wiki). I think that it makes sense for Topgrade to automatically run the tool after doing its normal upgrade routine in order to free up disk space without waiting for the weekly timer to trigger. I would suggest using the service because it's designed to run regularly ~~and because I already configured the service with overrides to change the default number of packages kept~~ though running it directly is also an entirely reasonable (and probably more expected) solution.

Which operating systems are supported by this tool?

Arch Linux and its derivatives (in general, pacman-based systems). I'm not sure if this includes devkitPro and other non-Arch pacman systems.

What should Topgrade do to figure out if the tool needs to be invoked?

Test for the existence of the service file (/usr/lib/systemd/system/paccache.service) or the program itself (command paccache or /usr/bin/paccache). Presumably if the user opts in to installing pacman-contrib they'll expect this to be run, like pacdiff from the same package.

Which exact commands should Topgrade run?

sudo systemctl start paccache.service or sudo /usr/bin/paccache -r (i.e. the default for the service, the arguments should .

More information

I started looking at implementing this myself, but I'm not completely sure about where to put it, so I decided to leave an issue rather than a probably-misplaced PR. I'll happily PR this myself after guidance on which implementation strategy (service VS invoking the command) is preferred (I suspect it's the command, but I can always dream of not copying my single line of config, can't I?) and which file/approximate line I should add this new step to (I'm guessing add a function to archlinux.rs and call it somewhere near line 231 of main.rs?)

zombiepigdragon avatar Apr 23 '24 05:04 zombiepigdragon