Skip to content
This repository was archived by the owner on Oct 1, 2024. It is now read-only.

Can not uninstall the rpm software through “rpm -e” #123

@xiaocw

Description

@xiaocw

I used rpm-maven-plugin to package a springboot applicaiton to rpm, and I use 'rpm -ivh xxxx.rpm' successfully installed it.
but I can not uninstall it by using 'rpm -e ', after I completed execute uninstall command, it also exsisted by using rpm -qa |grep xxx
below is my config:


4.0.0

org.springframework.boot
spring-boot-starter-parent
2.2.4.RELEASE


com.example
cx03
1.0.0
Demo project for Spring Boot, package by rpm

<properties>
    <java.version>1.8</java.version>
    <rpm.install.path>/opt/westone/${artifactId}</rpm.install.path>
    <rpm.prefix>${rpm.install.path}</rpm.prefix>
</properties>

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>

<!--rpm打包: mvn clean package -Dmaven.test.skip -Prpm-->
<profiles>
    <profile>
        <id>rpm</id>
        <build>
            <finalName>${project.artifactId}</finalName>
            <plugins>
                <plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                </plugin>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>rpm-maven-plugin</artifactId>
                    <version>2.2.0</version>
                    <extensions>true</extensions>
                    <executions>
                        <execution>
                            <goals>
                                <goal>rpm</goal>
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <prefix>${rpm.prefix}</prefix>
                        <distribution>westone</distribution>
                        <group>westone.com</group>
                        <packager>xiao.changwei</packager>
                        <version>${project.version}</version>
                        <autoRequires>true</autoRequires>
                        <release>1</release>
                        <requires>
                        </requires>
                        <mappings>
                            <mapping>
                                <directory>${rpm.install.path}/${project.artifactId}</directory>
                                <filemode>755</filemode>
                                <username>root</username>
                                <groupname>root</groupname>
                                <sources>
                                    <source>
                                        <location>target/${project.artifactId}.jar</location>
                                    </source>
                                </sources>
                            </mapping>
                            <mapping>
                                <directory>${rpm.install.path}/${project.artifactId}/bin</directory>
                                <filemode>750</filemode>
                                <username>root</username>
                                <groupname>root</groupname>
                                <sources>
                                    <source>
                                        <location>src/bin</location>
                                    </source>
                                </sources>
                            </mapping>
                        </mappings>
                        <preinstallScriptlet>
                            <script>echo "installing ${project.name} now"</script>
                        </preinstallScriptlet>
                        <postinstallScriptlet>
                            <script>
                                sed -i 's$XXX$${rpm.install.path}/${project.artifactId}/${project.artifactId}.jar$g' ${rpm.install.path}/${project.artifactId}/bin/startup.sh;
                                ${rpm.install.path}/${project.artifactId}/bin/startup.sh
                            </script>
                        </postinstallScriptlet>
                        <preremoveScriptlet>
                            <script>
                                ps -ef |grep ${project.artifactId} |grep -v grep|awk '{print "kill -9 " $2}'| sh;
                            </script>
                        </preremoveScriptlet>
                    </configuration>
                </plugin>
            </plugins>
        </build>
    </profile>
</profiles>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions