
* update-icon-caches: new script, updates the icon caches in a given list of directories. It is meant to be used by packages shipping icons, in the postinst/postrm. For transition purposes, icon caches are currently updated but not created if they don't already exist. * Install this script and its manual page in libgtk2.0-bin.
27 lines
573 B
Bash
27 lines
573 B
Bash
#! /bin/sh
|
|
set -e
|
|
|
|
case "$1" in
|
|
""|-h|--help)
|
|
echo "Usage: $0 directory [ ... ]"
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
for dir in "$@"; do
|
|
if [ ! -d "$dir" ]; then
|
|
echo "$dir is not a directory"
|
|
exit 2
|
|
fi
|
|
if [ -f "$dir"/index.theme ]; then
|
|
if [ -f "$dir"/icon-theme.cache ]; then
|
|
# The cache already exists, regenerate it
|
|
gtk-update-icon-cache --force --quiet "$dir"
|
|
fi
|
|
else
|
|
# No more index.theme, remove the cache if it exists
|
|
rm -f "$dir"/icon-theme.cache
|
|
rmdir -p --ignore-fail-on-non-empty "$dir"
|
|
fi
|
|
done
|