From 97eafa63a5e9bc43cd4db8dcfc3492f7d618f5d8 Mon Sep 17 00:00:00 2001 From: Slava Monich Date: Sat, 13 Nov 2021 04:05:06 +0200 Subject: [PATCH] [rpm] Remove cached files during uninstallation --- rpm/openrepos-books.spec | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/rpm/openrepos-books.spec b/rpm/openrepos-books.spec index 552dc58..635ed38 100644 --- a/rpm/openrepos-books.spec +++ b/rpm/openrepos-books.spec @@ -47,6 +47,12 @@ desktop-file-install --delete-original \ --dir %{buildroot}%{_datadir}/applications \ %{buildroot}%{_datadir}/applications/*.desktop +%preun +if [ "$1" == 0 ] ; then \ + getent passwd | grep -v '/nologin$' | \ + while IFS=: read -r name pw uid gid comment home shell; \ + do rm -fr "$home/.local/share/openrepos-books"; done; fi || : + %files %defattr(-,root,root,-) %{_bindir}/%{name}