Tuesday, April 19, 2022

[SOLVED] Sharing common script functions with maven-rpm-plugin

Issue

I have two separate projects that are built into RPMs using the maven-rpm-plugin.

Both packages have a postinstall script, which contains some duplicated code.

I would like to move the duplicated code into a single 'functions' script that could be inherited by both packages. Is this possible?


Solution

Write the common script as a standalone *.sh shell script that is installed and invoked in %post (or any other rpm scriptlet).

Remove the duplication of code by adding a dependency on whatever package you choose to install the common script (but avoiding dependency loops).



Answered By - Jeff Johnson
Answer Checked By - Marie Seifert (WPSolving Admin)