I'm a Kubuntu user and I ran into a situation recently where the app I wanted to install only came in an RPM. I've run into this situation before and always have to remember alien's syntax so I can install the RPM from Konsole. Kubuntu has a menu where I can right-click a DEB file in Konqueror to install it, so why not RPM's? Once I got bored of gripping I decided to create my own.
I specifically mentioned Kubuntu, but this technique should work in any Debian-based distro.
Creating the .desktop File
Step one is creating the blank file. I named mine rpm-install-servicemenu.desktop. The name doesn't matter, as long as the extension is .desktop it will work.
Step two is a simple matter of copying the code below into the .desktop file and saving it. Thanks to the folks who wrote the Kubuntu Package Menu. I used their code as a base for what's below.
[Desktop Entry] Version=1.0 Type=Application Encoding=UTF-8 Name=RPM Package Menu Comment=kde service menu for managing RPM packages ServiceTypes=application/x-rpm Actions=install;uninstall; X-KDE-Submenu=RPM Package Menu X-KDE-Priority=TopLevel [Desktop Action install] Name=Install Package Name[it]=Installa Icon=ok Exec=xterm -title "%c" -e 'sudo alien --scripts -i %U; echo "Press
to exit..."; read;' [Desktop Action uninstall] Name=Uninstall Package Name[it]=Disinstalla Icon=remove Exec=xterm -title "%c" -e 'sudo dpkg -P `echo %n | cut -d_ -f1`; echo "Press to exit..."; read;'
Sharp eyed observers will notice the programs that are executed by the script. In order for this to work you need to have the xterm and alien packages installed.
Kubuntu's Package Menu is only set up for Konqueror, but those of you like me who have already switched to Dolphin don't have to feel left out. The same file works in both programs. You just need to copy it from the Kubuntu directory listed directly below to the Dolphin directory farther down.
You can find the servicemenus directories for each app in the following locations. I listed those in your home directory because its safer to make modifications there. It's also more portable if you ever need to take your home with you. If you want the file available to any user then you will need to add it to the similar directory under /usr/share/apps/.
There is one potential issue that I should call out. Typical filenames in Debian and Ubuntu use an underscore to separate the package name and the version. The filename needs to do this in order for the uninstall action to work. However, I wouldn't worry about this too much because you can always uninstall the package using Adept, Synaptic, or another package manager, and the original filename won't matter.
That's it. We're done. Hopefully that was pretty painless. All you have to do now is find an RPM you want to install, download it, and right-click it in your file manager. Easy as pie.