Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
xiaocw opened this issue Oct 30, 2020 · 0 comments
Open

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

xiaocw opened this issue Oct 30, 2020 · 0 comments

Comments

@xiaocw
Copy link

xiaocw commented Oct 30, 2020

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant