From Fedora Project Wiki
(Created page with "{{Anchor|mimeinfo}} == mimeinfo == Use this when a package drops an XML file in %{_datadir}/mime/packages. <pre> %post touch --no-create %{_datadir}/mime/packages ||: %postun...")
 
Line 8: Line 8:
%postun
%postun
if [ $1 -eq 0 ] ; then
if [ $1 -eq 0 ] ; then
touch --no-create %{_datadir}/mime/packages ||:
  touch --no-create %{_datadir}/mime/packages ||:
/usr/bin/update-mime-database %{_datadir}/mime --somenewoption &> /dev/null || :
  /usr/bin/update-mime-database %{_datadir}/mime --somenewoption &> /dev/null || :
fi
fi



Revision as of 16:27, 27 June 2014

mimeinfo

Use this when a package drops an XML file in %{_datadir}/mime/packages.

%post
touch --no-create %{_datadir}/mime/packages ||:

%postun
if [ $1 -eq 0 ] ; then
  touch --no-create %{_datadir}/mime/packages ||:
  /usr/bin/update-mime-database %{_datadir}/mime --somenewoption &> /dev/null || :
fi

%posttrans
/usr/bin/update-mime-database %{_datadir}/mime --somenewoption &> /dev/null || :

Note that similarly to the gtk-update-icon-cache code, these scriptlets should be run only if the user has update-mime-info installed and without a specific Requires: shared-mime-info. If shared-mime-info is not installed, update-mime-database won't be run when this package is installed. This does not matter because it will be run when the shared-mime-info package is installed.