Question: What do I need to add to my `.spec` file to create the desktop shortcut and assign an icon to the shortcut during install of my `.rpm`? If a script is required, an example would be very helpful.

Answer: 
akdom has given a fairly good answer, but doesn't do its relevance justice.

Many common desktops, including Gnome, KDE and XFCE where relevant, implement the specifications laid out by [freedesktop.org](http://www.freedesktop.org/). Among these, is the [Desktop Entry Specification](http://standards.freedesktop.org/desktop-entry-spec/latest/) which describes the format of files that define desktop icons, and [Desktop Base Directory Specification](http://standards.freedesktop.org/basedir-spec/latest/) that describes the locations that desktop environments should look to find these files.

Your RPM needs to include a .desktop file, as specified by the [Desktop Entry Specification](http://standards.freedesktop.org/desktop-entry-spec/latest/), and install it in the correct location as specified either by the [Desktop Base Directory Specification](http://standards.freedesktop.org/basedir-spec/latest/), or in a distribution specific location (I imagine there will be aliases to use in the spec file for this location).
To create a desktop icon to an application follow the two steps below.

1. In an Editor create a new file.

```
gedit ~/.local/share/applications/NameYouWantForApplication.desktop

```
2. Place this section within the file and save it.

```
[Desktop Entry]
Type=Application
Encoding=UTF-8
Name=JeremysPentaho
Comment=Whatever Comment You want
Exec=/home/yourname@yourdomain.com/Source/Pentaho/data-integration/spoon.sh
Icon=/home/yourname@yourdomain.com/Source/Pentaho/data-integration/NameOfmyIconFile.jpg
Terminal=false

```