Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8301856

Generated .spec file for RPM installers uninstalls desktop launcher on update

XMLWordPrintable

    • b26
    • generic
    • linux

      ADDITIONAL SYSTEM INFORMATION :
      I used JDK 19.0.2 on Debian GNU/Linux 11 (bullseye), Release 11 with installed RPM tools.


      A DESCRIPTION OF THE PROBLEM :
      The generated .spec file of jpackage does not check the context in the `preun` step.

      When an application is updated by using the RPM executable, the new one is installed and then `preun` of the old installed application is run which would remove the desktop launcher after it was added.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      I generated a RPM installer with jpackage for our application.

      When installing this RPM (dnf install) on a Fedora, a desktop launcher is generated (~/.local/share/applications/*.desktop).

      When using the same RPM and running a reinstall (dnf reinstall), the new one is installed over the old one, but then the `preun` step of the old RPM is run and the desktop launcher is removed.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      On the `preun` step the context needs to be checked, if it is an uninstall or only an update of an already existing application. Something like:

      case "$1" in
        0)
          xdg-desktop-menu uninstall ...
        ;;
      esac
      ACTUAL -
      The context is not checked and therefore on an upgrade the desktop launcher is removed.

      ---------- BEGIN SOURCE ----------
      https://github.com/ecsec/open-ecard

      Running `./mvnw clean install -Ddesktop-package -Dpackage.type=RPM` will generate a corresponding RPM in `packager/richclient-packager/target/jpackage`

      Then this RPM can be installed on a Fedora machine (dnf install) and then you can check that a desktop launcher should be available in `~/.local/share/applications/*.desktop`. If running a reinstall on the same RPM (dnf reinstall), the desktop launcher is removed.
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      We use the jpackage argument `--resource-dir` to provide a custom .spec file that does the context check (see fix above in expected result).

      FREQUENCY : always


            asemenyuk Alexey Semenyuk
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: