I am developing a cross-platform UI with .Net Core and am packaging it using RPM Package Manager. I have created the RPM file to be locally installed. The %install section of my spec file looks like this

mkdir -p %{buildroot}/%{_bindir}
mkdir -p %{buildroot}/%{_bindir}/%{name}
mkdir -p %{buildroot}/%{_datadir}/applications
install -m 0755 %{name} %{buildroot}/%{_bindir}/%{name}
install -m 0755 *.dll %{buildroot}/%{_bindir}/%{name}
install -m 0755 *.json %{buildroot}/%{_bindir}/%{name}
install -m 0755 *.so %{buildroot}/%{_bindir}/%{name}
install -m 0755 %{name}.png %{buildroot}/%{_bindir}/%{name}

cat > %{buildroot}/%{_datadir}/applications/%{name}.desktop <<'EOF'
[Desktop Entry]

The project contains the executable for Linux, dependency files, and a .png for the icon. Under the installation step I have created a .desktop file and placed it in /usr/share/applications so the executable appears in applications when the package is installed.

I would like to know how to have the application have a desktop shortcut created when the package is installed so the user doesn't have to make it themselves. I know to do this manually after install you have to access the /usr/share/applications folder using Nautilus and copy the application to the desktop, but I would like for this to be done automatically.

I've tried using a copy command under the post installation section, but I don't know how to copy it to any users desktop who installs the package. Is there a command I can add to my spec file or created .desktop file to accomplish this?

  • 1
    Several points you need to consider and research: #1- WHICH desktop environment? IIRC, CentOS offers Gnome3 and KDE-Plasma by default, possibly MATE and others as well. You should research how to achieve this on each GDE, then include code in your RPM package that addresses each.
    – 0xSheepdog
    Jun 7, 2019 at 19:27
  • 1
    Packages are never supposed to touch users’ home directories. Jun 7, 2019 at 19:29
  • How would this even work? How would users created after the package was installed get the symlink? You’d be better of packaging an application that created it on login for graphical users, such as in /etc/xdg/autostart/.
    – jsbillings
    Jun 11, 2019 at 0:59

1 Answer 1


I would recommend to create link post successful installation instead of during, create link in %post section for rpm build.


Something link below


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .