-2

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.

Lechucico
  • 1,914
  • 7
  • 27
  • 60

1 Answers1

3

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
msuchy
  • 5,162
  • 1
  • 14
  • 26
  • I'm missing something. I did all you say on that link 'rpmbuild simple copy of files'. I do on section install: mkdir -p %{buildroot}/etc/mongo-watcher/ ; cp -a config.properties %{buildroot}/etc/mongo-watcher/ and on section files: /etc/mongo-watcher/config.properties. I've got file not found on cp -a config.properties (config-properties is on SOURCES folder). – Lechucico Jun 02 '17 at 07:32
  • Do you have that Source1 line in your spec? It will help if you post whole spec file here. – msuchy Jun 04 '17 at 16:05