I'm using rpm-maven-plugin to create an installation/upgrade RPM for my application which will be installed on CentOS 7.
For a new installation, some packages are required, however rpm-maven-plugin ignores the settings in rpm.spec file (so 'Requires:' won't work) and it's impossible to execute yum or rpm from withing the RPM scripts.
Is there a configuration for the plugin which tells RPM to install the required packages (PostgresDB and sshpass in this case)?
If not, what is the best option? Tell the customer to manually install the requirements before installation the RPM or create a shell script which handles the complete setup?
Here is the relevant part of the pom.xml:
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>rpm-maven-plugin</artifactId>
<version>${rpm-maven-plugin.version}</version>
<inherited>false</inherited>
<executions>
<execution>
<inherited>false</inherited>
<phase>install</phase>
<goals>
<goal>rpm</goal>
</goals>
</execution>
</executions>
<configuration>
<license>Commercial</license>
<group>Networking/Admin</group>
<name>name</name>
<packager>packager</packager>
<prefix>$prefix</prefix>
<version>${project.version}</version>
<release>release</release>
<needarch>x86_64</needarch>
<mappings>
...
</mappings>
<requires>
<require>postgresql >= ${rpm.postgresql.version}</require>
<require>java-1.8.0-openjdk</require>
<require>sshpass</require>
</requires>
<postinstallScriptlet>
<script>
cd /opt/%{name}
if [ "$1" = 1 ] ; then
if [ -e ./install.sh ]; then
sh ./install.sh;
fi
fi
if [ "$1" = 2 ] ; then
sh ./upgrade.sh
fi
</script>
</postinstallScriptlet>
</configuration>
</plugin>
</plugins>
</build>