@bhe69,
Your config has installed_keep=2.
| Git Clone URL: | https://aur.archlinux.org/paccache-hook.git (read-only, click to copy) |
|---|---|
| Package Base: | paccache-hook |
| Description: | A configurable hook to cleanup the pacman package cache using paccache |
| Upstream URL: | None |
| Keywords: | cleanup hook paccache pacman |
| Licenses: | BSD |
| Conflicts: | pacman-cleanup-hook |
| Submitter: | Skycoder42 |
| Maintainer: | Skycoder42 |
| Last Packager: | Skycoder42 |
| Votes: | 60 |
| Popularity: | 1.69 |
| First Submitted: | 2019-03-23 10:57 (UTC) |
| Last Updated: | 2024-09-09 18:45 (UTC) |
@bhe69,
Your config has installed_keep=2.
For me removal of uninstalled packages is not working. Can anybody give me some pointers what I'm doing wrong?
I set up paccache-hook.conf as follows:
[bhe@box ~]$ cat /etc/paccache-hook.conf
extra_args=-v
cache_dirs=()
installed=true
installed_keep=2
installed_extra_args=
installed_move_to=
uninstalled=true
uninstalled_keep=0
uninstalled_extra_args="'--min-mtime=14 days ago'"
uninstalled_move_to=
Alsa-plugins was uninstalled more than 14 days ago, and still is uninstalled: [2024-04-16T22:57:10+0200] [ALPM] removed alsa-plugins (1:1.2.7.1-2)
[bhe@box ~]$ sudo pacman -Q alsa-plugins
error: package 'alsa-plugins' was not found
Still the package file is in cache, even though mtime is way more than "14 days ago":
[bhe@box ~]$ stat /var/cache/pacman/pkg/alsa-plugins-1\:1.2.7.1-2-x86_64.pkg.tar.zst
File: /var/cache/pacman/pkg/alsa-plugins-1:1.2.7.1-2-x86_64.pkg.tar.zst
Size: 89425 Blocks: 176 IO Block: 4096 regular file
Device: 1,10 Inode: 562135 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2023-11-06 23:12:07.899236660 +0100
Modify: 2023-03-03 10:08:08.000000000 +0100
Change: 2023-11-06 23:12:03.082474118 +0100
Birth: 2023-11-06 23:12:03.029139722 +0100
Has anybody an idea why this is not working?
I lost cache of uninstalld package because of uninstalled_keep=0 and even though i read the comment first, i didn't know any way to prevent it.
as mentioned by @archz, it would be nice to have those as defaults. i personally liked @escorares args, as it would remove cache of uninstalld package after 30 days.
setting uninstalled_keep=1 wil mean the package will be never removed unless explicitly done.
I personally configured paccache-hook.conf so that if I change my mind and install a package back, it doesn't have to be downloaded again if 30 days haven't passed.
uninstalled_extra_args="'--min-mtime=30 days ago'"
uninstalled_keep=0 can stay since
--min-atime <time>, --min-mtime <time> Keep packages with an atime/mtime that is not older than the time given, **even if this means keeping more than specified through the --keep option.** Accepts arguments according to info "Date input formats", e.g. 30 days ago.
This is great, thank you!
I'd like to offer two suggestions for consideration (in light of a mistake I made):
1) set default uninstalled_keep=1
-> It's safer than 0. The user may need to reinstall a package from their cache in the event of an erroneous uninstall.
2) set default extra_args=-v
-> The hook runs immediately after being installed, and may remove unexpected packages (as it did for me). With verbose logging, the user can easily determine what was removed. I see another user below mentioned they like verbosity off, but it's easier to remove the flag than it is to deal with lost info from a silent execution.
Thanks!
And thank you for this package! Appreciated!
@Skycoder42, please kindly install your custom BSD license in package(). Thank you in advance.
was annoyed by pacman-cleanup-hook's verbose output and lack of config.
this is perfect!
thank you <3
Thanks, really useful.
Looks like there's a bug in the for loop in paccache-hook.sh:
for cdir in $cache_dirs
only works with the first value in the array.
for cdir in ${cache_dirs[@]}
iterates over all values. That's bash syntax though...
Pinned Comments
Skycoder42 commented on 2019-03-23 11:00 (UTC)
This packages was inspired by pacman-cleanup-hook and builds on top of it by making the hook configurable. For a basic, non-configurable cleanup, check out that one!