Blame SOURCES/macros.gconf2

4c5df3
#
4c5df3
# RPM macros for gconf applications.
4c5df3
#
4c5df3
# (c) 2006-2007 SUSE LINUX
4c5df3
# Author: Stanislav Brabec <sbrabec@suse.cz>
4c5df3
# (c) 2009 Red Hat, Inc
4c5df3
# Author: Toshio Kuratomi <toshio@fedoraproject.org>
4c5df3
#
4c5df3
# License: LGPLv2+
4c5df3
#
4c5df3
# Usage:
4c5df3
#
4c5df3
# Preamble:
4c5df3
# Requires(pre): GConf2
4c5df3
# Requires(preun): GConf2
4c5df3
# Requires(post): GConf2
4c5df3
#
4c5df3
# schemas names are without path and suffix
4c5df3
#
4c5df3
#
4c5df3
# %pre
4c5df3
# %gconf_schema_obsolete schema1
4c5df3
# %gconf_schema_prepare schema2 schema3
4c5df3
#
4c5df3
# %preun
4c5df3
# %gconf_schema_remove schema2 schema3
4c5df3
#
4c5df3
# %post
4c5df3
# %gconf_schema_upgrade schema2 schema3
4c5df3
#
4c5df3
# %files
4c5df3
# %{_sysconfdir}/gconf/schemas/schema2.schemas
4c5df3
# %{_sysconfdir}/gconf/schemas/schema3.schemas
4c5df3
4c5df3
# Copy schemas from old package for later uninstall on upgrade
4c5df3
%gconf_schema_prepare() \
4c5df3
if [ "$1" -gt 1 ] ; then \
4c5df3
    rm -rf %{_localstatedir}/lib/rpm-state/gconf/* \
4c5df3
    for schema in %{*} ; do \
4c5df3
        if test -f %{_sysconfdir}/gconf/schemas/"$schema".schemas ; then \
4c5df3
            cp -p %{_sysconfdir}/gconf/schemas/"$schema".schemas %{_localstatedir}/lib/rpm-state/gconf/ || : \
4c5df3
        fi \
4c5df3
    done \
4c5df3
fi \
4c5df3
%{nil}
4c5df3
4c5df3
# Macro to remove schemas.  Not meant to be used publically
4c5df3
%_do_gconf_schema_remove() \
4c5df3
        if test -f %{_sysconfdir}/gconf/schemas/"$schema".schemas ; then \
4c5df3
            export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source` \
4c5df3
            gconftool-2 --makefile-uninstall-rule %{_sysconfdir}/gconf/schemas/"$schema".schemas > /dev/null || : \
4c5df3
        fi \
4c5df3
%{nil}
4c5df3
4c5df3
# Remove schemas unconditionally
4c5df3
%gconf_schema_obsolete() \
4c5df3
for schema in %{*} ; do \
4c5df3
    %_do_gconf_schema_remove \
4c5df3
done \
4c5df3
%{nil}
4c5df3
4c5df3
# Remove schemas on package removal (not upgrade)
4c5df3
%gconf_schema_remove() \
4c5df3
if [ "$1" -eq 0 ] ; then \
4c5df3
    for schema in %{*} ; do \
4c5df3
        %_do_gconf_schema_remove \
4c5df3
    done \
4c5df3
fi \
4c5df3
%{nil}
4c5df3
4c5df3
%gconf_schema_upgrade() \
4c5df3
for schema in %{*} ; do \
4c5df3
    if test -f %{_localstatedir}/lib/rpm-state/gconf/"$schema".schemas ; then \
4c5df3
        cmp --quiet %{_sysconfdir}/gconf/schemas/"$schema".schemas %{_localstatedir}/lib/rpm-state/gconf/"$schema".schemas \
4c5df3
        if test $? != 0; then\
4c5df3
            export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source` \
4c5df3
            gconftool-2 --makefile-uninstall-rule %{_localstatedir}/lib/rpm-state/gconf/"$schema".schemas > /dev/null || : \
4c5df3
            gconftool-2 --makefile-install-rule %{_sysconfdir}/gconf/schemas/"$schema".schemas > /dev/null || : \
4c5df3
        fi \
4c5df3
        rm -f %{_localstatedir}/lib/rpm-state/gconf/"$schema".schemas \
4c5df3
    else \
4c5df3
        export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source` \
4c5df3
        gconftool-2 --makefile-install-rule %{_sysconfdir}/gconf/schemas/"$schema".schemas > /dev/null || : \
4c5df3
    fi \
4c5df3
done \
4c5df3
%{nil}