From ab1aa5932956a20c2746f6bce2c2111c17bdb0cb Mon Sep 17 00:00:00 2001 From: Andrew Branson Date: Mon, 22 Nov 2021 16:59:35 +0100 Subject: [PATCH] ssu: Make sure the ssu cache is up-to-date. [ssu] Make sure the ssu cache is up-to-date. Fixes JB#54650 Add RPM file triggers to: - Touch any new ssu config files so it's newer than the cache - Remove caches when relevant files are removed. --- rpm/ssu.spec | 30 ++++++++++++++++++++++++++---- ssu-update-repos | 3 ++- 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/rpm/ssu.spec b/rpm/ssu.spec index d052017..0967e12 100644 --- a/rpm/ssu.spec +++ b/rpm/ssu.spec @@ -194,7 +194,29 @@ if [ "$1" == 0 ]; then getent group ssu >/dev/null && groupdel ssu fi -%post -/sbin/ldconfig -# make sure an old ssud isn't still running -killall ssud || : +%transfiletriggerin -- %{_datarootdir}/%{name} +# Touch all modified repo config files so they will be newer than the cache +grep \.ini$ | xargs -r touch +%{_bindir}/add-oneshot --now ssu-update-repos + +%transfiletriggerun -- %{_datarootdir}/%{name}/features.d/ +if [ "$1" == 0 ]; then + echo "Removing ssu feature cache" + rm -f /var/cache/ssu/features.ini +fi + +%transfiletriggerun -- %{_datarootdir}/%{name}/board-mappings.d/ +if [ "$1" == 0 ]; then + echo "Removing ssu board-mappings cache" + rm -f /var/cache/ssu/board-mappings.ini +fi + +%transfiletriggerun -- %{_datarootdir}/%{name}/repos.d/ +if [ "$1" == 0 ]; then + echo "Removing ssu main cache" + rm -f /var/cache/ssu/repos.ini +fi + +%transfiletriggerpostun -- %{_datarootdir}/%{name} +%{_bindir}/add-oneshot --now ssu-update-repos + diff --git a/ssu-update-repos b/ssu-update-repos index 4567b7b..7a6e428 100644 --- a/ssu-update-repos +++ b/ssu-update-repos @@ -5,5 +5,6 @@ if [ "$MIC_RUN" != "" ]; then exit 1 fi -touch /usr/share/ssu/board-mappings.d/*.ini 2>/dev/null +# Update repos +killall ssud 2>/dev/null || : /usr/bin/ssu updaterepos