Simon,
Four comments:
1) Your .desktop will have i18n/l10n bug.
If you goes into /usr/share/applications/, the .desktop files are
localized for multiple languages. Normally, there is a .desktop.in.in
file in code base, the .desktop file is generated during configure
time.
And, this change should be accepted by community, so please try to
get it upstreamed.
2) gtk-update-icon-cache in icon-cache.script will only update icon
caches under /usr/share/icons. Your icon is installed
under /usr/share/pixmap, I do not think you need it in %post.
3) From pkgmap, SUNWgkrellm does not ship any files to /usr/share/mime,
so I do not think you need run update-mime-database script in %post and
%postun
4) Now we are using %restart_fmri rather than using include/*.script. In
your case, the .desktop files under /usr/share/applications/ are
monitored by gnome-panel. Once there is change under the folder, the
menu will be updated accordingly. So totally, you do not need %post and
%postun at all.
-Halton.
On Thu, 2009-06-25 at 14:32 +0800, Simon wrote:
> Hi, All,
>
> Please review the attached patch which fixes bug 4216: SUNWgkrellm
> needs a .desktop file
>
> Any comments are welcome.
>
> Thanks
> Simon
> plain text document attachment (gkrellm.desktop.diff)
> Index: ext-sources/gkrellm.desktop
> ===================================================================
> --- ext-sources/gkrellm.desktop (revision 0)
> +++ ext-sources/gkrellm.desktop (revision 0)
> @@ -0,0 +1,8 @@
> +[Desktop Entry]
> +Name=GKrellM System Monitor
> +Comment=Monitor for CPU, memory, disks, network, mail
> +Exec=gkrellm
> +Icon=gkrellm
> +Terminal=false
> +Type=Application
> +Categories=System;
> Index: core/SUNWgkrellm.spec
> ===================================================================
> --- core/SUNWgkrellm.spec (revision 437)
> +++ core/SUNWgkrellm.spec (working copy)
> @@ -14,6 +14,7 @@
> Summary: Popular (ubiquitous) Gtk-based system monitor
> Version: 2.3.2
> Source:
> http://members.dslextreme.com/users/billw/gkrellm/gkrellm-%{version}.tar.bz2
> +Source1: gkrellm.desktop
> # date:2008-09-4 owner:henryz type:bug
> Patch1: gkrellm-01-ldflags.diff
> # date:2008-09-4 owner:henryz type:bug
> @@ -88,8 +89,28 @@
> # REMOVE l10n FILES
> rm -rf $RPM_BUILD_ROOT%{_datadir}/locale
> %endif
> +convert gkrellm.ico gkrellm.png
> +mv gkrellm-8.png gkrellm.png
> +mkdir -p $RPM_BUILD_ROOT%{_datadir}/applications
> +cp %{SOURCE1} $RPM_BUILD_ROOT%{_datadir}/applications
> +mkdir -p $RPM_BUILD_ROOT%{_datadir}/pixmaps
> +cp gkrellm.png $RPM_BUILD_ROOT/usr/share/pixmaps
>
> +%post
> +%include desktop-database-install.script
> #+%include scrollkeeper-update.script
> +( echo 'test -x %{_bindir}/update-mime-database || exit 0';
> + echo '%{_bindir}/update-mime-database %{_datadir}/mime'
> +) | $BASEDIR/lib/postrun -b -u -c JDS_wait
> +%include icon-cache.script
>
> +%postun
> +%include desktop-database-uninstall.script
> #+%include scrollkeeper-update.script
> +( echo 'test -x %{_bindir}/update-mime-database || exit 0';
> + echo '%{_bindir}/update-mime-database %{_datadir}/mime'
> +) | $BASEDIR/lib/postrun -b -u -c JDS_wait
> +
> %clean
> rm -rf $RPM_BUILD_ROOT
>
> @@ -102,6 +123,10 @@
> %{_bindir}/gkrellm
> %{_bindir}/gkrellmd
> %dir %attr (0755, root, sys) %{_datadir}
> +%dir %attr (0755, root, other) %{_datadir}/applications
> +%{_datadir}/applications/*
> +%dir %attr (0755, root, other) %{_datadir}/pixmaps
> +%{_datadir}/pixmaps/*
> %dir %attr (0755, root, bin) %{_mandir}
> %dir %attr (0755, root, bin) %{_mandir}/man1
> %{_mandir}/man1/gkrellm.1
>