Complicated post script

Michael A. Peters mpeters at mac.com
Tue May 3 17:05:51 UTC 2005


The package is tilp (software for linking Texas Instruments graphing
calculators)

I do not know if I want to submit this to extras or not, but I want my
spec file to be "right" so that if I ever do (or someone else wants
something to start with) it will be fine. Primary reason I may not want
to submit to Extras is I have trouble getting it work at all as non root
user with the SilverLink cable (same cable works in WinXP) and the
serial cable, while it works as non root, often reports data corruption
- and once it does, continues to do so until the next reboot (again, not
an issue in WinXP), so until it actually _works_ consistently, it would
never get passed my own QA let alone Extras. Supposedly the SVN version
is better, so maybe with the next release ...

Currently it does not build in rawhide (using gcc4 or gcc32) so I
suspect that it has some issues with updated gtk2 stuff, it does compile
in fc3.

Anyway, the spec file needs to add some stuff to /usr/share/file/magic
and if applicable - gnome and kde specific stuff.

I have a feeling the best way to do it is through trigger scripts, I'm
not sure on the proper way to remove them if the package is uninstalled
- they may not need to be.

This is what I have been doing in fc3

%post
# update magic stuff from brokem Makefile
MAGIC=%_datadir/file/magic
GNOME_MAGIC=/etc/gnome-vfs-mime-magic
KDE_MAGIC=/usr/share/mimelnk/magic

if [ -f ${MAGIC} ]; then
  # see if it needs updating
  if ! grep "\*\*TI85\*\*" ${MAGIC}; then
  cat %_datadir/tilp/magic/magic >> ${MAGIC}
  fi
fi
if [ -f ${GNOME_MAGIC} ]; then
  # see if it needs updating
  if ! grep "\*\*TI" ${GNOME_MAGIC}; then
  cat %_datadir/tilp/magic/gnome-vfs-mime-magic >> ${GNOME_MAGIC}
  fi
fi
if [ -f ${KDE_MAGIC} ]; then
  # see if it needs updating
  if ! grep "\*\*TI85" /usr/share/mimelnk/magic; then
  cat %_datadir/tilp/magic/kde.magic >> ${KDE_MAGIC}
  fi
fi
update-desktop-database %{_datadir}/applications

%postun
update-desktop-database %{_datadir}/applications

-=-
The first if block should not be an if block, it should require
%_datadir/file/magic. It does need to check though if it is already
installed.

The other two if blocks should not be required, they should be trigger
scripts triggered by the packages that own the files being modified,
correct?

If I'm not mistaken - update-desktop-database needs to be done AFTER the
gnome and kde specific mime stuff is updated, so would that need to be
in each triggerin script, or is there a way to say "run this trigger
script after any and all others"? I'm guessing the former, which means
it would be run twice for users with both KDE and Gnome, not the end of
the world I guess.

Rather that cat-ing the mime stuff - is there a "proper" utility that
will modify the mime files? That would seem to be a better way to do it,
as it would allow the format of those files to potentially change.

Am I even going about it the right way?

Is this the appropriate list for these kinds of questions?
I did not _see_ anything in the wiki about updating the mime stuff.




More information about the fedora-extras-list mailing list