0

I am using rpm-maven-plugin to package a spring boot executable jar as an init.d service.

While I am able to set file permissions via plugin configuration (as shown in the code below), I would also like to set a file attribute, namely chattr +i service.jar.

    <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>rpm-maven-plugin</artifactId>
        <version>2.1.5</version>
        <executions>
            ...
        </executions>
        <configuration>
            ...
            <mappings>
                <mapping>
                    <directory>/opt/myservice/bin</directory>
                    <filemode>500</filemode>
                    <sources>
                        <source>
                            <location>${project.build.directory}/service.jar</location>
                        </source>
                    </sources>
                </mapping>
            ...
            </mappings>
        </configuration>
    </plugin>

At the moment, I am thinking about adding post-install and pre-remove scripts to modify the attribute.

Is there a way to achieve this without having to use the scripts?

Andrew
  • 2,663
  • 6
  • 28
  • 50
  • Can you tell what `chattr +i ...` means? – khmarbaise Jun 15 '17 at 10:01
  • @khmarbaise It sets the immutable attribute so that the jar cannot be modified. But, I assume you know that anyways. Is there anything wrong with this approach? – Andrew Jun 15 '17 at 11:37

0 Answers0