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