Maven-rpm-plugin sets folder permissions differently than files when mapping

How do I set folder permissions (i.e. 775) while files should be set to 664? If the folders are set to 664 then users other than the rpm installer (root) will see '?' instead of the owner / permissions of the files, and I prefer not to set the permissions of all files to 775. The structure is similar to this question !

+3


source to share


2 answers


I did it using tags <default??>

. Then, if you need to override the default settings, you can use the tag <filemode>

in the section <mapping>

(but <defaultDirmode>

, <defaultUsername>

, <defaultGroupname>

are applicable only to <mapping>

when <filemode>

, <username>

and <groupname>

not filled). Here's the documentation for the plugin options .



<plugin>
   <groupId>org.codehaus.mojo</groupId>
   <artifactId>rpm-maven-plugin</artifactId>
   <version>2.1.3</version>

   ....

    <configuration>
       ....
       <defaultDirmode>755</defaultDirmode>
       <defaultFilemode>644</defaultFilemode>
       <defaultGroupname>MyGroup</defaultGroupname>
       <defaultUsername>MyUser</defaultUsername>
       ....
    </configuration>
</plugin>

      

+6


source


One solution is to map it twice, excluding files in one mapping and excluding folders in the next. Any better ideas?



<mapping>
    <directory>/opt/bin</directory>
    <filemode>755</filemode>
    <username>myUser</username>
    <groupname>myUser</groupname>
    <sources>
        <source>
            <location>bin</location>
            <excludes>
                <exclude>*.*</exclude>
            </excludes>
        </source>
    <sources>
</mapping>

<mapping>
<directory>/opt/bin</directory>
<filemode>664</filemode>
<username>myUser</username>
<groupname>myUser</groupname>
<directoryIncluded>false</directoryIncluded>
<sources>
    <source>
        <location>bin</location>
    </source>
<sources>
</mapping>

      

+2


source







All Articles