1 # RPM macros for packages installing a GSettings schema or GIO module
5 # When a package installs a GSettings schemas, it should use all
8 # - %glib2_gsettings_schema_requires in the preamble
9 # - %glib2_gsettings_schema_post in %post
10 # - %glib2_gsettings_schema_postun in %postun
14 # When a package installs a GIO module, it should use all
17 # - %glib2_gio_module_requires in the preamble
18 # - %glib2_gio_module_post in %post
19 # - %glib2_gio_module_postun in %postun
21 # Note that %glib2_gio_module_post and %glib2_gio_module_postun can
22 # optionally take the path to the directory where modules live. This
23 # is useful for applications using the GIO module system on their own,
24 # since they will install modules in their own directory. If no
25 # argument is passed, the path for the modules for GIO itself is used.
29 %glib2_gsettings_schema_requires \
30 Requires(post): glib2-tools \
31 Requires(postun): glib2-tools
33 %glib2_gsettings_schema_post \
34 %{_bindir}/glib-compile-schemas %{_datadir}/glib-2.0/schemas &> /dev/null || :
36 # Note: we ignore upgrades (already handled in %post of the new package).
37 %glib2_gsettings_schema_postun \
38 if [ $1 -eq 0 ]; then \
39 %{_bindir}/glib-compile-schemas %{_datadir}/glib-2.0/schemas &> /dev/null || : \
42 %glib2_gio_module_requires \
43 Requires(post): glib2-tools \
44 Requires(postun): glib2-tools
46 # On install, update the cache
47 %glib2_gio_module_post() \
49 GIO_MODULES_DIR="%1" \
51 GIO_MODULES_DIR="%{_libdir}/gio/modules" \
53 %if "%{_lib}" == "lib64" \
54 %{_bindir}/gio-querymodules-64 "${GIO_MODULES_DIR}" \
56 %{_bindir}/gio-querymodules "${GIO_MODULES_DIR}" \
59 # On uninstall, update the cache. Note: we ignore upgrades (already
60 # handled in %post of the new package).
61 %glib2_gio_module_postun() \
62 if [ $1 -eq 0 ]; then \
64 GIO_MODULES_DIR="%1" \
66 GIO_MODULES_DIR="%{_libdir}/gio/modules" \
68 %if "%_lib" == "lib64" \
69 %{_bindir}/gio-querymodules-64 "${GIO_MODULES_DIR}" \
71 %{_bindir}/gio-querymodules "${GIO_MODULES_DIR}" \