gtk2/SuSEconfig.gtk2

82 lines
2.4 KiB
Bash

#! /bin/sh
# Copyright (c) 2002 SuSE Gmbh Nuernberg, Germany. All rights reserved.
#
# Author: Holger Hetterich <hhetter@suse.de>, 2002
#
# SuSEconfig.gtk: this script will generate a /etc/gtk-2.0/gtk.immodules file
# based on the gtk-2.0 modules installed on the system
#
#
# check if we are started as root
# only one of UID and USER must be set correctly
if test "$UID" != 0 -a "$USER" != root; then
echo "You must be root to start $0."
exit 1
fi
test -n "$ROOT" && exit 0
# do we need to check for loaders? only on RPM Update or new installation
if test -f /var/adm/SuSEconfig/run-gtk ; then
test -d /etc/gtk-2.0 || mkdir /etc/gtk-2.0
if [ -x $r/usr/bin/gtk-query-immodules-2.0 ] ; then
/usr/bin/gtk-query-immodules-2.0 > /etc/gtk-2.0/gtk.immodules
fi
if [ -x $r/usr/bin/gdk-pixbuf-query-loaders ] ; then
/usr/bin/gdk-pixbuf-query-loaders > /etc/gtk-2.0/gdk-pixbuf.loaders
fi
if [ -x $r/usr/bin/gtk-query-immodules-2.0-64 ] ; then
/usr/bin/gtk-query-immodules-2.0-64 > /etc/gtk-2.0/gtk64.immodules
fi
if [ -x $r/usr/bin/gdk-pixbuf-query-loaders-64 ] ; then
/usr/bin/gdk-pixbuf-query-loaders-64 > /etc/gtk-2.0/gdk-pixbuf64.loaders
fi
rm /var/adm/SuSEconfig/run-gtk
fi
# Remove all old icon cache files to prevent keeping of empty
# directories with icon-theme.cache after removing themes.
if test -f $r/var/cache/gtk-2.0/icon-theme.cache-list ; then
for DIR in $(<$r/var/cache/gtk-2.0/icon-theme.cache-list) ; do
if test $(ls -1 "$DIR" | wc --lines) -le 1 -a -f $DIR/icon-theme.cache; then
rm -f $DIR/icon-theme.cache
rmdir --ignore-fail-on-non-empty "$DIR"
else
if test -f $DIR/icon-theme.cache -a "$(find $DIR -type d -newer $DIR/icon-theme.cache)" ; then
rm -f $DIR/icon-theme.cache
fi
fi
done
rm /var/cache/gtk-2.0/icon-theme.cache-list
fi
# Update icon cache.
(
# Be sure, that environment is set properly.
if test -z "$XDG_DATA_DIRS" ; then
if test -f $r/etc/profile.d/xdg-enviroment.sh ; then
. $r/etc/profile.d/xdg-enviroment.sh
fi
fi
IFS="$IFS:"
for DIR in ${XDG_DATA_DIRS:-/usr/local/share/:/usr/share/} ; do
for SUBDIR in $DIR/icons/* ; do
if test ! -L "$SUBDIR" -a -d "$SUBDIR" ; then
/usr/bin/gtk-update-icon-cache --quiet --ignore-theme-index --remove-empty-cache "$SUBDIR"
if test -f $SUBDIR/icon-theme.cache ; then
echo $SUBDIR >>$r/var/cache/gtk-2.0/icon-theme.cache-list
fi
fi
done
done
)
exit 0