Issue
How I can generate a RPM that copy 3 files into 3 diferent folders?
For example:
I have: Mongo-watcher, config.properties and watcher.jar
Mongo-watcher has to be placed under: /etc/init.d/
Config.properties has to be placed under: /etc/living/mongo-watcher/
And finally watcher.jar has to be under: /usr/local/mongo-watcher/
I've tryed the following:
mkdir -p ~/rpmbuild/{RPMS,SRPMS,BUILD,SOURCES,SPECS,tmp}
cd ~/rpmbuild
mkdir mongo-watcher-1.0
mkdir -p mongo-watcher-1.0/etc/init.d
mkdir -p mongo-watcher-1.0/etc/living/mongo-watcher
mkdir -p mongo-watcher-1.0/usr/local/mongo-watcher
install -m 744 mongo-watcher /mongo-watcher-1.0/etc/init.d/
install -m 744 config.properties /mongo-watcher-1.0/etc/living/mongo-watcher/
install -m 744 watcher.jar /mongo-watcher-1.0/usr/local/mongo-watcher/
tar -zcvf mongo-watcher-1.0.tar.gz mongo-watcher-1.0/
mv mongo-watcher-1.0.tar.gz ./SOURCES
After that I don't know what I have to place on ./SPECS folder and how to do it for generating the rpm package that installs the following files under that folders.
Solution
You really should read the documentation first. If you hate reading, then you can watch some videos. Here are some https://docs.pagure.org/copr.copr/user_documentation.html#how-can-i-package-software-as-rpm
Some initial pointers:
cp Mongo-watcher config.properties watcher.jar ~/rpmbuild/SOURCES
vi ~/rpmbuild/SPECS/your-package.spec
Now you should create the spec, read the documentation The spec should contain
Source0: Mongo-watcher
Source1: config.properties
Source2: watcher.jar
And you may read rpmbuild simple copy of files as well.
Finally:
rpmbuild -ba ~/SPECS/your-package.spec
Answered By - msuchy Answer Checked By - Senaida (WPSolving Volunteer)