You are not logged in.

#1 2018-02-08 09:44:46

beta990
Member
Registered: 2011-07-10
Posts: 207

Delete user files with a pacman hook?

Is it possible to clear the local files (e.g. user) on package upgrades?
I was thinking of adding a Plasmashell hook that clears the cache after an upgrade.
Would that be a good solution? I had multiple issues with the Plasma cache in the past.

[Trigger]
Operation=Install
Operation=Upgrade
Type=Package
Target=plasma-desktop
Target=plasma-framework
Target=qt5-base

[Action]
Depends=kbuildsycoca5
Depends=kdelibs
When=PostTransaction
Exec=rm ~/.config/Trolltech.conf; kbuildsycoca5 --noincremental; kbuildsycoca4 --noincremental; # Will this reference to /root?

Thanks!

Offline

#2 2018-02-08 13:19:40

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,447
Website

Re: Delete user files with a pacman hook?

It will definitely not work with the ~ as that will not expand to your user.  Depending on how hooks are processed, it may not be expanded to anything at all (this depends on whether the Exec= line is parsed by a shell or not, systemd service Exec lines, for example, are not).

It might also fail to run multiple commands separated by semicolons: a shell would run the multiple commands, but exec functions would fail with that input (worse yet, you couldd actually `rm` files called kbuildsycocoa5, kbuildsycoca4, etc, depending on the working directory, this could be quite bad).

Even if you work around all these problems, it still seems like a very bad way to accomplish your goals.

Can this cache clearing only happen when the package is upgraded?  Why is that the right time to do it?  You know the old versions still run after an upgrade (until the next restart) so any running process will then lose it's cache.  Why not clear the cache on shutdown, or reboot?

Last edited by Trilby (2018-02-08 13:20:11)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#3 2018-02-08 16:20:53

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: Delete user files with a pacman hook?

I'd just like to confirm that pacman hooks do not get parsed by a shell. You need to use /usr/bin/rm as it doesn't do $PATH lookup either, unless you do everything inside /bin/sh -c "my_exec_command".

Also I dislike the idea of deleting user files like that, the software should be clever enough to not reuse a broken cache...


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#4 2018-02-08 21:45:11

ngoonee
Forum Fellow
From: Between Thailand and Singapore
Registered: 2009-03-17
Posts: 7,354

Re: Delete user files with a pacman hook?

It seems you're trying to do this on your own personal machine? In that case just write a bash file to do it (hardcode the paths, don't use ~) and call that bash file as Eschwartz said.


Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.

Offline

#5 2018-02-08 22:47:16

Fixxer
Member
From: Poland
Registered: 2011-08-29
Posts: 210

Re: Delete user files with a pacman hook?

beta990

How much of RAM memory do you have?

Offline

Board footer

Powered by FluxBB