Dominique Leuenberger
4a5d92d903
Looks fine... we'd probably want a lint warning on mime files being installed without the post/postun macros in plus though. OBS-URL: https://build.opensuse.org/request/show/50000 OBS-URL: https://build.opensuse.org/package/show/GNOME:Factory/shared-mime-info?expand=0&rev=14
41 lines
1.7 KiB
Plaintext
41 lines
1.7 KiB
Plaintext
# RPM macros for packages installing a MIME type according to the XDG specification
|
|
#
|
|
###
|
|
#
|
|
# When a package installs a MIME type as per the XDG specification, it should
|
|
# use both macros:
|
|
#
|
|
# - %mime_database_post in %post
|
|
# - %mime_database_postun in %postun
|
|
#
|
|
# Note that these macros can optionally take as argument the directory
|
|
# where the MIME type is installed. If no argument is passed, then
|
|
# %{_datadir}/mime will be used (which is where applications usually install
|
|
# the MIME type information).
|
|
#
|
|
###
|
|
|
|
# On install, update the mime database
|
|
%mime_database_post() \
|
|
if test -x %{_bindir}/update-mime-database; then \
|
|
%if "x%1" != "x%%1" \
|
|
%{_bindir}/update-mime-database "%1" || true \
|
|
%else \
|
|
%{_bindir}/update-mime-database "%{_datadir}/mime" || true \
|
|
%endif \
|
|
fi
|
|
|
|
# On uninstall, update the mime database. Note: we ignore upgrades (already
|
|
# handled in %post of the new package).
|
|
%mime_database_postun() \
|
|
if [ $1 -eq 0 ]; then \
|
|
if test -x %{_bindir}/update-mime-database; then \
|
|
%{_bindir}/update-mime-database "${MIME_DIR}" || true \
|
|
%if "x%1" != "x%%1" \
|
|
%{_bindir}/update-mime-database "%1" || true \
|
|
%else \
|
|
%{_bindir}/update-mime-database "%{_datadir}/mime" || true \
|
|
%endif \
|
|
fi \
|
|
fi
|