Skip to content

Commit

Permalink
ssu: Make sure the ssu cache is up-to-date.
Browse files Browse the repository at this point in the history
[ssu] Make sure the ssu cache is up-to-date. Fixes JB#56434

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.
  • Loading branch information
abranson committed Nov 22, 2021
1 parent 03138a8 commit eb6ce26
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 5 deletions.
30 changes: 26 additions & 4 deletions rpm/ssu.spec
Expand Up @@ -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

3 changes: 2 additions & 1 deletion ssu-update-repos
Expand Up @@ -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

0 comments on commit eb6ce26

Please sign in to comment.