Issue
I am new for creating rpm files. I need to create a rpm file which will include multiple files and directories. The ownership of the file should be "nobody:nobody". The purpose of creating the rpm file is to distribute the files and directories on multiple remote servers in specific path(For example: /opt/test). The rpm will copy or overwrite the already existing files on the server.
For example: Under the path "/opt/test" there are multiples files and directories. The rpm file which will be created should copy or overwrite the files in "/opt/test". And when the rpm is uninstalled it should not remove the files and directories.
Please suggest me whether this can be done through rpm file or not.
Solution
Yes, this is possible with RPM. Install the files in some other directory such as /opt/test1
through RPM by specifying them in %files
target.
In the RPM's %postinst
script copy them from that directory (/opt/test1
) to /opt/test
.
This way, when you uninstall the RPM the files from /opt/test
won't get removed unless you remove than yourself in your postrm
script.
Answered By - Arpit Aggarwal Answer Checked By - Senaida (WPSolving Volunteer)