[Slackbuilds-users] icon-theme.cache/doinst.sh(template)/sbo-maintainer-tools

B. Watson urchlay at slackware.uk
Sat Jun 17 19:20:37 UTC 2023



On Sat, 17 Jun 2023, Franzen via SlackBuilds-users wrote:

> Hi all,
>
> the content of a icon-file-cache(icon-theme.cache) like
> /usr/share/icons/ICON_DIRECTORY/icon-theme.cache
> depends on the tool "gtk-update-icon-cache".
> Also all present icon caches like
> /usr/share/icons/{ICON_DIRECTORY1,ICON_DIECTORY2}/icon-theme.cache
> are regenerated at boot by /etc/rc.d/rc.M.

Almost right. The caches only get regenerated if they already exist.
The code:

if find /usr/share/icons -maxdepth 2 2> /dev/null | grep -q icon-theme.cache ; then
   for theme_dir in /usr/share/icons/* ; do
     if [ -r ${theme_dir}/icon-theme.cache ]; then
       echo "Updating icon-theme.cache in ${theme_dir}..."
       /usr/bin/gtk-update-icon-cache -t -f ${theme_dir} 1> /dev/null 2> /dev/null &
     fi
   done

...and, by default, the caches *don't* exist, on a fresh
Slackware install. They only get created if the user manually runs
gtk-update-icon-cache to create them the first time [*].

That's why our doinst.sh has the "if [ -e usr/share/icons/hicolor/icon-theme.cache ];"

[*] We do have some builds which unconditionally create the icon
cache. These are errors, and should be fixed (and will be, this
week). One of them is games/steam, if you want an example. Probably I
will add a check to sbolint for this, too.

> So, i think icon-theme.cache in the icon-directory should never be present in 
> a package.

Correct. sbopkglint already checks for this, in predoinst.sh.

> -> sbo-maintainer-tools might check that presence
> -> sbo-maintainer-tools might warn if /usr/share/icons/ICON_DIRECTORY/
> is present, but doinst.sh does not call gtk-update-icon-cache

It does this, but only for hicolor.

> The logic to regenerate the cache if the cache is present does not make sense 
> to me,
> the cache should simply be (re)generated on installation.

Nope, see above.

> That said, it seems a lot of builds use the example from doinst.sh with
> usr/share/icons/hicolor, which does not make sense at all if there is no icon
> in usr/share/icons/hicolor in the package.
> Maybe sbo-maintainer-tools should also check for that.

sbopkglint does check this. Again, only for hicolor.

> What do you think? Feedback is welcome, thanks!

It might be worthwhile to have it check all icon dirs it finds,
rather than just hicolor. The vast majority of our packages only
install icons in hicolor (exceptions being *-icon-theme packages), so
I haven't worried too much about it...


More information about the SlackBuilds-users mailing list