Skip to content

[RPM] Missing %post support and broken %postun implementation in MakeRPMConfig #306

@eximius313

Description

@eximius313

Description:
I found that the RPM packager implementation is missing critical functionality for executing scripts after installation and uninstallation.

Analyzing the source code in packages/flutter_app_packager/lib/src/makers/rpm/make_rpm_config.dart:

  1. Missing %post support:
    The MakeRPMConfig class does not have a post field definition at all. This makes it impossible to define a post-installation script (needed for udev rules, permissions, etc.) via configuration.

  2. Broken %postun support:
    The postun field exists in the MakeRPMConfig class, but it is ignored in the toJson() method. The %postun section in the Spec file generation is hardcoded, rendering the configuration field useless.

Source Code Reference:

  • Missing Field: The class properties list prep, build, install, postun, but post is missing.
  • Hardcoded Logic (toJson method):
// Current implementation ignores 'this.postun'
'%postun': ['update-mime-database %{_datadir}/mime &> /dev/null || :']
    .join('\n'),

Proposed Solution:

  1. Add String? post; to the MakeRPMConfig class and its constructor/factory.
  2. Map the configuration key (e.g., post_install_script) to this new post field in fromJson.
  3. Update toJson to correctly inject both post and postun into the generated map, respecting the user's configuration.
// Expected behavior in toJson():
'%post': [
  'update-mime-database %{_datadir}/mime &> /dev/null || :',
  post ?? '',
].join('\n'),

'%postun': [
  'update-mime-database %{_datadir}/mime &> /dev/null || :',
  postun ?? '', // Use the class field instead of ignoring it
].join('\n'),

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions