[ 
https://jira.codehaus.org/browse/MRPM-110?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=297174#comment-297174
 ] 

Michael Wenig commented on MRPM-110:
------------------------------------

Thanks to the user mailing list I found out the problem:

I was using the wrong scriptlet (prepare instead of preinstall).

I would suggest to improve the documentation at this point by a list/matrix 
when which script is executed (e.g. that preinstall is also executed before an 
update) - actually there is a big amount of detailed knowledge about the 
rpmbuild-tool.

=> problem solved
=> please update documentation
                
> Scripts are executed during Build
> ---------------------------------
>
>                 Key: MRPM-110
>                 URL: https://jira.codehaus.org/browse/MRPM-110
>             Project: Mojo RPM Plugin
>          Issue Type: Bug
>    Affects Versions: 2.1-alpha-1
>         Environment: RedHat EL 6, Jenkins, 
>            Reporter: Michael Wenig
>            Priority: Critical
>
> I am not sure if I am misusing this plugin...
> I have a java application (daemon) which is build by maven and packaged into 
> an rpm using the maven-rpm-plugin.
> I added a script to automatically start the daemon (by calling 
> /etc/init.d/..) 
> Now I get errors from our build-server as this gets executed on the 
> BUILD-Server (and is intended to only run on the destination machine where 
> the rpm will be installed)
> Am I'm doing something wrong or is this a bug?
> below is the used configuration:
> {code}
>                       <plugin>
>                 <groupId>org.codehaus.mojo</groupId>
>                 <artifactId>rpm-maven-plugin</artifactId>
>                 <version>2.1-alpha-1</version>
>                 <extensions>true</extensions>
>                 <configuration>
>                       <group>${project.groupId}</group>
>                       <name>deployAgent</name>
>                       <projversion>${project.version}</projversion>
>                       <autoRequires>false</autoRequires>      <!-- reines 
> JAVA -->
>                               <defaultFileMode>644</defaultFileMode>
>                               <defaultDirMode>755</defaultDirMode>
>                               <defaultUsername>deployment</defaultUsername>
>                               <defaultGroupname>root</defaultGroupname>
>                               <requires>
>                                       <require>internal-Java &gt;= 
> 1.6</require>
>                               </requires>
>                       <mappings>
>                               <mapping>
>                                       
> <directory>${userconf.dstRoot}</directory>
>                                       <filemode>440</filemode>
>                                       <username>root</username>
>                                       <groupname>root</groupname>
>                                       <!-- 
>                                       Verzeichnisrechte von /etc/sudoers.d 
> sind falsch
>                                        -->
>                                       <sources>
>                                               <source>        
>                                                       
> <location>${project.build.directory}/sudoers/deployAgent</location>
>                                               </source>
>                                       </sources>
>                               </mapping>
>                               <mapping>
>                                       
> <directory>${rpm.dstRoot}/lib</directory>
>                                       <dependency>
>                                               <excludes>
>                                                       
> <exclude>${project.groupId}:DeployAgent-scripts</exclude>
>                                               </excludes>
>                                       </dependency>
>                               </mapping>
>                               <mapping>
>                                       
> <directory>${rpm.dstRoot}/log</directory>
>                               </mapping>
>                               <mapping>
>                                       
> <directory>${rpm.dstRoot}/logs</directory>
>                               </mapping>
>                               <mapping>
>                                       <filemode>754</filemode>
>                                       
> <directory>${rpm.dstRoot}/bin</directory>
>                                       <sources>
>                                               <source>        
>                                                       
> <location>${project.build.directory}/scripts</location>
>                                               </source>
>                                       </sources>
>                               </mapping>
>                               <mapping>
>                                       
> <directory>${rpm.dstRoot}/conf</directory>
>                                       <sources>
>                                               <source>        
>                                                       
> <location>${basedir}/conf</location>
>                                               </source>
>                                       </sources>
>                               </mapping>
>                               <!-- 
>                               <mapping>
>                                       <filemode>644</filemode>
>                                       
> <directory>${rpm.dstRoot}/jsw</directory>
>                                       <sources>
>                                               <source>        
>                                                       
> <location>${project.build.directory}/generated-resources/appassembler/jsw</location>
>                                               </source>
>                                       </sources>
>                               </mapping>
>                               <mapping>
>                                       <filemode>644</filemode>
>                                       
> <directory>${rpm.dstRoot}/jsw/app1/conf</directory>
>                                       <sources>
>                                               <source>        
>                                                       
> <location>${basedir}/conf</location>
>                                               </source>
>                                       </sources>
>                               </mapping>
>                                                     -->                       
>                       </mappings>
>                       <postinstall>
>                               ln -fs 
> /infrastructure/deployment/deployAgent/bin/startstop.sh 
> /etc/init.d/deployAgent
>                               <!-- die Rechte werden hier falsch gesetzt, 
> daher wieder zurück -->
>                               chown root ${userconf.dstRoot}
>                               chmod 0750 ${userconf.dstRoot}
>                                       /etc/init.d/deployAgent start
>                       </postinstall>
>                       <prepareScriptlet>
>                               <script>
>                                       /etc/init.d/deployAgent stop
>                               </script>
>                       </prepareScriptlet>
>                 </configuration>
>             </plugin>
> {code}
> The problem occurs in the prepareScriptlet which gets executed during build 
> and failing because of missing permissions to do something in /etc/init.d on 
> the build-server (which is correct as this does not make any sense there).
> What do I have to do to execute this command during rpm-install/rpm-update 
> but not during build?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira



---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to