1

I'm using install4j and I'd like to know how I can specify that the software package has a GUI. I'm testing this with Mageia and there the packages are grouped as those with a GUI and those without a GUI. After installing my package it's in the list of packages without a GUI. But it's a Java desktop application with a GUI. Mageia shows those with a GUI by default so my package is hard to find.

Those without a GUI are mostly libraries which get installed as dependencies of other packages. The user usually only installs software with a GUI.

John Bollinger
  • 160,171
  • 8
  • 81
  • 157
Claude Martin
  • 745
  • 6
  • 21
  • 1
    That a package contains one or more GUI applications is not a native RPM concept, nor even a general Linux concept. I do not know specifically how Mageia distinguishes, but very likely it is based on a file or files installed or modified on the system. It might simply be whether the package installs a `.desktop` file in `/usr/share/applications` -- that would more or less correspond to a GUI application in the sense that it is accessible via the system menus. – John Bollinger Jul 05 '16 at 14:30
  • I see. I have found this. It explains it all and it looks very specific to mageia: https://wiki.mageia.org/en/Packaging_guidelines – Claude Martin Jul 05 '16 at 14:34
  • What you linked is not particularly specific to Mageia, in that it relies on a *de facto* standard for defining the contents of system menus. The same `.desktop` file you use with Mageia ought to work also with RedHat-family Linuxes and many others, as well. What seems specific to Mageia is referring to such packages as providing a GUI (which, as you observed, is confusing), and distinguishing between such packages and others. – John Bollinger Jul 05 '16 at 14:43
  • So I just have to add the desktop file to /usr/share/applications as a post install action. I'll try doing so with `desktop-file-install`. Any particular reason that install4j doesn't do that automatically? – Claude Martin Jul 05 '16 at 15:19
  • It's not clear to me exactly what you are doing, and I don't know exactly what Mageia is doing, but I'd wager that you need the `.desktop` file to be included in the RPM as an ordinary file, in the appropriate location, so that it will appear in the system's RPM database. I know even less why install4j isn't doing what you want, but I speculate that it's a variation on "because you didn't tell it to." – John Bollinger Jul 05 '16 at 15:30
  • The *.desktop file is there and it's valid, but it is in the installation folder. I can't find it in the menu and the user wouldn't know where to find it. There is a symlink in /usr/local/bin but that's just to start the application from a console. – Claude Martin Jul 05 '16 at 15:47
  • The Mageia docs you linked show how `desktop-file-install` could be run in the `%install` scriptlet defined in the RPM spec file. It would then also need to be named -- in that location -- in the `%files` section. I don't know how to tell install4j to do that, nor indeed to what extent you're relying on install4j for this. I generally write my RPM spec files by hand and use `rpmbuild` directly to generate RPMs. – John Bollinger Jul 05 '16 at 15:57

2 Answers2

1

For now I use this (for debian too):

Post Install:

#!/bin/bash

echo "Categories=Office;" >> XXXXX.desktop
if [ -x "$(command -v desktop-file-install)" ]; then
  desktop-file-install XXXXX.desktop
fi
if [ -x "$(command -v xdg-desktop-menu)" ]; then
  xdg-desktop-menu install --novendor XXXXX.desktop
fi

exit 0

Post Uninstall:

#!/bin/bash

if [ -f /usr/share/applications/XXXXX.desktop ]; then
  if [ -x "$(command -v xdg-desktop-menu)" ]; then
    xdg-desktop-menu uninstall --novendor XXXXX.desktop
  else
    rm "/usr/share/applications/XXXXX.desktop"
  fi
fi

exit 0

Note that I need to add Categories=Office; to the file, so Mageia/KDE would actually add it to the menu. It works without that on Ubuntu.
It's still not listed as an application with GUI, but at least it's in the menu so the user can start the application.
And you can't use variables of the script is in a file.

Claude Martin
  • 745
  • 6
  • 21
0

On Installer->Screens & Actions, you can add an empty custom application whose "Default execution mode" property is set to "Unattended mode" and then add a single "Add a desktop link" action for your launcher to the "Startup" node.

In the media wizard of your RPM archive, on the "Installer options->Post install script" step, you can then call that executable.

Ingo Kegel
  • 46,523
  • 10
  • 71
  • 102