From 1c8c3379b6f1505239c83b55fb959ad3e5f25567 Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Thu, 1 Apr 2021 19:27:56 +0200 Subject: [PATCH] Add pacman cache cleanup utilities --- .gitignore | 3 --- packages.yaml | 1 + root/etc/systemd/system/paccache.timer | 13 +++++++++++++ root/usr/share/libalpm/hooks/paccache.hook.bak | 15 +++++++++++++++ 4 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 root/etc/systemd/system/paccache.timer create mode 100644 root/usr/share/libalpm/hooks/paccache.hook.bak diff --git a/.gitignore b/.gitignore index 8d4e09f..0a02d59 100644 --- a/.gitignore +++ b/.gitignore @@ -22,9 +22,6 @@ env/ # Ignore ds store files .DS_STORE -# Backup files -*.bak - # Personal TODO files TODO diff --git a/packages.yaml b/packages.yaml index 7adb1b5..c46e6ae 100644 --- a/packages.yaml +++ b/packages.yaml @@ -8,6 +8,7 @@ pacman: - net-tools # CLI + - pacman-contrib # Contains many useful scripts for pacman, such as paccache - exa # Modern ls replacement - ncdu # Show folder sizes in a neat CLI graphical way - cron # Scheduling program diff --git a/root/etc/systemd/system/paccache.timer b/root/etc/systemd/system/paccache.timer new file mode 100644 index 0000000..8423e18 --- /dev/null +++ b/root/etc/systemd/system/paccache.timer @@ -0,0 +1,13 @@ +# Clean pacman cache of old and uninstalled packages every month +# This needs to be started by systemctl stat paccache.timer +# Usage requires pacman-contrib package to be installed + +[Unit] +Description=Clean-up old pacman pkg + +[Timer] +OnCalendar=monthly +Persistent=true + +[Install] +WantedBy=multi-user.target diff --git a/root/usr/share/libalpm/hooks/paccache.hook.bak b/root/usr/share/libalpm/hooks/paccache.hook.bak new file mode 100644 index 0000000..53f1439 --- /dev/null +++ b/root/usr/share/libalpm/hooks/paccache.hook.bak @@ -0,0 +1,15 @@ +# Pacman hook to automatically run paccache -r with pacman +# This hook is disabled by default, it can be enabled by +# renaming this file from paccache.hook.bak to paccache.hook + +[Trigger] +Operation = Upgrade +Operation = Install +Operation = Remove +Type = Package +Target = * + +[Action] +Description = Cleaning pacman cache with paccache ... +When = PostTransaction +Exec = /usr/bin/paccache -r